3.[Linux Driver Misc]-(Jz2440完全移植从零开始)

uboot

1.工程:u-boot-2012.04.01.tar.bz2
2.Patch:u-boot-2012.04.01_100ask.patch
3.编译环境:gcc-3.4.5-glibc-2.3.6
解压打patch
1. tar -xjf u-boot-2012.04.01.tar.bz2
2. cd u-boot-2012.04.01/
3. patch -p << ../u-boot-2012.04.01_100ask.patch

编译:
4.make CROSS_COMPILE=/usr/local/arm-linux-gcc/gcc-3.4.5-glibc-2.3.6/bin/arm-linux- smdk2440_config
5.make CROSS_COMPILE=/usr/local/arm-linux-gcc/gcc-3.4.5-glibc-2.3.6/bin/arm-linux- -j8
6.生成uboot.bin

下载:
7.用nor flash启动uboot进入到uboot选项,并输入N,下载新uboot到nand flash,如下:
##### 100ask Bootloader for OpenJTAG #####
[n] Download u-boot to Nand Flash
[o] Download u-boot to Nor Flash
[k] Download Linux kernel uImage
[j] Download root_jffs2 image
[y] Download root_yaffs image
[d] Download to SDRAM & Run
[z] Download zImage into RAM
[g] Boot linux from RAM
[f] Format the Nand Flash
[s] Set the boot parameters
[b] Boot the system
[r] Reboot u-boot
[q] Quit from menu
Enter your selection: n
USB host is connected. Waiting a download

8.通过dnw2来传输文件:
  8.1 获取:git clone https://github.com/silentcedar/dnw2.git 
  8.2 根据README.md,来操作,生成dnw2
  8.3 把dnw2放到环境变量包含的位置,并到uboot.bin目录:sudo mv dnw2 /usr/sbin 
  8.4 传输uboot.bin: sudo dnw2 uboot.bin
 
9. 可以看到uboot.bin被写入到nand flash了
   Now, Downloading [ADDRESS:30000000h,TOTAL:224090]
    RECEIVED FILE SIZE:  224090 (218KB/S, 1S)

到这里uboot就搞完了

kernel-3.4.2

1.工程:linux-3.4.2.tar.bz2
2.Patch:linux-3.4.2_100ask.patch
3.编译环境:gcc-4.3.2
解压打patch
1. tar -xjf linux-3.4.2.tar.bz2
2. cd linux-3.4.2/
3. patch -p << ../linux-3.4.2_100ask.patch

编译:
5.cp config_ok     .config
6.make  (arm-linux-gcc4.3.27.生成:arch/arm/boot/uImage

烧写:uImage
8.切换到nor flash启动,进入命令选择,并选择K进入kernel下载项:
##### 100ask Bootloader for OpenJTAG #####
[n] Download u-boot to Nand Flash
[o] Download u-boot to Nor Flash
[k] Download Linux kernel uImage
[j] Download root_jffs2 image
[y] Download root_yaffs image
[d] Download to SDRAM & Run
[z] Download zImage into RAM
[g] Boot linux from RAM
[f] Format the Nand Flash
[s] Set the boot parameters
[b] Boot the system
[r] Reboot u-boot
[q] Quit from menu
Enter your selection: k
USB host is connected. Waiting a download.

9.使用dnw2传输文件:sudo dnw2 arch/arm/boot/uImage
          Now, Downloading [ADDRESS:30000000h,TOTAL:2085154]
          RECEIVED FILE SIZE: 2085154 (678KB/S, 3S)
 
          NAND erase: device 0 offset 0x60000, size 0x200000
          Erasing at 0x240000 -- 100% complete.
          OK

          NAND write: device 0 offset 0x60000, size 0x1fd118

          Writing data at 0x25d000 -- 100% complete.
          2085144 bytes written: OK
          可以看到已经下载完成:

10.拨到nand flash启动,出现异常:Starting kernel ...
                               Uncompressing Linux... done, booting the kernel.
出现上诉之后,乱码。

问题排除:
1.print 查看uboot启动参数
baudrate=115200
bootargs=noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0
bootcmd=nand read.jffs2 0x30007FC0 kernel; bootm 0x30007FC0
bootdelay=2
ethact=dm9000
ethaddr=08:00:3e:26:0a:5b
ipaddr=192.168.7.17
mtddevname=u-boot
mtddevnum=0
mtdids=nand0=jz2440-0
mtdparts=mtdparts=jz2440-0:256k(u-boot),128k(params),2m(kernel),-(rootfs)
netmask=255.255.255.0
partition=nand0,0
serverip=192.168.7.11
stderr=serial
stdin=serial
stdout=serial

2.启动参数的波特率波特率不对,所以才乱码:
  2.1在uboot启动的时候,按下空格键进入命令设置模式
  2.2 输入命令:set bootargs 'noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200'
  2.3保存启动参数:save
  2.4按下复位键,重新启动,出现如下Oops:
        Kernel panic - not syncing: No init found.  Try passing init=      option to kernel. .
Backtrace: 
[<c000c2f8>] (dump_backtrace+0x0/0x10c) from [<c02f0f88>] (dump_stack+0x18/0x1c)
 r7:c0408000 r6:00000008 r5:c0408000 r4:c03eaf28
[<c02f0f70>] (dump_stack+0x0/0x1c) from [<c02f1008>] (panic+0x7c/0x1d0)
[<c02f0f8c>] (panic+0x0/0x1d0) from [<c00087a0>] (init_post+0xc8/0x140)
 r3:0000000b r2:00000008 r1:00000007 r0:c0368130
[<c00086d8>] (init_post+0x0/0x140) from [<c03c13f8>] (kernel_init+0x174/0x1c4)
 r5:c03db044 r4:c03dfd6c
[<c03c1284>] (kernel_init+0x0/0x1c4) from [<c001a3b8>] (do_exit+0x0/0x76c)

===未完待续===

猜你喜欢

转载自blog.csdn.net/qq_16919359/article/details/90321992
今日推荐