老式的u-boot使用ATAGS的方式启动linux内核,本文使用新式的dtb方式启动内核。
我使用的内核是linux-3.17.2版本,下面开始编译内核。
(1) 解压内核
tar jxf linux-3.17.2.tar.bz2(2)配置linux内核,由于am335x在内核中都归为omap2系列,故可以使用如下命令:
make ARCH=arm omap2plus_defconfig
(3)编译内核:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8我的linux工具链前缀是arm-linux-gnueabi-,这个需要根据自己的实际的工具链情况进行替换。
(4)编译dtb:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- am335x-evm.dtb(5)制作启动盘:
将SD格式化为FAT系统,将MLO、u-boot.img拷贝到根目录下。
在根目录下创建boot目录,将编译好的zImage和am335x-evm.dtb拷贝到该目录下。
(6)u-boot命令行启动Linux内核
load mmc 0 0x88000000 /boot/tq335x.dtb load mmc 0 0x82000000 /boot/zImage bootz 0x82000000 - 0x88000000至此,Linux内核就能启动了,看到的Log信息如下:
U-Boot# load mmc 0 ${fdtaddr} /boot/tq335x.dtb
34720 bytes read in 9 ms (3.7 MiB/s)
U-Boot# load mmc 0 ${loadaddr} /boot/zImage
4385928 bytes read in 243 ms (17.2 MiB/s)
U-Boot# bootz ${loadaddr} - ${fdtaddr}
Kernel image @ 0x82000000 [ 0x000000 - 0x42ec88 ]
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Loading Device Tree to 8fff4000, end 8ffff79f ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 3.17.2 (lilianrong@AY140721164813287e77Z) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1) ) #1 SMP Mon Nov 10 20:46:04 CST 2014
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: TI AM335x EVM
[ 0.000000] cma: Reserved 16 MiB at 9e800000
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] HighMem zone: 1048574 pages exceeds freesize 0
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM335X ES2.1 (sgx neon )
[ 0.000000] PERCPU: Embedded 9 pages/cpu @dfa9a000 s14336 r8192 d14336 u36864
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 129792
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=ubi0:rootfs rw ubi.mtd=9,2048 rootfstype=ubifs rootwait=1
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Memory: 484792K/523264K available (5668K kernel code, 647K rwdata, 2208K rodata, 406K init, 8210K bss, 38472K reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xffe00000 (2048 kB)
[ 0.000000] vmalloc : 0xe0800000 - 0xff000000 ( 488 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0xc0008000 - 0xc07b9478 (7878 kB)
[ 0.000000] .init : 0xc07ba000 - 0xc081f800 ( 406 kB)
[ 0.000000] .data : 0xc0820000 - 0xc08c1d08 ( 648 kB)
[ 0.000000] .bss : 0xc08c1d08 - 0xc10c68e0 (8211 kB)
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[ 0.000000] Total of 128 interrupts on 1 active controller
[ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[ 0.000016] sched_clock: 32 bits at 24MHz, resolution 41n