TQ2440 + uboot1.1.6
1. uboot修改
1.1 common/main.c
-
在函数 main_loop大约513行:
-
char cmd_buf[200];
-
printf("Booting Linux ...\n");
-
//boot_zImage(0x200000,0x200000); //注释boot_zImage
-
strcpy(cmd_buf, "tftp 0x30008000 zImage; boot_zImage"); //tftp内核到内存的0x30008000,然后启动zImage;
-
run_command(cmd_buf, 0); //这儿只不过是由以前的从nandflash取数据改变为从nand flash取数据
1.2 lib_arm/boot_zImage.c
-
151 int boot_zImage(ulong from, size_t size)
-
152 {
-
162 /*printk("Copy linux kernel from 0x%08lx to 0x%08lx, size = 0x%08lx ... ", from, to, size); //注掉从nand_flash中拷kernel部分,当然这儿也可以自己添加新的命令
-
163 ret = copy_kernel_img(to, (char *)from, size);
-
164 if (ret) {
-
165 printk("failed\n");
-
166 return -1;
-
167 } else {
-
168 printk("Copy Kernel to SDRAM done,");
-
169 }*/
-
177 }
重新编译后,将uboot烧到nand flash中
2. ubuntu中tftp的安装
a. root@ubuntu:~# apt-get install tftpd tftp openbsd-inetd ;安装
-
b. root@ubuntu:~# vi im /etc/inetd.conf ;配置tftp文件路径
-
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tmp
-
c. root@ubuntu:~# chmod 777 /tmp
-
d. root@ubuntu:~# /etc/init.d/openbsd-inetd restart ;重启服务,使配置生效
-
root@ubuntu:~# netstat -an | grep 69 ;查看69端口是否打开
-
root@ubuntu:~# tftp 192.168.1.2 ;tftp 本机ip测试一下
-
tftp> get test.txt
-
注意: /root不可以作为tftp根目录,设置tftproot为:/tmp
3. 修改内核Makefile
-
arch/arm/boot/Makefile中
-
56 $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
-
57 $(call if_changed,objcopy)
-
58 cp -arf arch/arm/boot/zImage /tmp/zImage
-
59 @echo ' Kernel: $@ is ready
将新生成的zImage拷贝到 /tmp中
阅读(1390) | 评论(0) | 转发(0) |