ubuntu下使用qemu模拟ARM(七)-----uboot从sd卡启动内核

ARM 349浏览

编译uboot

编译内核

mkimage制作文件

mkimage -n 'linux-2.6.14' -A arm -O linux -T kernel -C none -a 0x60008000 -e 0x60008000 -d zImage zImage.img

制作ext2格式的sd卡

dd if=/dev/zero of=a9rootfs.ext2 bs=1M count=32
mkfs.ext2 a9rootfs.ext2
sudo mkdir tmpfs
sudo mount -t ext2 a9rootfs.ext2 tmpfs/ -o loop
sudo cp zImage.img //将用mkimage制作好的内核文件拷到此处
sudo umount tmpfs

启动qemu,

qemu-system-arm -M vexpress-a9 -m 256M -nographic -kernel u-boot -sd a9rootfs.ext2

在qemu环境下:

=> ext2load mmc 0 60008000 zImage.img
1965048 bytes read in 1225 ms (1.5 MiB/s)

=> bootm 60008000

## Booting kernel from Legacy Image at 60008000 ...
   Image Name:   linux-2.6.14
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1964984 Bytes = 1.9 MiB
   Load Address: 60008000
   Entry Point:  60008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Linux version 3.16.39 (book@book-virtual-machine) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #1 SMP Thu Feb 16 12:11:06 CST 2017
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: ARM-Versatile Express
Memory policy: Data cache writeback
CPU: All CPU(s) started in SVC mode.
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
PERCPU: Embedded 7 pages/cpu @8fdef000 s6464 r8192 d14016 u32768
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: console=ttyAMA0
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 255976K/262144K available (2679K kernel code, 126K rwdata, 740K rodata, 186K init, 108K bss, 6168K reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
    vmalloc : 0x90800000 - 0xff000000   (1768 MB)
    lowmem  : 0x80000000 - 0x90000000   ( 256 MB)
    modules : 0x7f000000 - 0x80000000   (  16 MB)
      .text : 0x80008000 - 0x8035f204   (3421 kB)
      .init : 0x80360000 - 0x8038e940   ( 187 kB)
      .data : 0x80390000 - 0x803afbe0   ( 127 kB)
       .bss : 0x803afbe8 - 0x803cae60   ( 109 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
        RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
NR_IRQS:16 nr_irqs:16 16
GIC CPU mask not found - kernel will fail to boot.
GIC CPU mask not found - kernel will fail to boot.
smp_twd: clock not found -2
L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 dynamic clock gating disabled, standby mode disabled
L2C-310 cache controller enabled, 8 ways, 128 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
Console: colour dummy device 80x30
Calibrating local timer... 100.13MHz.
Calibrating delay loop... 264.19 BogoMIPS (lpj=1320960)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
missing device node for CPU 0
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x6028cea8 - 0x6028cf00
Brought up 1 CPUs
SMP: Total of 1 processors activated (264.19 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
hw-breakpoint: debug architecture 0x4 unsupported.
Serial: AMBA PL011 UART driver
mb:uart0: ttyAMA0 at MMIO 0x10009000 (irq = 37, base_baud = 0) is a PL011 rev1
console [ttyAMA0] enabled
mb:uart1: ttyAMA1 at MMIO 0x1000a000 (irq = 38, base_baud = 0) is a PL011 rev1
mb:uart2: ttyAMA2 at MMIO 0x1000b000 (irq = 39, base_baud = 0) is a PL011 rev1
mb:uart3: ttyAMA3 at MMIO 0x1000c000 (irq = 40, base_baud = 0) is a PL011 rev1
SCSI subsystem initialized
Switched to clocksource v2m-timer1
CPU PMU: probing PMU on CPU 0
hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 1 counters available
futex hash table entries: 256 (order: 2, 16384 bytes)
squashfs: version 4.0 (2009/01/31) Phillip Lougher
msgmni has been set to 499
io scheduler noop registered (default)
clcd-pl11x ct:clcd: PL111 rev2 at 0x10020000
clcd-pl11x ct:clcd: CT-CA9X4 hardware, XVGA display
Console: switching to colour frame buffer device 128x48
mousedev: PS/2 mouse device common for all mice
rtc-pl031 mb:rtc: rtc core: registered pl031 as rtc0
oprofile: using arm/armv7-ca9
rtc-pl031 mb:rtc: setting system clock to 2017-02-16 04:24:07 UTC (1487219047)
input: AT Raw Set 2 keyboard as /devices/mb:kmi0/serio0/input/input0
input: ImExPS/2 Generic Explorer Mouse as /devices/mb:kmi1/serio1/input/input2
VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.16.39 #1
[<8001474c>] (unwind_backtrace) from [<80011624>] (show_stack+0x10/0x14)
[<80011624>] (show_stack) from [<80288828>] (dump_stack+0x94/0xa8)
[<80288828>] (dump_stack) from [<80285abc>] (panic+0xa0/0x200)
[<80285abc>] (panic) from [<80361188>] (mount_block_root+0x24c/0x2cc)
[<80361188>] (mount_block_root) from [<803613c4>] (prepare_namespace+0x158/0x1a0)
[<803613c4>] (prepare_namespace) from [<80360e20>] (kernel_init_freeable+0x264/0x274)
[<80360e20>] (kernel_init_freeable) from [<80284758>] (kernel_init+0x8/0xf0)
[<80284758>] (kernel_init) from [<8000e3c0>] (ret_from_fork+0x14/0x34)

---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

内核已启动,只是没有根文件系统