老式的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/am335x-evm.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 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上很容易看出,现在内核无法挂在根文件系统,在下一篇文章中,我会制作根文件系统。