编译osdrv出现的问题:(这次主要是在编译busybox出现的问题,中途如果出现问题,整个osdrv就要重新编译,感觉海思soc这点就有点那个了)
mkfs.jffs2.c: In function ‘interpret_table_entry’:
mkfs.jffs2.c:424:20: warning: format ‘%a’ expects argument of type ‘float *’, but argument 3 has type ‘char **’ [-Wformat=]
if (sscanf (line, "%" SCANF_PREFIX "s %c %lo %lu %lu %lu %lu %lu %lu %lu",
^
CC compr_rtime.o
CC compr_zlib.o
compr_zlib.c:39:18: fatal error: zlib.h: No such file or directory
compilation terminated.
common.mk:82: recipe for target '/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0/compr_zlib.o' failed
make[2]: *** [/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0/compr_zlib.o] Error 1
make[2]: Leaving directory '/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0'
Makefile:46: recipe for target '/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/sbin/mkfs.jffs2' failed
make[1]: *** [/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/sbin/mkfs.jffs2] Error 2
make[1]: Leaving directory '/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool'
Makefile:204: recipe for target 'hipctools' failed
make: *** [hipctools] Error 2
解决办法:
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv# sudo apt-get install zlib1g-dev
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/mkyaffs2image/mkyaffs2image# make clean
--------------------------------------------------------------------------------------
serve_image.c: In function ‘main’:
serve_image.c:32:18: error: storage size of ‘hints’ isn’t known
struct addrinfo hints;
^
serve_image.c:94:19: error:‘AI_ADDRCONFIG’ undeclared (first use in this function)
hints.ai_flags = AI_ADDRCONFIG;
^
serve_image.c:94:19: note: each undeclared identifier is reported only once for each function it appears in
serve_image.c:97:8: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
ret = getaddrinfo(argv[1], argv[2], &hints, &ai);
^
serve_image.c:99:40: warning: implicit declaration of function ‘gai_strerror’ [-Wimplicit-function-declaration]
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret));
^
serve_image.c:99:19: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret));
^
serve_image.c:103:35: error: dereferencing pointer to incomplete type ‘struct addrinfo’
for (runp = ai; runp; runp = runp->ai_next) {
^
common.mk:82: recipe for target '/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0/serve_image.o' failed
解决办法:
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0#vi /usr/include/netdb.h,然后取消565行和595行的注释:ifdef __USE_XOPEN2K endif
参考了这篇文章的方法2:http://blog.csdn.net/mtbiao/article/details/77052659
-------------------------------------------------------------------------------------------------------
serve_image.c: In function ‘main’:
serve_image.c:94:19: error: ‘AI_ADDRCONFIG’ undeclared (first use in this function)
hints.ai_flags = AI_ADDRCONFIG;
原来这样处理不行:(原因是tmp目录下的文件是临时性文件)
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp# cp /mnt/hgfs/ubuntu16.04.3-documents/5.hi3518EV200/build_tools/mtd-utils_1.5.2.orig.tar.bz2 ./
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp# mv mtd-utils-1.5.0 mtd-utils-1.5.0_backup
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp# tar -xvf mtd-utils_1.5.2.orig.tar.bz2
后来这样处理:
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp# mv mtd-utils_1.5.2.orig.tar.bz2 ./../
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool# ls
lzo-2.09.tar.gz Makefile mtd-utils-1.5.0.tar.bz2 mtd-utils_1.5.2.orig.tar.bz2 tmp
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool# mv mtd-utils-1.5.0.tar.bz2 mtd-utils-1.5.0_backup.tar.bz2
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool# ls
lzo-2.09.tar.gz Makefile mtd-utils-1.5.0_backup.tar.bz2 mtd-utils_1.5.2.orig.tar.bz2 tmp
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool# mv mtd-utils_1.5.2.orig.tar.bz2 mtd-utils-1.5.0.tar.bz2
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool# ls
lzo-2.09.tar.gz Makefile mtd-utils-1.5.0_backup.tar.bz2 mtd-utils-1.5.0.tar.bz2 tmp
这次报这样的错误:
make[2]: Entering directory '/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0'
make[2]: *** No targets specified and no makefile found. Stop.
make[2]: Leaving directory '/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0'
Makefile:46: recipe for target '/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/sbin/mkfs.jffs2' failed
make[1]: *** [/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/sbin/mkfs.jffs2] Error 2
make[1]: Leaving directory '/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool'
Makefile:204: recipe for target 'hipctools' failed
make: *** [hipctools] Error 2
然后进入下面的目录:(很明显是编译改了名字为mtd-utils-1.5.0出现了问题,没办法,重新搞一次)
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0# ls
tar
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool# mv mtd-utils_1.5.2.orig.tar.bz2 mtd-utils-1.5.2.tar.bz2
修改Makefile:
10 export CHIP
11
12 ifndef CHIP
13 CHIP = hi3516cv200
14 endif
15
16 CC := gcc
17 BUILD_DIR := $(PREFIX)/tmp
18 ZLIB := $(shell pwd)/../zlib
19 ZLIB_INSTALL := $(PREFIX)/../zlib
20 ZLIB_DIR := $(ZLIB_INSTALL)/tmp
21 STRIP := strip
22 MTD_UTILS := mtd-utils-1.5.2
23 # this lib should be install to host
24 LZO := lzo-2.09
25
26 TARGETS := mkfs.jffs2
再次编译,出现了新的问题:
In file included from mkfs.ubifs/mkfs.ubifs.c:25:0:
mkfs.ubifs/mkfs.ubifs.h:46:23: fatal error: uuid/uuid.h: No such file or directory
compilation terminated.
common.mk:82: recipe for target '/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.2/mkfs.ubifs/mkfs.ubifs.o' failed
解决办法:sudo apt-get install uuid-dev
再次编译:
Creating filesystem with parameters:
Size: 33554432
Block size: 4096
Blocks per group: 32768
Inodes per group: 2048
Inode size: 256
Journal blocks: 1024
Label:
Blocks: 8192
Block groups: 1
Reserved block group size: 7
Created filesystem with 469/2048 inodes and 3957/8192 blocks
/itc_work/hi3518E_SDK_V1.0.3.0/osdrv
find /itc_work/hi3518E_SDK_V1.0.3.0/osdrv/pub/rootfs_uclibc/ -name '*svn' | xargs rm -rf
pushd /itc_work/hi3518E_SDK_V1.0.3.0/osdrv/pub;tar czf rootfs_uclibc.tgz rootfs_uclibc;rm rootfs_uclibc -rf;popd
/itc_work/hi3518E_SDK_V1.0.3.0/osdrv/pub /itc_work/hi3518E_SDK_V1.0.3.0/osdrv
/itc_work/hi3518E_SDK_V1.0.3.0/osdrv
---------finish osdrv work
root@ubuntu:/itc_work/hi3518E_SDK_V1.0.3.0/osdrv#
------------------------以上是我整个SDK的编译出现的问题----------------------------