make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- vexpress_ca9x4_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j8
cross_compile=arm-linux-gnueabihf-
make CROSS_COMPILE=$cross_compile ARCH=arm vexpress_defconfig
make CROSS_COMPILE=$cross_compile ARCH=arm menuconfig
make CROSS_COMPILE=$cross_compile ARCH=arm zImage -j4
make CROSS_COMPILE=$cross_compile ARCH=arm dtbs
dd if=/dev/zero of=uboot.disk bs=1M count=1024
sgdisk -n 0:0:+10M -c 0:kernel uboot.disk
sgdisk -n 0:0:0 -c 0:rootfs uboot.disk
$ sgdisk -p uboot.disk
Disk uboot.disk: 2097152 sectors, 1024.0 MiB
Sector size (logical): 512 bytes
Disk identifier (GUID): 04963A5B-34CF-4DEE-B610-F40257C45F6D
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 2097118
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 22527 10.0 MiB 8300 kernel
2 22528 2097118 1013.0 MiB 8300 rootfs
$ losetup -f
/dev/loop16
sudo losetup /dev/loop16 uboot.disk
sudo partprobe /dev/loop16
sudo mkfs.ext4 /dev/loop16p1
sudo mkfs.ext4 /dev/loop16p2
sudo mount -t ext4 /dev/loop16p1 p1/
sudo mount -t ext4 /dev/loop16p2 p2/
sudo cp linux-4.14.13/arch/arm/boot/zImage p1/
sudo cp linux-4.14.13/arch/arm/boot/dts/vexpress-v2*.dtb p1/
sudo cp -raf ../rootfs/rootfs/* ./p2
sudo umount p1 p2
sudo losetup -d /dev/loop16
uboot_image=./u-boot-2019.10/u-boot
qemu_path=/home/pengdl/work/Qemu/qemu-4.1.0/build/arm-softmmu
${qemu_path}/qemu-system-arm -M vexpress-a9 -m 1024M -smp 1 -nographic -kernel ${uboot_image} -sd ./uboot.disk
U-Boot 2019.10-g61a73d0f-dirty (Jan 13 2020 - 23:59:20 +0800)
DRAM: 1 GiB
WARNING: Caches not enabled
Flash: 128 MiB
MMC: MMC: 0
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: smc911x-0
Hit any key to stop autoboot: 0
=> mmc dev 0
switch to partitions #0, OK
mmc0 is current device
=> mmc info
Device: MMC
Manufacturer ID: aa
OEM: 5859
Name: QEMU!
Bus Speed: 6250000
Mode: SD Legacy
Rd Block Len: 512
SD version 2.0
High Capacity: No
Capacity: 1 GiB
Bus Width: 1-bit
Erase Group Size: 512 Bytes
=> part list mmc 0
Partition Map for MMC device 0 -- Partition Type: EFI
Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000800 0x000057ff "kernel"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 0de91381-f36c-4ed7-97d9-2fd234dcef93
2 0x00005800 0x001fffde "rootfs"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 6b0004e2-26a1-428e-abfc-f3a648e7419e
=> ls mmc 0:1 或者 ext4ls mmc 0:1
<DIR> 1024 .
<DIR> 1024 ..
<DIR> 12288 lost+found
7680720 zImage
19161 vexpress-v2p-ca15_a7.dtb
13384 vexpress-v2p-ca15-tc1.dtb
12994 vexpress-v2p-ca5s.dtb
14736 vexpress-v2p-ca9.dtb
=> ls mmc 0:2 或者 ext4ls mmc 0:2
<DIR> 4096 .
<DIR> 4096 ..
<DIR> 16384 lost+found
<DIR> 4096 bin
<DIR> 4096 dev
<DIR> 4096 etc
<DIR> 4096 home
<DIR> 4096 include
<SYM> 11 init
<DIR> 4096 lib
<SYM> 11 linuxrc
<DIR> 4096 proc
<DIR> 4096 root
<DIR> 4096 sbin
<DIR> 4096 share
<DIR> 4096 sys
<DIR> 4096 tmp
<DIR> 4096 usr
<DIR> 4096 var
26 .ash_history
=> load mmc 0:1 0x60008000 zImage 或者ext4load mmc 0:1 0x60008000 zImage
7680720 bytes read in 1034 ms (7.1 MiB/s)
=> load mmc 0:1 0x61000000 vexpress-v2p-ca9.dtb 或者 ext4load mmc 0:1 0x61000000 vexpress-v2p-ca9.dtb
14736 bytes read in 67 ms (213.9 KiB/s)
setenv bootargs ‘root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait earlycon console=tty0 console=ttyAMA0 init=/linuxrc ignore_loglevel‘
=> bootz 0x60008000 - 0x61000000
=> bootz 0x60008000 - 0x61000000
Kernel image @ 0x60008000 [ 0x000000 - 0x7532d0 ]
## Flattened Device Tree blob at 61000000
Booting using the fdt blob at 0x61000000
Loading Device Tree to 7fe82000, end 7fe8898f ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.13+ (pengdl@pengdl-dell) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05)) #43 SMP Mon Jan 13 00:03:12 CST 2020
[ 0.000000] CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[ 0.000000] OF: fdt: Machine model: V2P-CA9
[ 0.000000] param_setup_earlycon enter, buf: (null)
[ 0.000000] earlycon: pl11 at MMIO 0x10009000 (options ‘115200n8‘)
[ 0.000000] bootconsole [pl11] enabled
[ 0.000000] param_setup_earlycon enter, buf: tty0
[ 0.000000] param_setup_earlycon enter, buf: ttyAMA0
[ 0.000000] debug: ignoring loglevel setting.
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] On node 0 totalpages: 262144
[ 0.000000] free_area_init_node: node 0, pgdat 80d5f300, node_mem_map bf7f9000
[ 0.000000] Normal zone: 2048 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 262144 pages, LIFO batch:31
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] random: fast init done
[ 0.000000] percpu: Embedded 16 pages/cpu @bf7ac000 s36428 r8192 d20916 u65536
[ 0.000000] pcpu-alloc: s36428 r8192 d20916 u65536 alloc=16*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 260096
[ 0.000000] Kernel command line: root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait earlycon console=tty0 console=ttyAMA0 init=/linuxrc ignore_loglevel
[ 0.000000] console_setup enter, str: tty0
[ 0.000000] console_setup enter, str: ttyAMA0
[ 0.000000] log_buf_len individual max cpu contribution: 4096 bytes
[ 0.000000] log_buf_len total cpu_extra contributions: 12288 bytes
[ 0.000000] log_buf_len min size: 16384 bytes
[ 0.000000] log_buf_len: 32768 bytes
[ 0.000000] early log buf free: 14380(87%)
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 1026280K/1048576K available (6144K kernel code, 439K rwdata, 1456K rodata, 4096K init, 170K bss, 22296K reserved, 0K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xc0800000 - 0xff800000 (1008 MB)
[ 0.000000] lowmem : 0x80000000 - 0xc0000000 (1024 MB)
[ 0.000000] modules : 0x7f000000 - 0x80000000 ( 16 MB)
[ 0.000000] .text : 0x80008000 - 0x80700000 (7136 kB)
[ 0.000000] .init : 0x80900000 - 0x80d00000 (4096 kB)
[ 0.000000] .data : 0x80d00000 - 0x80d6dd48 ( 440 kB)
[ 0.000000] .bss : 0x80d74e2c - 0x80d9f634 ( 171 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] GIC CPU mask not found - kernel will fail to boot.
[ 0.000000] GIC CPU mask not found - kernel will fail to boot.
[ 0.000000] L2C: platform modifies aux control register: 0x02020000 -> 0x02420000
[ 0.000000] L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
[ 0.000000] L2C-310 enabling early BRESP for Cortex-A9
[ 0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[ 0.000000] L2C-310 dynamic clock gating disabled, standby mode disabled
[ 0.000000] L2C-310 cache controller enabled, 8 ways, 128 kB
[ 0.000000] L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
[ 0.000000] smp_twd: clock not found -2
[ 0.000236] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.003014] clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[ 0.004034] Failed to initialize ‘/smb@4000000/motherboard/iofpga@7,00000000/timer@12000‘: -22
[ 0.007878] Console: colour dummy device 80x30
[ 0.009804] console [tty0] enabled
[ 0.010213] Calibrating local timer... 90.50MHz.
[ 0.063660] Calibrating delay loop... 726.63 BogoMIPS (lpj=3633152)
[ 0.163367] pid_max: default: 32768 minimum: 301
[ 0.164371] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.164640] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.173301] CPU: Testing write buffer coherency: ok
[ 0.180395] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.184217] Setting up static identity map for 0x60100000 - 0x60100060
[ 0.185567] Hierarchical SRCU implementation.
[ 0.190526] smp: Bringing up secondary CPUs ...
[ 0.195085] smp: Brought up 1 node, 1 CPU
[ 0.195340] SMP: Total of 1 processors activated (726.63 BogoMIPS).
[ 0.195628] CPU: All CPU(s) started in SVC mode.
[ 0.226950] devtmpfs: initialized
[ 0.237195] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
[ 0.249451] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.250611] futex hash table entries: 1024 (order: 4, 65536 bytes)
[ 0.286424] NET: Registered protocol family 16
[ 0.289887] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.411870] cpuidle: using governor ladder
[ 0.412536] hw-breakpoint: debug architecture 0x4 unsupported.
[ 0.413148] Serial: AMBA PL011 UART driver
[ 0.417687] OF: amba_device_add() failed (-19) for /memory-controller@100e0000
[ 0.418518] OF: amba_device_add() failed (-19) for /memory-controller@100e1000
[ 0.419075] OF: amba_device_add() failed (-19) for /watchdog@100e5000
[ 0.428162] 10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 35, base_baud = 0) is a PL011 rev1
[ 0.429393] console [ttyAMA0] enabled
[ 0.429393] console [ttyAMA0] enabled
[ 0.429830] bootconsole [pl11] disabled
[ 0.429830] bootconsole [pl11] disabled
[ 0.437874] 1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 36, base_baud = 0) is a PL011 rev1
[ 0.439865] 1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 37, base_baud = 0) is a PL011 rev1
[ 0.441651] 1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 38, base_baud = 0) is a PL011 rev1
[ 0.443990] OF: amba_device_add() failed (-19) for /smb@4000000/motherboard/iofpga@7,00000000/wdt@f000
[ 0.492049] SCSI subsystem initialized
[ 0.494187] libata version 3.00 loaded.
[ 0.495179] usbcore: registered new interface driver usbfs
[ 0.495583] usbcore: registered new interface driver hub
[ 0.496019] usbcore: registered new device driver usb
[ 0.500818] Advanced Linux Sound Architecture Driver Initialized.
[ 0.514158] clocksource: Switched to clocksource arm,sp804
[ 0.661421] NET: Registered protocol family 2
[ 0.665243] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.665645] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.666075] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.667823] UDP hash table entries: 512 (order: 2, 16384 bytes)
[ 0.668211] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[ 0.669427] NET: Registered protocol family 1
[ 0.672771] RPC: Registered named UNIX socket transport module.
[ 0.673010] RPC: Registered udp transport module.
[ 0.673167] RPC: Registered tcp transport module.
[ 0.673316] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 1.032936] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 5 counters available
[ 1.039079] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[ 1.056808] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 1.059624] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 1.062208] 9p: Installing v9fs 9p2000 file system support
[ 1.066233] io scheduler noop registered (default)
[ 1.066479] io scheduler mq-deadline registered
[ 1.066735] io scheduler kyber registered
[ 1.071064] clcd-pl11x 10020000.clcd: PL111 designer 41 rev2 at 0x10020000
[ 1.078507] clcd-pl11x 10020000.clcd: /clcd@10020000 hardware, 1024x768@59 display
[ 1.161773] Console: switching to colour frame buffer device 128x48
[ 1.167184] clcd-pl11x 1001f000.clcd: PL111 designer 41 rev2 at 0x1001f000
[ 1.168631] clcd-pl11x 1001f000.clcd: /smb@4000000/motherboard/iofpga@7,00000000/clcd@1f000 hardware, 640x480@59 display
[ 1.477077] brd: module loaded
[ 1.495912] loop: module loaded
[ 1.500177] 40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[ 1.501104] Intel/Sharp Extended Query Table at 0x0031
[ 1.501768] Using buffer write method
[ 1.502266] erase region 0: offset=0x0,size=0x40000,blocks=256
[ 1.504422] 40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[ 1.504906] Intel/Sharp Extended Query Table at 0x0031
[ 1.505391] Using buffer write method
[ 1.505629] erase region 0: offset=0x0,size=0x40000,blocks=256
[ 1.505986] Concatenating MTD devices:
[ 1.509464] (0): "40000000.flash"
[ 1.511999] (1): "40000000.flash"
[ 1.514592] into device "40000000.flash"
[ 1.579495] libphy: Fixed MDIO Bus: probed
[ 1.654665] libphy: smsc911x-mdio: probed
[ 1.659191] smsc911x 4e000000.ethernet eth0: MAC Address: 52:54:00:12:34:56
[ 1.765966] isp1760 4f000000.usb: bus width: 32, oc: digital
[ 1.777548] isp1760 4f000000.usb: NXP ISP1760 USB Host Controller
[ 1.781625] isp1760 4f000000.usb: new USB bus registered, assigned bus number 1
[ 1.784568] isp1760 4f000000.usb: Scratch test failed.
[ 1.787257] isp1760 4f000000.usb: can‘t setup: -19
[ 1.789669] isp1760 4f000000.usb: USB bus 1 deregistered
[ 1.793814] usbcore: registered new interface driver usb-storage
[ 1.802617] rtc-pl031 10017000.rtc: rtc core: registered pl031 as rtc0
[ 1.806070] IR NEC protocol handler initialized
[ 1.808391] IR RC5(x/sz) protocol handler initialized
[ 1.810806] IR RC6 protocol handler initialized
[ 1.813412] IR JVC protocol handler initialized
[ 1.815587] IR Sony protocol handler initialized
[ 1.817861] IR SANYO protocol handler initialized
[ 1.820138] IR Sharp protocol handler initialized
[ 1.822689] IR MCE Keyboard/mouse protocol handler initialized
[ 1.824910] IR XMP protocol handler initialized
[ 1.832118] mmci-pl18x 10005000.mmci: Got CD GPIO
[ 1.834664] mmci-pl18x 10005000.mmci: Got WP GPIO
[ 1.838372] mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 31,32 (pio)
[ 1.913351] input: AT Raw Set 2 keyboard as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:i
ofpga@7,00000000/10006000.kmi/serio0/input/input0
[ 1.928777] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.933517] usbcore: registered new interface driver usbhid
[ 1.935808] usbhid: USB HID core driver
[ 1.945013] mmc0: new SD card at address 4567
[ 1.952266] mmcblk0: mmc0:4567 QEMU! 1.00 GiB
[ 1.986464] mmcblk0: p1 p2
[ 1.992031] aaci-pl041 10004000.aaci: ARM AC‘97 Interface PL041 rev0 at 0x10004000, irq 30
[ 1.994594] aaci-pl041 10004000.aaci: FIFO 512 entries
[ 1.997482] oprofile: using arm/armv7-ca9
[ 2.000510] NET: Registered protocol family 17
[ 2.003305] 9pnet: Installing 9P2000 support
[ 2.005828] Registering SWP/SWPB emulation handler
[ 2.017119] rtc-pl031 10017000.rtc: setting system clock to 2020-01-14 15:02:26 UTC (1579014146)
[ 2.020519] ALSA device list:
[ 2.022710] #0: ARM AC‘97 Interface PL041 rev0 at 0x10004000, irq 30
[ 2.025497] Warning: unable to open an initial console.
[ 2.063902] Freeing unused kernel memory: 4096K
[ 2.500280] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2
[ 3.017505] EXT4-fs (mmcblk0p2): recovery complete
[ 3.021581] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 3.076962] Generic PHY 4e000000.ethernet-ffffffff:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=4e000000.ethernet-ffffffff:01, irq=POLL)
[ 3.083703] smsc911x 4e000000.ethernet eth0: SMSC911x/921x identified at 0xc1310000, IRQ: 28
Please press Enter to activate this console.
[root@vexpress ]#
[root@vexpress ]# mount
rootfs on / type rootfs (rw)
proc on /proc type proc (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
/dev/mmcblk0p2 on /root type ext4 (rw,relatime,data=ordered)
[root@vexpress ]# ls
bin dev home init linuxrc root share tmp var
d etc include lib proc sbin sys usr
完。
原文:https://www.cnblogs.com/pengdonglin137/p/12194548.html