Build platform under Ubuntu(一)

在Ubuntu下编译linux2.6内核for OMAP5912。
结果:
1. Kernel image编译成功,both 2.6.8-rc3 & 2.6.20;
2. Download到板子上都在Uncompress kernel image之后就没反应了;
3. u-boot1.1.6编译成功,down到板子上也可以使用;
TODO:
尝试通过换平台,换搭配来找到可以正常编译的方法。
Echo确认fc6+2.6.20是可以的。

1. 串口支持
NB上不带串口,使用USB2Serial线,发现可以自动识别为/dev/ttyUSB0。用dmesg查看信息:
[ 3436.024000] usb 2-2: new full speed USB device using uhci_hcd and address 5
[ 3436.188000] usb 2-2: configuration #1 chosen from 1 choice
[ 3436.192000] cp2101 2-2:1.0: cp2101 converter detected
[ 3436.304000] usb 2-2: reset full speed USB device using uhci_hcd and address 5
[ 3436.452000] usb 2-2: cp2101 converter now attached to ttyUSB0
可以知道,我的这根USB转串口线的芯片是cp2101。

2. 串口终端程序minicom配置
>Ubuntu默认没有minicom,需要安装一个先,我安装的是v2.2;
>设置参数:
>> Select ‘Modem and Dialing’ and ensure that ‘Init string’ (A) is clear.
>> Use /dev/ttyUSB0 at 115,200 baud, 8Bps, no parity, 1 stop bit, and no flow control.

3. 重新烧写uboot if needs
如果原来板子上的uboot被破坏,需要重新烧写uboot。具体的烧写方法,请参考《MDK5912 User Guide 3.3.2》 by Peter HE。
注意:
我在仿照文档上的step时候,一旦执行到“Download binary image(osk5912boot.bin ) to address 0x11fc0000”,AXD就会报错:“... re-enter debug ...”。
后来我直接
step 1. run romprog.axf;
step 2. Download binary image(osk5912boot.bin ) to address 0x11fc0000;
step 3. ... ...
这样走下来后,再把AXD暂停,看起来好像系统跑飞了一样。但是如果reboot board,居然烧成功了-_-!

4. 安装tftp支持
Ubuntu默认没有安装tftp以及tftp必须的inetd/xinetd/inetd-hpa支持,需要自己安装。
我基本按照参考文档1安装步骤来,却没那么好运,尽是问题-_-!
1. 安装tftp&tftpd;
2. 装netkit-inetd时候提示:需要卸载tftpd&另外一个tftpd需要的package;
3. ps -e|grep inet发现系统根本没跑inetd,倒是xinetd已经有了;
3. 仿照其它文档配置/etc/xinetd.conf(osk newbie guider中也是用它,不过配置文件位置不一样)之后,测试get file,不能通过;
4. 反复装了几次tftpd&inetd后,发现居然某次没要求必须卸载对方了-_-!;
5. 但是inetd reload还是不能启动起来;
6. 第二天早上开机,ps -e发现inetd/xinetd都在run了;
7. 参考文档上都说测试的时候连10.0.0.1,我实际试的时候tftp 127.0.0.1才OK(想想也是阿),真不知道是我和别人都不一样还是很多人都没自己试过?
8. 测试通过,看来还是inetd起的作用。昨天关键是不知道为何,inetd一直没run起来,rp阿rp。
参考文档:
--------------------------------------------------
1. Ubuntu配置tftp服务
http://my.opera.com/volans/blog/show.dml/680197
2. 开发板实务(2)——配置宿主机服务: NFS, tftp
http://www.cublog.cn/u/13991/showart_108131.html
3. kubutu tftp配置
http://www.akae.cn/space/html/24/t-1324.html
4. Ubuntu Linux发行版新手应用指南[二]
http://www.enet.com.cn/article/2007/0509/A20070509577608_6.shtml
--------------------------------------------------

5. 配置网络连接

1. 设置mac地址:
    OMAP #setenv ethaddr 00:0E:99:02:07:1C
2. 设置ip等:
    OMAP # setenv ipaddr 138.198.177.250
    OMAP # setenv serverip 138.198.177.80
    OMAP # setenv netmask 255.255.252.0
    OMAP # setenv gatewayip 138.198.179.254
Note:
直接执行dhcp来代替上面步骤,如果你的host pc支持的话。
3. 保存参数
    OMAP # saveenv

6. 烧写kernel image
1. Send your ‘uImage.cc’ file to the ‘/tftpboot/’ directory on PC;
2. 下载kernel iamge到板子上:
    OMAP # tftpboot 0x10000000 uImage.cc
    得到结果,记录kernel image size为Bytes transferred = 1229199 (12c18f hex);
