builldroot uclibc linux 2.6.22.6 交叉编译环境搭建

时间:2022-02-18 05:10:50


0. 解压缩buildroot-2015.11.tar.gz

   make qemu_arm_versatile_defconfig

  make menuconfig

  make


make过程中不少错误如下:


1.找不到linux_2.6.20.4.tar.xz
  取巧的方法:去http://sources.buildroot.net下载linux_2.6.20.4.tar.bz2
        解压缩以后,再用tar -cf linux_2.6.20.4.tar linux_2.6.20.4/
                       再用xz -z linux_2.6.20.4.tar 生成linux_2.6.20.4.tar.xz
      如果没有xz,系统会提醒sudo apt-get xz工具的


     将linux_2.6.20.4.tar.xz放到./dl目录下




     ./dl目录是在  buildroot make menuconfig  make以后,从网上下载文件开始才会创建


而linux_2.6.20.4的编译要等很晚才会发生,所以不用急,等编译一段时间以后,就可以cp linux_2.6.20.4.tar.xz到./dl目录下了


2.  scripts/unifde.c:209:error:conflicting types for 'getline', /usr/include/stdio.h:651:note:previous declaration of 'getline' was here


原因是与其他地方冲突了,所以找到kernel里的scrpits/unifdef.c的getline,总共也就3个
修改成getline_1,只要名字与getline不冲突就行了。




3.


/ffp/include/linux/socket.h:179:0: warning: "AF_ATMSVC" redefined [enabled by default]
./include/bits/socket.h:110:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:180:0: warning: "AF_SNA" redefined [enabled by default]
./include/bits/socket.h:112:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:181:0: warning: "AF_IRDA" redefined [enabled by default]
./include/bits/socket.h:113:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:182:0: warning: "AF_PPPOX" redefined [enabled by default]
./include/bits/socket.h:114:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:183:0: warning: "AF_WANPIPE" redefined [enabled by default]
./include/bits/socket.h:115:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:184:0: warning: "AF_LLC" redefined [enabled by default]
./include/bits/socket.h:116:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:185:0: warning: "AF_TIPC" redefined [enabled by default]
./include/bits/socket.h:118:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:186:0: warning: "AF_BLUETOOTH" redefined [enabled by default]
./include/bits/socket.h:119:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:187:0: warning: "AF_IUCV" redefined [enabled by default]
./include/bits/socket.h:120:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:188:0: warning: "AF_RXRPC" redefined [enabled by default]
./include/bits/socket.h:121:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:189:0: warning: "AF_MAX" redefined [enabled by default]
./include/bits/socket.h:128:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:192:0: warning: "PF_UNSPEC" redefined [enabled by default]
./include/bits/socket.h:43:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:193:0: warning: "PF_UNIX" redefined [enabled by default]
./include/bits/socket.h:45:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:194:0: warning: "PF_LOCAL" redefined [enabled by default]
./include/bits/socket.h:44:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:195:0: warning: "PF_INET" redefined [enabled by default]
./include/bits/socket.h:47:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:196:0: warning: "PF_AX25" redefined [enabled by default]
./include/bits/socket.h:48:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:197:0: warning: "PF_IPX" redefined [enabled by default]
./include/bits/socket.h:49:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:198:0: warning: "PF_APPLETALK" redefined [enabled by default]
./include/bits/socket.h:50:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:199:0: warning: "PF_NETROM" redefined [enabled by default]
./include/bits/socket.h:51:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:200:0: warning: "PF_BRIDGE" redefined [enabled by default]
./include/bits/socket.h:52:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:201:0: warning: "PF_ATMPVC" redefined [enabled by default]
./include/bits/socket.h:53:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:202:0: warning: "PF_X25" redefined [enabled by default]
./include/bits/socket.h:54:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:203:0: warning: "PF_INET6" redefined [enabled by default]
./include/bits/socket.h:55:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:204:0: warning: "PF_ROSE" redefined [enabled by default]
./include/bits/socket.h:56:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:205:0: warning: "PF_DECnet" redefined [enabled by default]
./include/bits/socket.h:57:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:206:0: warning: "PF_NETBEUI" redefined [enabled by default]
./include/bits/socket.h:58:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:207:0: warning: "PF_SECURITY" redefined [enabled by default]
./include/bits/socket.h:59:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:208:0: warning: "PF_KEY" redefined [enabled by default]
./include/bits/socket.h:60:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:209:0: warning: "PF_NETLINK" redefined [enabled by default]
./include/bits/socket.h:61:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:210:0: warning: "PF_ROUTE" redefined [enabled by default]
./include/bits/socket.h:62:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:211:0: warning: "PF_PACKET" redefined [enabled by default]
./include/bits/socket.h:63:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:212:0: warning: "PF_ASH" redefined [enabled by default]
./include/bits/socket.h:64:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:213:0: warning: "PF_ECONET" redefined [enabled by default]
./include/bits/socket.h:65:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:214:0: warning: "PF_ATMSVC" redefined [enabled by default]
./include/bits/socket.h:66:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:215:0: warning: "PF_SNA" redefined [enabled by default]
./include/bits/socket.h:68:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:216:0: warning: "PF_IRDA" redefined [enabled by default]
./include/bits/socket.h:69:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:217:0: warning: "PF_PPPOX" redefined [enabled by default]
./include/bits/socket.h:70:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:218:0: warning: "PF_WANPIPE" redefined [enabled by default]
./include/bits/socket.h:71:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:219:0: warning: "PF_LLC" redefined [enabled by default]
./include/bits/socket.h:72:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:220:0: warning: "PF_TIPC" redefined [enabled by default]
./include/bits/socket.h:74:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:221:0: warning: "PF_BLUETOOTH" redefined [enabled by default]
./include/bits/socket.h:75:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:222:0: warning: "PF_IUCV" redefined [enabled by default]
./include/bits/socket.h:76:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:223:0: warning: "PF_RXRPC" redefined [enabled by default]
./include/bits/socket.h:77:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:224:0: warning: "PF_MAX" redefined [enabled by default]
./include/bits/socket.h:84:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:233:0: warning: "MSG_OOB" redefined [enabled by default]
./include/bits/socket.h:178:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:234:0: warning: "MSG_PEEK" redefined [enabled by default]
./include/bits/socket.h:180:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:235:0: warning: "MSG_DONTROUTE" redefined [enabled by default]
./include/bits/socket.h:182:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:236:0: warning: "MSG_TRYHARD" redefined [enabled by default]
./include/bits/socket.h:186:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:237:0: warning: "MSG_CTRUNC" redefined [enabled by default]
./include/bits/socket.h:189:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:239:0: warning: "MSG_TRUNC" redefined [enabled by default]
./include/bits/socket.h:193:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:240:0: warning: "MSG_DONTWAIT" redefined [enabled by default]
./include/bits/socket.h:195:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:241:0: warning: "MSG_EOR" redefined [enabled by default]
./include/bits/socket.h:197:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:242:0: warning: "MSG_WAITALL" redefined [enabled by default]
./include/bits/socket.h:199:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:243:0: warning: "MSG_FIN" redefined [enabled by default]
./include/bits/socket.h:201:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:244:0: warning: "MSG_SYN" redefined [enabled by default]
./include/bits/socket.h:203:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:245:0: warning: "MSG_CONFIRM" redefined [enabled by default]
./include/bits/socket.h:205:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:246:0: warning: "MSG_RST" redefined [enabled by default]
./include/bits/socket.h:207:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:247:0: warning: "MSG_ERRQUEUE" redefined [enabled by default]
./include/bits/socket.h:209:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:248:0: warning: "MSG_NOSIGNAL" redefined [enabled by default]
./include/bits/socket.h:211:0: note: this is the location of the previous definition
/ffp/include/linux/socket.h:249:0: warning: "MSG_MORE" redefined [enabled by default]
./include/bits/socket.h:213:0: note: this is the location of the previous definition
make: *** [libc/inet/if_index.os] Error 1


