老式的u-boot使用ATAGS的方式启动linux内核,本文使用新式的dtb方式启动内核。
我使用的内核是linux-3.17.2版本,下面开始编译内核。
(1) 解压内核
[php] view plaincopy
- tar jxf linux-3.17.2.tar.bz2
(2)配置linux内核,由于am335x在内核中都归为omap2系列,故可以使用如下命令:
[cpp] view plaincopy
- make ARCH=arm omap2plus_defconfig
(3)编译内核:
[cpp] view plaincopy
- make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8
我的linux工具链前缀是arm-linux-gnueabi-,这个需要根据自己的实际的工具链情况进行替换。
(4)编译dtb:
[cpp] view plaincopy
- 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内核
[cpp] view plaincopy
- load mmc 0 0x88000000 /boot/am335x-evm.dtb
- load mmc 0 0x82000000 /boot/zImage
- bootz 0x82000000 - 0x88000000
至此,Linux内核就能启动了,看到的Log信息如下:
[plain] view plaincopy
- 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 41ns, wraps every 178956969942ns
- [ 0.000065] OMAP clocksource: timer1 at 24000000 Hz
- [ 0.000805] Console: colour dummy device 80x30
- [ 0.000857] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
- [ 0.000865] ... MAX_LOCKDEP_SUBCLASSES: 8
- [ 0.000873] ... MAX_LOCK_DEPTH: 48
- [ 0.000880] ... MAX_LOCKDEP_KEYS: 8191
- [ 0.000888] ... CLASSHASH_SIZE: 4096
- [ 0.000895] ... MAX_LOCKDEP_ENTRIES: 32768
- [ 0.000902] ... MAX_LOCKDEP_CHAINS: 65536
- [ 0.000909] ... CHAINHASH_SIZE: 32768
- [ 0.000916] memory used by lock dependency info: 5167 kB
- [ 0.000924] per task-struct memory footprint: 1152 bytes
- [ 0.000966] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
- [ 0.079040] pid_max: default: 32768 minimum: 301
- [ 0.079436] Security Framework initialized
- [ 0.079561] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
- [ 0.079574] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
- [ 0.081771] CPU: Testing write buffer coherency: ok
- [ 0.082962] CPU0: thread -1, cpu 0, socket -1, mpidr 0
- [ 0.083083] Setting up static identity map for 0x8055f030 - 0x8055f0a0
- [ 0.086327] Brought up 1 CPUs
- [ 0.086346] SMP: Total of 1 processors activated.
- [ 0.086356] CPU: All CPU(s) started in SVC mode.
- [ 0.088958] devtmpfs: initialized
- [ 0.097809] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
- [ 0.134392] omap_hwmod: tptc0 using broken dt data from edma
- [ 0.134758] omap_hwmod: tptc1 using broken dt data from edma
- [ 0.135103] omap_hwmod: tptc2 using broken dt data from edma
- [ 0.143122] omap_hwmod: debugss: _wait_target_disable failed
- [ 0.201002] pinctrl core: initialized pinctrl subsystem
- [ 0.203537] regulator-dummy: no parameters
- [ 0.233163] NET: Registered protocol family 16
- [ 0.241735] DMA: preallocated 256 KiB pool for atomic coherent allocations
- [ 0.243918] cpuidle: using governor ladder
- [ 0.243946] cpuidle: using governor menu
- [ 0.255876] OMAP GPIO hardware version 0.1
- [ 0.271254] omap-gpmc 50000000.gpmc: could not find pctldev for node /pinmux@44e10800/nandflash_pins_s0, deferring probe
- [ 0.271303] platform 50000000.gpmc: Driver omap-gpmc requests probe deferral
- [ 0.275826] No ATAGs?
- [ 0.275857] hw-breakpoint: debug architecture 0x4 unsupported.
- [ 0.319359] edma-dma-engine edma-dma-engine.0: TI EDMA DMA engine driver
- [ 0.320718] vbat: 5000 mV
- [ 0.321481] lis3_reg: no parameters
- [ 0.324766] SCSI subsystem initialized
- [ 0.325577] usbcore: registered new interface driver usbfs
- [ 0.325755] usbcore: registered new interface driver hub
- [ 0.329802] usbcore: registered new device driver usb
- [ 0.330683] omap_i2c 44e0b000.i2c: could not find pctldev for node /pinmux@44e10800/pinmux_i2c0_pins, deferring probe
- [ 0.330726] platform 44e0b000.i2c: Driver omap_i2c requests probe deferral
- [ 0.330784] omap_i2c 4802a000.i2c: could not find pctldev for node /pinmux@44e10800/pinmux_i2c1_pins, deferring probe
- [ 0.330808] platform 4802a000.i2c: Driver omap_i2c requests probe deferral
- [ 0.335082] Switched to clocksource timer1
- [ 0.480572] NET: Registered protocol family 2
- [ 0.482404] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
- [ 0.482587] TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
- [ 0.483951] TCP: Hash tables configured (established 4096 bind 4096)
- [ 0.484145] TCP: reno registered
- [ 0.484169] UDP hash table entries: 256 (order: 2, 20480 bytes)
- [ 0.484359] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
- [ 0.485643] NET: Registered protocol family 1
- [ 0.487595] RPC: Registered named UNIX socket transport module.
- [ 0.487618] RPC: Registered udp transport module.
- [ 0.487628] RPC: Registered tcp transport module.
- [ 0.487637] RPC: Registered tcp NFSv4.1 backchannel transport module.
- [ 0.488910] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
- [ 0.493146] futex hash table entries: 256 (order: 2, 16384 bytes)
- [ 0.498771] VFS: Disk quotas dquot_6.5.2
- [ 0.498919] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
- [ 0.500956] NFS: Registering the id_resolver key type
- [ 0.501307] Key type id_resolver registered
- [ 0.501322] Key type id_legacy registered
- [ 0.501464] jffs2: version 2.2. (NAND) (SUMMARY) 漏 2001-2006 Red Hat, Inc.
- [ 0.501877] msgmni has been set to 978
- [ 0.507196] io scheduler noop registered
- [ 0.507232] io scheduler deadline registered
- [ 0.507301] io scheduler cfq registered (default)
- [ 0.509624] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
- [ 0.513086] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
- [ 0.519109] omap_uart 44e09000.serial: no wakeirq for uart0
- [ 0.519691] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 88, base_baud = 3000000) is a OMAP UART0
- [ 1.212068] console [ttyO0] enabled
- [ 1.221114] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
- [ 1.253833] brd: module loaded
- [ 1.273197] loop: module loaded
- [ 1.279721] mtdoops: mtd device (mtddev=name/number) must be supplied
- [ 1.289621] usbcore: registered new interface driver asix
- [ 1.295487] usbcore: registered new interface driver ax88179_178a
- [ 1.301980] usbcore: registered new interface driver cdc_ether
- [ 1.308269] usbcore: registered new interface driver smsc95xx
- [ 1.314388] usbcore: registered new interface driver net1080
- [ 1.320444] usbcore: registered new interface driver cdc_subset
- [ 1.326767] usbcore: registered new interface driver zaurus
- [ 1.332806] usbcore: registered new interface driver cdc_ncm
- [ 1.340919] usbcore: registered new interface driver cdc_wdm
- [ 1.347170] usbcore: registered new interface driver usb-storage
- [ 1.353622] usbcore: registered new interface driver usbtest
- [ 1.364045] mousedev: PS/2 mouse device common for all mice
- [ 1.374760] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc0
- [ 1.382981] i2c /dev entries driver
- [ 1.386769] Driver for 1-wire Dallas network protocol.
- [ 1.398911] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
- [ 1.408869] omap_hsmmc 48060000.mmc: unable to get vmmc regulator -517
- [ 1.416459] platform 48060000.mmc: Driver omap_hsmmc requests probe deferral
- [ 1.424503] ledtrig-cpu: registered to indicate activity on CPUs
- [ 1.431429] usbcore: registered new interface driver usbhid
- [ 1.437293] usbhid: USB HID core driver
- [ 1.442582] oprofile: using arm/armv7
- [ 1.447131] TCP: cubic registered
- [ 1.450611] Initializing XFRM netlink socket
- [ 1.455238] NET: Registered protocol family 17
- [ 1.459968] NET: Registered protocol family 15
- [ 1.465016] Key type dns_resolver registered
- [ 1.469680] omap_voltage_late_init: Voltage driver support not added
- [ 1.476366] sr_dev_init: No voltage domain specified for smartreflex0. Cannot initialize
- [ 1.484816] sr_dev_init: No voltage domain specified for smartreflex1. Cannot initialize
- [ 1.494347] ThumbEE CPU extension supported.
- [ 1.498923] Registering SWP/SWPB emulation handler
- [ 1.503942] SmartReflex Class3 initialized
- [ 1.517159] omap-gpmc 50000000.gpmc: GPMC revision 6.0
- [ 1.524094] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xd3
- [ 1.530939] nand: Samsung NAND 1GiB 3,3V 8-bit
- [ 1.535638] nand: 1024MiB, SLC, page size: 2048, OOB size: 64
- [ 1.541640] nand: error: CONFIG_MTD_NAND_OMAP_BCH not enabled
- [ 1.547760] omap2-nand: probe of omap2-nand.0 failed with error -22
- [ 1.663619] tps65910 0-002d: No interrupt support, no core IRQ
- [ 1.680749] vrtc: 1800 mV
- [ 1.684124] vrtc: supplied by vbat
- [ 1.691498] vio: at 1500 mV
- [ 1.694737] vio: supplied by vbat
- [ 1.701644] vdd_mpu: 912 <--> 1312 mV at 1325 mV
- [ 1.706882] vdd_mpu: supplied by vbat
- [ 1.713875] vdd_core: 912 <--> 1150 mV at 1137 mV
- [ 1.719187] vdd_core: supplied by vbat
- [ 1.725964] vdd3: 5000 mV
- [ 1.731302] vdig1: at 1800 mV
- [ 1.734706] vdig1: supplied by vbat
- [ 1.741264] vdig2: at 1800 mV
- [ 1.744671] vdig2: supplied by vbat
- [ 1.751054] vpll: at 1800 mV
- [ 1.754365] vpll: supplied by vbat
- [ 1.760730] vdac: at 1800 mV
- [ 1.764036] vdac: supplied by vbat
- [ 1.770317] vaux1: at 1800 mV
- [ 1.773717] vaux1: supplied by vbat
- [ 1.780114] vaux2: at 3300 mV
- [ 1.783514] vaux2: supplied by vbat
- [ 1.789893] vaux33: at 3300 mV
- [ 1.793397] vaux33: supplied by vbat
- [ 1.799920] vmmc: 1800 <--> 3300 mV at 3300 mV
- [ 1.804999] vmmc: supplied by vbat
- [ 1.810938] vbb: at 3000 mV
- [ 1.814411] vbb: supplied by vbat
- [ 1.819729] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
- [ 1.833220] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
- [ 1.877209] UBI error: ubi_init: cannot open mtd 9, error -19
- [ 1.944943] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
- [ 1.951329] davinci_mdio 4a101000.mdio: detected phy mask ffffffde
- [ 1.961340] libphy: 4a101000.mdio: probed
- [ 1.965645] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver unknown
- [ 1.974006] davinci_mdio 4a101000.mdio: phy[5]: device 4a101000.mdio:05, driver unknown
- [ 1.983572] cpsw 4a100000.ethernet: Detected MACID = c4:ed:ba:88:b5:e4
- [ 1.994560] input: volume_keys@0 as /devices/volume_keys@0/input/input0
- [ 2.005474] omap_rtc 44e3e000.rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
- [ 2.014497] sr_init: No PMIC hook to init smartreflex
- [ 2.020120] sr_init: platform driver register failed for SR
- [ 2.043081] lis3_reg: disabling
- [ 2.049937] UBIFS error (pid 1): ubifs_mount: cannot open "ubi0:rootfs", error -19
- [ 2.058011] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0): error -19
- [ 2.066393] Please append a correct "root=" boot option; here are the available partitions:
- [ 2.075257] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
- [ 2.083990] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
(7)小结
从启动Log上很容易看出,现在内核无法挂在根文件系统,在下一篇文章中,我会制作根文件系统。