3. Then we erase the old kernel and put the new one on:
    OMAP # erase 1:8-15
    OMAP # cp.b 0x10000000 0x100000 12c18f (note: 12c18f is what you get above)
TIP: If you receive an error like this:
--------------------------------------------------
       Copy to Flash...not erased at xxxxxxxx (xxxx)
       Flash not Erased
--------------------------------------------------
You will need to erase more than the 8-15 range (我这里需要erase到17).
4. Finally, we set some boot parameters for the kernel:
    OMAP # setenv bootargs console=ttyUSB0,115200n8 noinitrd ip=138.198.177.250:138.198.177.80:138.198.179.254:255.255.252.0:osk:eth0:off root=/dev/nfs rw nfsroot=138.198.177.80:/data/rootfs2.6,nolock mem=32M
    OMAP # saveenv
5. You are now ready to start the kernel:
    OMAP # bootm 0x100000
Bug Report:
此时走到“Uncompressing Linux...... done, booting the kernel.”就停住了。根据OSK newbie guider的说法,这是factory u-boot的bug,可以通过
> 升级u-boot;
>修改linux kernel file
中的一种方法解决。
6. 选择5中的第二种方法解决,需要重新build kernel image。这次build kernel时候,与第一次不同的是:
> 修改osk newbie guider文档中提到的源码内容;
重新生成的kernel image保存为doc/OMAP/**.20070608,uboot中生成的工具mkimage也保留了下来。
    --------------------------------------------------
    TIPS:
    mkimage参数中,-a和-e参数的关系:
    http://www.linuxforum.net/forum/printthread.php?Cat=&Board=embedded&main=555581&type=thread

    mkimage ... -a 0xa0008000 -e 0xa0008040 ...
    刚才大致看了一下,如果你用压缩的方式,应该 -a -e是一样的。
    -a 指定的地址,是解压之后存放的地址,也应该是执行的地址。
    而对于非压缩的方式来说,就需要+0x40了。
    --------------------------------------------------
7. 最后生成的image还是在booting the kernel时候停下来没有相应了。打算重新编译一个新版本的u-boot试试看。

7. 编译安装新的u-boot
用arm-linux-3.3.4编译u-boot-1.1.6成功pass,生成的u-boot保存为doc/OMAP/u-boot.bin.20070608。
1. 下载arm-linux-gcc-3.3.4
http://www.handhelds.org/download/projects/toolchain/
2. 解压到/usr/local/arm/3.3.4下,更改$PATH,编译uboot——步骤参考osk newbie guider即可;
3. 在当前u-boot目录下生成u-boot.bin;
4. 按照osk newbie guider步骤重新烧写u-boot,重启后看到u-boot版本信息为1.1.6;
Note:启动时候提示“*** Warning - bad CRC, using default environment”
    参考《U-Boot for the OMAP16xx GSM/GPRS Software Development Platform》的解释:
    --------------------------------------------------
    This is harmless and will go away as soon as you have initialized and saved the environment
    variables. This indicates that the environment variables are not stored in flash. After the
    environment variables are saved using saveenv command, this warning will disappear.
    --------------------------------------------------
5. 重新boot Linux,还是老样子!

8. 用omap官方提供的uboot image: osk-u-boot_8_11_05_RevD.bin替换自己生成的u-boot,无效。

9. 重新做一个非压缩的uImage,重新尝试,无效:
    # arm-linux-objcopy -O binary -R .note -R .comment -S arch/arm/boot/compressed/vmlinux linux.bin
    # mkimage -A arm -O linux -T kernel -C none -a 0x10c08000 -e 0x10c08000 -n 'Linux Kernel Image' -d linux.bin uImage.cc

10. 直接从ram中boot,无效:
    OMAP5912 OSK # tftp 0x10000000 uImage.cc
    OMAP5912 OSK # bootm 0x10000000

11. 编译2.6.8-rc3:
按照《omap5912osk_2.6》来编译linux 2.6.8-rc3,希望能pass。
1. Download source from OMAP官方网站;
2. 注意这次是用arm-gcc-3.3.4编译的;
3. make omap5912osk_deconfig时候报错:
    --------------------------------------------------
    scripts/kconfig/mconf.c:91: error: static declaration of 'current_menu'
    non-static declaration
    scripts/kconfig/lkc.h:63: error: previous declaration of 'current_menu'
    make[1]: *** [scripts/kconfig/mconf.o] Error 1
    --------------------------------------------------
    据说是2.6.8(or lower version)和Ubuntu的gcc-4.*的冲突造成。一个简单的办法就是把出错地方的static声明去掉。
4. 结果还是无效!
5. 编译的uImage.cc保存为uImage.cc.20070608_2。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值