这个问题也很奇怪,因为buildroot编译了半天才出现的


修改方法为


跑到我们从网上下载的kernel代码。


I reproduce this error with kernel older than 2.6.32
This fixed before "make headers_install" by change in kernel/include/linux/socket.h
#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
to 
#if defined(__KERNEL__)


这样就好了,但是问题来了,网友写的是,before make header_install
而这时候已经编译过了啊,所以又得重来。[这个网友方法的网址为  https://bugs.busybox.net/show_bug.cgi?id=6278]


修改好的linux kernel内核还得按照第一步的错误的解决办法来重新生成tar.xz文件,然后再放到
buildroot/dl目录下面,全部重来一遍吧,唉。


4.  make busybox 
    miscutils/i2c 报错


   去掉i2c相关的4个功能项








-----相关    
www.cnblogs.com/lovechen/p/5720506.html


.tar.gz     格式解压为          tar   -zxvf   xx.tar.gz


.tar.bz2   格式解压为          tar   -jxvf    xx.tar.bz


创建 xz 格式文件
方法一:
也是用到两步命令,首先利用 tar 命令将 linux-3.12 文件夹打包成 linux-3.12.tar,其次用 xz-utils 的 xz 命令将 linux-3.12.tar 压缩成 linux-3.12.tar.xz。


tar -cf linux-3.12.tar linux-3.12/
xz -z linux-3.12.tar




---编译内核时,报错   gdwarf is ambiguos   在makefile文件里找到gdwarf,修改为gdwarf-2


AFLAGS             += gdwarf-2
重新编译OK