qemu 之 uboot、linux 启动

目录

  • 编译
  • uboot、kernel 编译
  • 启动
  • 从 uboot 中引导启动 linux
  • 参考

本文主要说明 arm64qemu 上的相关启动。

编译

使用的是 qemu-8.1.1 版本,编译命令如下:

../configure --cc=/usr/local/bin/gcc --prefix=/home/XXX/qemu_out --enable-virtfs --enable-slirp --target-list=aarch64-softmmu

--target-list 可选如下

  --target-list=LIST       set target list (default: build all)Available targets: aarch64-softmmu alpha-softmmu arm-softmmu avr-softmmu cris-softmmu hppa-softmmu i386-softmmu loongarch64-softmmu m68k-softmmu microblaze-softmmu microblazeel-softmmu mips-softmmu mips64-softmmu mips64el-softmmu mipsel-softmmu nios2-softmmu or1k-softmmu ppc-softmmu ppc64-softmmu riscv32-softmmu riscv64-softmmu rx-softmmu s390x-softmmu sh4-softmmu sh4eb-softmmu sparc-softmmu sparc64-softmmu tricore-softmmu x86_64-softmmu xtensa-softmmu xtensaeb-softmmu aarch64-linux-user aarch64_be-linux-user alpha-linux-user arm-linux-user armeb-linux-user cris-linux-user hexagon-linux-user hppa-linux-user i386-linux-user loongarch64-linux-user m68k-linux-user microblaze-linux-user microblazeel-linux-user mips-linux-user mips64-linux-user mips64el-linux-user mipsel-linux-user mipsn32-linux-user mipsn32el-linux-user nios2-linux-user or1k-linux-user ppc-linux-user ppc64-linux-user ppc64le-linux-user riscv32-linux-user riscv64-linux-user s390x-linux-user sh4-linux-user sh4eb-linux-user sparc-linux-user sparc32plus-linux-user sparc64-linux-user x86_64-linux-user xtensa-linux-user xtensaeb-linux-user

uboot、kernel 编译

  • uboot 编译,需要使用 qemu_arm64_defconfig,使用其他真实板子的可能会起不来
make CROSS_COMPILE=aarch64-linux-gnu- qemu_arm64_defconfig
make  CROSS_COMPILE=aarch64-linux-gnu- -j4

编译后可以使用 u-bootu-boot.bin 文件

  • linux 编译使用命令,使用默认的 defconfig
make ARCH=arm64  CROSS_COMPILE=aarch64-linux-gnu- defconfig
make ARCH=arm64  CROSS_COMPILE=aarch64-linux-gnu- menuconfig
make ARCH=arm64  CROSS_COMPILE=aarch64-linux-gnu- -j4

启动

运行前,可先搭建一个网桥,并设置ip,用于网络连接:

sudo brctl addbr br0
sudo ifconfig br0 192.168.2.46

qemu-ifup 文件内容:

#!/bin/shecho sudo tunctl -u $(id -un) -t $1
sudo tunctl -u $(id -un) -t $1
echo sudo ifconfig $1 0.0.0.0 promisc up
sudo ifconfig $1 0.0.0.0 promisc up
echo sudo brctl addif br0 $1
sudo brctl addif br0 $1
echo brctl showbrctl show

qemu-ifdown 文件内容:

#!/bin/shecho sudo brctl delif br0 $1
sudo brctl delif br0 $1
echo sudo tunctl -d $1
sudo tunctl -d $1
echo brctl show
sudo brctl show
  • uboot 启动使用命令:
sudo ./qemu-system-aarch64 \-machine virt -cpu cortex-a76 -m size=1G \-kernel  ./qemu_test/u-boot \-nographic \-nic tap,script=./qemu_test/qemu-ifup,downscript=./qemu_test/qemu-ifdown

配置 setenv ipaddr 192.168.2.48 后,网络即可使用。
在这里插入图片描述
这里uboot 需要运行出现 BOOTP broadcast 1 后,才会有网络设备,启动时没有,这个没具体深究。应该是前面没添加网络设备,后面初始化了。

  • linux 启动使用命令:
sudo ./qemu-system-aarch64 \-machine virt \-nographic \-m size=1024M \-cpu cortex-a76 \-smp 4 \-kernel ./qemu_test/Image \-initrd ./qemu_test/uramdisk.image.gz \--append "root=/dev/ram0 rw init=/linuxrc console=ttyAMA0,115200" \-nic tap,script=./qemu_test/qemu-ifup \-hdb ./qemu_test/sd.ext4

qemu 的串口使用的是 ttyAMA0,配置后可直接打印,要使用 root=/dev/ram0 的方式,需要再内核添加几个配置,打开 CONFIG_BLK_DEV_RAM ,不然启动后会报错。

CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=2
CONFIG_BLK_DEV_RAM_SIZE=65536

上面命令中, -hda/-hdb 是使用文件作为硬盘镜像
sd.ext4 是加载一个 vda 的 image,会在系统中生产一个 /dev/vda 的设备

在这里插入图片描述

以下命令生成一个硬盘镜像为 ext4 格式:

dd if=/dev/zero of=sd.ext4 bs=1024 count=65536
sudo mke2fs -t ext4 -F sd.ext4 -L "sd.ext4" -b 1024 -m 0 -I 256

以下为进入 linux 后的打印

$ sudo ./qemu-system-aarch64     -machine virt -nographic -m size=1024M -cpu cortex-a76 -smp 4 -kernel ./qemu_test/Image -initrd ./qemu_test/uramdisk.image.gz --append "root=/dev/ram0 rw init=/linuxrc console=ttyAMA0,115200" -nic tap,script=./qemu_test/qemu-ifup -hdb ./qemu_test/sd.ext4 
WARNING: Image format was not specified for 'xxxxx/sd.ext4' and probing guessed raw.Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.Specify the 'raw' format explicitly to remove the restrictions.
sudo tunctl -u root -t tap0
TUNSETIFF: Device or resource busy
sudo ifconfig tap0 0.0.0.0 promisc up
sudo brctl addif br0 tap0
brctl showbrctl show
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x414fd0b1]
[    0.000000] Linux version 5.10.191-179793-g991fea0035ae (xx@Debian) (aarch64-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0, GNU ld (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 2.32.0.20190321) #14 SMP PREEMPT Fri Oct 20 15:50:33 CST 2023
[    0.000000] random: crng init done
[    0.000000] Machine model: linux,dummy-virt
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000007fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x7fdf4b00-0x7fdf6fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x000000007fffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000007fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000007fffffff]
[    0.000000] cma: Reserved 32 MiB at 0x000000007c000000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] psci: SMC Calling Convention v1.0
[    0.000000] percpu: Embedded 23 pages/cpu s56664 r8192 d29352 u94208
[    0.000000] Detected PIPT I-cache on CPU0
[    0.000000] CPU features: kernel page table isolation forced ON by KASLR
[    0.000000] CPU features: detected: Kernel page table isolation (KPTI)
[    0.000000] CPU features: detected: Hardware dirty bit management
[    0.000000] CPU features: detected: Spectre-v4
[    0.000000] CPU features: detected: Spectre-BHB
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 258048
[    0.000000] Policy zone: DMA
[    0.000000] Kernel command line: root=/dev/ram0 rw init=/linuxrc console=ttyAMA0,115200
[    0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 959592K/1048576K available (14272K kernel code, 2808K rwdata, 7652K rodata, 5952K init, 514K bss, 56216K reserved, 32768K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[    0.000000] 	Trampoline variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv2m: range[mem 0x08020000-0x08020fff], SPI[80:143]
[    0.000000] arch_timer: cp15 timer(s) running at 62.50MHz (virt).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1cd42e208c, max_idle_ns: 881590405314 ns
[    0.000117] sched_clock: 56 bits at 62MHz, resolution 16ns, wraps every 4398046511096ns
[    0.005552] Console: colour dummy device 80x25
[    0.007038] Calibrating delay loop (skipped), value calculated using timer frequency.. 125.00 BogoMIPS (lpj=250000)
[    0.007137] pid_max: default: 32768 minimum: 301
[    0.007813] LSM: Security Framework initializing
[    0.008568] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.008597] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.028389] /cpus/cpu-map: empty cluster
[    0.033608] rcu: Hierarchical SRCU implementation.
[    0.036353] EFI services will not be available.
[    0.037171] smp: Bringing up secondary CPUs ...
[    0.039141] Detected PIPT I-cache on CPU1
[    0.039798] CPU1: Booted secondary processor 0x0000000001 [0x414fd0b1]
[    0.042908] Detected PIPT I-cache on CPU2
[    0.043011] CPU2: Booted secondary processor 0x0000000002 [0x414fd0b1]
[    0.043968] Detected PIPT I-cache on CPU3
[    0.044150] CPU3: Booted secondary processor 0x0000000003 [0x414fd0b1]
[    0.044501] smp: Brought up 1 node, 4 CPUs
[    0.044540] SMP: Total of 4 processors activated.
[    0.044566] CPU features: detected: Privileged Access Never
[    0.044573] CPU features: detected: LSE atomic instructions
[    0.044578] CPU features: detected: User Access Override
[    0.044612] CPU features: detected: 32-bit EL0 Support
[    0.044632] CPU features: detected: Common not Private translations
[    0.044637] CPU features: detected: RAS Extension Support
[    0.044651] CPU features: detected: Data cache clean to the PoU not required for I/D coherence
[    0.044664] CPU features: detected: CRC32 instructions
[    0.044669] CPU features: detected: Speculative Store Bypassing Safe (SSBS)
[    0.312924] CPU: All CPU(s) started at EL1
[    0.323069] alternatives: patching kernel code
[    0.360408] devtmpfs: initialized
[    0.374577] KASLR enabled
[    0.376195] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.376558] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.380334] pinctrl core: initialized pinctrl subsystem
[    0.388973] DMI not present or invalid.
[    0.394993] NET: Registered protocol family 16
[    0.407147] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[    0.407417] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.407580] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.407761] audit: initializing netlink subsys (disabled)
[    0.409582] audit: type=2000 audit(0.244:1): state=initialized audit_enabled=0 res=1
[    0.412381] thermal_sys: Registered thermal governor 'step_wise'
[    0.412431] thermal_sys: Registered thermal governor 'power_allocator'
[    0.413393] cpuidle: using governor menu
[    0.414265] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.415432] ASID allocator initialised with 32768 entries
[    0.418028] Serial: AMBA PL011 UART driver
[    0.446808] 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 47, base_baud = 0) is a PL011 rev1
[    0.472591] printk: console [ttyAMA0] enabled
[    0.502877] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.504599] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
[    0.504756] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.504867] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
[    0.517397] cryptd: max_cpu_qlen set to 1000
[    0.527777] ACPI: Interpreter disabled.
[    0.530844] iommu: Default domain type: Translated 
[    0.531731] vgaarb: loaded
[    0.532894] SCSI subsystem initialized
[    0.534925] usbcore: registered new interface driver usbfs
[    0.535225] usbcore: registered new interface driver hub
[    0.536509] usbcore: registered new device driver usb
[    0.537506] pps_core: LinuxPPS API ver. 1 registered
[    0.537680] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.537935] PTP clock support registered
[    0.538401] EDAC MC: Ver: 3.0.0
[    0.545081] FPGA manager framework
[    0.545758] Advanced Linux Sound Architecture Driver Initialized.
[    0.574672] clocksource: Switched to clocksource arch_sys_counter
[    0.576069] VFS: Disk quotas dquot_6.6.0
[    0.576416] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.577790] pnp: PnP ACPI: disabled
[    0.605497] NET: Registered protocol family 2
[    0.606605] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.611132] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear)
[    0.611390] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.611599] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
[    0.611839] TCP: Hash tables configured (established 8192 bind 8192)
[    0.612755] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.613202] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.615045] NET: Registered protocol family 1
[    0.618759] RPC: Registered named UNIX socket transport module.
[    0.618971] RPC: Registered udp transport module.
[    0.619098] RPC: Registered tcp transport module.
[    0.619236] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.619459] PCI: CLS 0 bytes, default 64
[    0.622088] Trying to unpack rootfs image as initramfs...
[    0.626104] rootfs image is not initramfs (no cpio magic); looks like an initrd
[    0.643230] Freeing initrd memory: 3444K
[    0.652017] hw perfevents: enabled with armv8_pmuv3 PMU driver, 7 counters available
[    0.652537] kvm [1]: HYP mode not available
[    0.671261] Initialise system trusted keyrings
[    0.672625] workingset: timestamp_bits=42 max_order=18 bucket_order=0
[    0.680116] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.681880] NFS: Registering the id_resolver key type
[    0.682397] Key type id_resolver registered
[    0.682482] Key type id_legacy registered
[    0.683153] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.683319] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.684046] 9p: Installing v9fs 9p2000 file system support
[    0.698207] Key type asymmetric registered
[    0.698446] Asymmetric key parser 'x509' registered
[    0.698751] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
[    0.699176] io scheduler mq-deadline registered
[    0.699361] io scheduler kyber registered
[    0.712000] pl061_gpio 9030000.pl061: PL061 GPIO chip registered
[    0.715376] pci-host-generic 4010000000.pcie: host bridge /pcie@10000000 ranges:
[    0.716352] pci-host-generic 4010000000.pcie:       IO 0x003eff0000..0x003effffff -> 0x0000000000
[    0.716978] pci-host-generic 4010000000.pcie:      MEM 0x0010000000..0x003efeffff -> 0x0010000000
[    0.717187] pci-host-generic 4010000000.pcie:      MEM 0x8000000000..0xffffffffff -> 0x8000000000
[    0.718132] pci-host-generic 4010000000.pcie: ECAM at [mem 0x4010000000-0x401fffffff] for [bus 00-ff]
[    0.719058] pci-host-generic 4010000000.pcie: PCI host bridge to bus 0000:00
[    0.719415] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.719625] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    0.719765] pci_bus 0000:00: root bus resource [mem 0x10000000-0x3efeffff]
[    0.719971] pci_bus 0000:00: root bus resource [mem 0x8000000000-0xffffffffff]
[    0.721058] pci 0000:00:00.0: [1b36:0008] type 00 class 0x060000
[    0.723550] pci 0000:00:01.0: [1af4:1000] type 00 class 0x020000
[    0.723829] pci 0000:00:01.0: reg 0x10: [io  0x0000-0x001f]
[    0.724077] pci 0000:00:01.0: reg 0x20: [mem 0x00000000-0x00003fff 64bit pref]
[    0.724255] pci 0000:00:01.0: reg 0x30: [mem 0x00000000-0x0003ffff pref]
[    0.724644] pci 0000:00:02.0: [1af4:1001] type 00 class 0x010000
[    0.724778] pci 0000:00:02.0: reg 0x10: [io  0x0000-0x007f]
[    0.724898] pci 0000:00:02.0: reg 0x14: [mem 0x00000000-0x00000fff]
[    0.725120] pci 0000:00:02.0: reg 0x20: [mem 0x00000000-0x00003fff 64bit pref]
[    0.727038] pci 0000:00:01.0: BAR 6: assigned [mem 0x10000000-0x1003ffff pref]
[    0.727395] pci 0000:00:01.0: BAR 4: assigned [mem 0x8000000000-0x8000003fff 64bit pref]
[    0.727886] pci 0000:00:02.0: BAR 4: assigned [mem 0x8000004000-0x8000007fff 64bit pref]
[    0.728167] pci 0000:00:02.0: BAR 1: assigned [mem 0x10040000-0x10040fff]
[    0.728335] pci 0000:00:02.0: BAR 0: assigned [io  0x1000-0x107f]
[    0.728778] pci 0000:00:01.0: BAR 0: assigned [io  0x1080-0x109f]
[    0.732814] EINJ: ACPI disabled.
[    0.745831] virtio-pci 0000:00:01.0: enabling device (0000 -> 0003)
[    0.748370] virtio-pci 0000:00:02.0: enabling device (0000 -> 0003)
[    0.759932] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.763648] SuperH (H)SCI(F) driver initialized
[    0.764478] msm_serial: driver initialized
[    0.766846] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.779374] brd: module loaded
[    0.792193] loop: module loaded
[    0.806320] virtio_blk virtio1: [vda] 131072 512-byte logical blocks (67.1 MB/64.0 MiB)
[    0.809516] vda: detected capacity change from 0 to 67108864
[    0.820855] megasas: 07.714.04.00-rc1
[    0.826630] physmap-flash 0.flash: physmap platform flash device: [mem 0x00000000-0x03ffffff]
[    0.831215] 0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[    0.836564] Intel/Sharp Extended Query Table at 0x0031
[    0.839556] Using buffer write method
[    0.841466] physmap-flash 0.flash: physmap platform flash device: [mem 0x04000000-0x07ffffff]
[    0.845666] 0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[    0.849335] Intel/Sharp Extended Query Table at 0x0031
[    0.850796] Using buffer write method
[    0.851077] Concatenating MTD devices:
[    0.851173] (0): "0.flash"
[    0.851255] (1): "0.flash"
[    0.851311] into device "0.flash"
[    0.882157] tun: Universal TUN/TAP device driver, 1.6
[    0.894494] thunder_xcv, ver 1.0
[    0.894678] thunder_bgx, ver 1.0
[    0.894843] nicpf, ver 1.0
[    0.896562] hclge is initializing
[    0.896866] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    0.897039] hns3: Copyright (c) 2017 Huawei Corporation.
[    0.897441] e1000: Intel(R) PRO/1000 Network Driver
[    0.898260] e1000: Copyright (c) 1999-2006 Intel Corporation.
[    0.898499] e1000e: Intel(R) PRO/1000 Network Driver
[    0.898580] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    0.898792] igb: Intel(R) Gigabit Ethernet Network Driver
[    0.898926] igb: Copyright (c) 2007-2014 Intel Corporation.
[    0.899109] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    0.899252] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    0.899852] sky2: driver version 1.30
[    0.901519] VFIO - User Level meta-driver version: 0.3
[    0.911140] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.911425] ehci-pci: EHCI PCI platform driver
[    0.911703] ehci-platform: EHCI generic platform driver
[    0.912001] ehci-orion: EHCI orion driver
[    0.912240] ehci-exynos: EHCI Exynos driver
[    0.912492] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.912867] ohci-pci: OHCI PCI platform driver
[    0.913113] ohci-platform: OHCI generic platform driver
[    0.913394] ohci-exynos: OHCI Exynos driver
[    0.914692] usbcore: registered new interface driver usb-storage
[    0.923684] rtc-pl031 9010000.pl031: registered as rtc0
[    0.924952] rtc-pl031 9010000.pl031: setting system clock to 2023-10-24T11:37:04 UTC (1698147424)
[    0.926031] i2c /dev entries driver
[    0.933046] sdhci: Secure Digital Host Controller Interface driver
[    0.933244] sdhci: Copyright(c) Pierre Ossman
[    0.933893] Synopsys Designware Multimedia Card Interface Driver
[    0.935046] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.940663] ledtrig-cpu: registered to indicate activity on CPUs
[    0.942774] usbcore: registered new interface driver usbhid
[    0.942894] usbhid: USB HID core driver
[    0.949688] NET: Registered protocol family 17
[    0.950992] 9pnet: Installing 9P2000 support
[    0.951712] Key type dns_resolver registered
[    0.952975] registered taskstats version 1
[    0.953096] Loading compiled-in X.509 certificates
[    0.960069] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[    0.964485] ALSA device list:
[    0.964642]   No soundcards found.
[    0.966645] uart-pl011 9000000.pl011: no DMA platform data
[    0.969213] RAMDISK: gzip image found at block 0
[    1.481594] EXT4-fs (ram0): mounted filesystem with ordered data mode. Opts: (null)
[    1.482353] VFS: Mounted root (ext4 filesystem) on device 1:0.
[    1.484921] devtmpfs: mounted
[    1.584812] Freeing unused kernel memory: 5952K
[    1.586579] Run /linuxrc as init process
Starting rcS...
++ Mounting filesystem
++ Setting up eth0
++ Setting up mdev
/etc/init.d/rcS: line 17: can't create /proc/sys/kernel/hotplug: nonexistent directory
++ Starting telnet daemon
++ Starting ftp daemon
rcS Complete
root@root:/# 

从 uboot 中引导启动 linux

这里需要用到设备树,可在 linux 启动命令 -machine 中添加:

-machine virt,dumpdtb=./qemu_test/qemu_arm64.dtb

以下为命令:(删除 -hdb 项

 sudo ./qemu-system-aarch64 \-machine virt,dumpdtb=./qemu_test/qemu_arm64.dtb \-nographic \-m size=1024M \-cpu cortex-a76 \-smp 4 \-kernel ./qemu_test/Image \-initrd ./qemu_test/uramdisk.image.gz \--append "root=/dev/ram0 rw init=/linuxrc console=ttyAMA0,115200" \-nic tap,script=./qemu_test/qemu-ifup

这里需要注意下, uboot 启动的 DRAM 大小(-m 参数)需要与 linux 中的一致,不然起不来

而后在 uboot 中,就可使用 tftpboot 加载所需要的文件

setenv ipaddr 192.168.2.48 && setenv serverip 192.168.2.46&&tftpboot ${kernel_addr_r} Image1&&tftpboot ${ramdisk_addr_r} uramdisk.image.gz&&tftpboot ${fdt_addr} qemu_arm64.dtb&&setenv bootargs "root=/dev/ram0 rw  init=/linuxrc  console=ttyAMA0,115200"&&booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr}

在这里插入图片描述
在这里插入图片描述

要进入文件系统,需要修改 inittab 文件里的串口,否则无法输入命令

ttyAMA0::respawn:-/bin/ash

这里定义的 ttyAMA0 串口能直接进入系统,不用输入密码,暂不明白原因

参考

https://blog.51cto.com/u_15072780/3818667
https://hlyani.github.io/notes/openstack/qemu_make.html
https://www.zhaixue.cc/qemu/qemu-u-boot.html
https://zhuanlan.zhihu.com/p/547338158

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/192708.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

基于安卓android微信小程序的食谱大全系统

项目介绍 本文以实际运用为开发背景&#xff0c;运用软件工程原理和开发方法&#xff0c;它主要是采用java语言技术和mysql数据库来完成对系统的设计。整个开发过程首先对食谱大全进行需求分析&#xff0c;得出食谱大全主要功能。接着对食谱大全进行总体设计和详细设计。总体设…

多种格式图片可用的二维码生成技巧,快来学习一下

将图片存入二维码是现在很常见的一种图片展现方式&#xff0c;有效的节省了图片占用内容空间以及获取图片内容的速度&#xff0c;所以现在会有很多人将不同的图片、照片生成二维码展示。如何使用图片二维码生成器来快速生成二维码呢&#xff1f;下面就让小编来给大家分享一下图…

大数据分析师职业技能提升好考吗?含金量高不高

随着大数据时代的到来&#xff0c;大数据分析技能需求已经成为很多企业和机构的必备要求。大数据分析师证书成为当下的热门之一&#xff0c;那么大数据分析师证书需要具备哪些条件呢&#xff1f; 首先&#xff0c;报考大数据分析师证书需要具备以下方面的条件&#xff1a; …

(C语言)编写程序将一个4×4的数组进行顺时针旋转90度后输出。

要求&#xff1a;原始数组的数据从键盘随机输入&#xff0c;新数组以4行4列的方式输出。 #include<stdio.h> int main() {int matrix[4][4],matrix2[4][4];int count;for(int i 0;i < 4;i )for(int j 0;j < 4;j )scanf("%d",&matrix[i][j]);for(i…

读书充电,温暖你的冬日,本期为大家送出几本架构师成长和软件架构技术相关的好书,助你度过这个不太景气的寒冬!

目图书录 ⭐️《高并发架构实战&#xff1a;从需求分析到系统设计》⭐️《架构师的自我修炼&#xff1a;技术、架构和未来》⭐️《中台架构与实现&#xff1a;基于DDD和微服务》⭐️《分布式系统架构&#xff1a;架构策略与难题求解》⭐️《流程自动化实战&#xff1a;系统架构…

Java学习笔记(七)——面向对象编程(中级)

一、IDEA &#xff08;一&#xff09;常用的快捷键 &#xff08;二&#xff09;模版/自定义模版 二、包 &#xff08;一&#xff09;包的命名 &#xff08;二&#xff09;常用的包 &#xff08;三&#xff09;如何引入&#xff08;导入&#xff09;包 &#xff08;四&am…

Linux系统编程,Linux中的文件读写文件描述符

文章目录 Linux系统编程&#xff0c;Linux中的文件读写操作1.open函数&#xff0c;打开文件 Linux系统编程&#xff0c;Linux中的文件读写操作 1.open函数&#xff0c;打开文件 我们来看下常用的open函数 这个函数最终返回一个文件描述符struct file 我们查看一下它的Ubuntu…

.NET快速对接极光消息推送

什么是消息推送&#xff1f; 很多手机APP会不定时的给用户推送消息&#xff0c;例如一些新闻APP会给用户推送用户可能感兴趣的新闻&#xff0c;或者APP有更新了&#xff0c;会给用户推送是否选择更新的消息等等&#xff0c;这就是所谓的“消息推送”。 常见的一些APP消息推送…

【Vue】【uni-app】工单管理页面实现

用的是uni-app的uni-ui拓展组件实现的 功能是对工单进行一个展示&#xff0c;并对工单根据一些筛选条件进行搜索 目前是实现了除了日期之外的搜索功能&#xff0c;测试数据是下面这个tableData.js&#xff0c;都是我自己手写的&#xff0c;后端请求也稍微写了一些&#xff0c;…

vue3 el-menu初始化时选中没有高亮的问题(default-active和index的问题)

首先看官方文档的示例&#xff1a; 需要注意的是&#xff1a; 1、default-active的值是字符串&#xff0c;那么index绑定的值也要是字符串&#xff0c;且数字对应。不能default-avtive绑定的是1&#xff0c;而menu-item的index绑定的是45 2、default-active的值是当前选中me…

C++面向对象编程(4)——浅谈C++内存模型

目录 一. 说明 二. GDB实验 2.1 实验1&#xff1a;栈 2.2 实验2&#xff1a;堆 一. 说明 不同的操作系统对程序内存的管理和划分会有所不同。如上图所示的C内存区域划分主要是针对一般的情况&#xff0c;说明如下&#xff1a; 1. Stack&#xff1a;栈。由编译器管理分配和回…

远程登录Linux方法(Linux平台相互远程;Windows远程登录Linux、远程编码、文件传输;无法远程登录的问题解决;c程序的编译)

在实际使用Linux系统过程中我们不可避免的需要远程登录Linux&#xff0c;这是因为未来大家使用Linux服务器的时候你所对应的那台Linux服务器不一定提供界面(服务器可能在外地)。本篇将会介绍远程登录Linux的方法。 文章目录 1. SSH介绍2. Linux平台相互远程及文件传输2.1 Linux…

MySQL MHA高可用切换

MySQL MHA 1&#xff0e;什么是 MHA MHA&#xff08;MasterHigh Availability&#xff09;是一套优秀的MySQL高可用环境下故障切换和主从复制的软件。 MHA 的出现就是解决MySQL 单点的问题。 MySQL故障切换过程中&#xff0c;MHA能做到0-30秒内自动完成故障切换操作。 MHA能在…

【PG】PostgreSQL高可用方案repmgr部署(非常详细)

目录 简介 1 概述 1.1 术语 1.2 组件 1.2.1 repmgr 1.2.2 repmgrd 1.3 Repmgr用户与元数据 2 安装部署 2.0 部署环境 2.1 安装要求 2.1.1 操作系统 2.1.2 PostgreSQL 版本 2.1.3 操作系统用户 2.1.4 安装位置 2.1.5 版本要求 2.2 安装 2.2.1 软件包安装 2.2…

【C++】日期类实现,与日期计算相关OJ题

文章目录 日期类的设计日期计算相关OJ题HJ73 计算日期到天数转换KY111 日期差值KY222 打印日期KY258 日期累加 在软件开发中&#xff0c;处理日期是一项常见的任务。为了方便地操作日期&#xff0c;我们可以使用C编程语言来创建一个简单的日期类。在本文中&#xff0c;我们将介…

从0到0.01入门 Webpack| 001.精选 Webpack面试题

&#x1f90d; 前端开发工程师&#xff08;主业&#xff09;、技术博主&#xff08;副业&#xff09;、已过CET6 &#x1f368; 阿珊和她的猫_CSDN个人主页 &#x1f560; 牛客高级专题作者、在牛客打造高质量专栏《前端面试必备》 &#x1f35a; 蓝桥云课签约作者、已在蓝桥云…

四川竹哲电子商务有限公司怎么样?是真的吗

在当今数字化时代&#xff0c;抖音电商服务逐渐成为了企业营销的重要手段。在这个充满机遇与挑战的领域&#xff0c;四川竹哲电子商务有限公司以其卓越的服务质量&#xff0c;成为了行业内的佼佼者。本文将详细介绍四川竹哲电子商务有限公司的抖音电商服务&#xff0c;帮助您了…

vue离线地图(瓦片)

最近公司要弄一个这样的离线地图&#xff0c;要求在图上打点画线之类的。折腾了几天&#xff0c;学习了三种方式&#xff1a; 1.拿到各省市区的经纬度json&#xff0c;通过echarts来制作&#xff0c;再套一个卫星图的地图背景 2.下载地图瓦片&#xff0c;再通过百度/高德的离线…

Java学习之路 —— 异常、集合、Stream

文章目录 1. 异常2. 集合2.1 遍历2.1.1 迭代器2.1.2 增强for循环2.1.3 Lambda 2.2 List2.3 Set2.3.1 HashSet2.3.2 LinkedHashSet2.3.3 TreeSet 2.4 Map 3. Stream 1. 异常 Exception&#xff1a;叫异常&#xff0c;是程序员可以捕捉的。异常又分为了2类&#xff1a; 运行时异…

数据结构:红黑树的原理和实现

文章目录 红黑树的概念红黑树的性质红黑树的模拟实现红黑树的平衡问题 整体实现和测试 本篇用于进行红黑树的拆解和模拟实现&#xff0c;为之后的map和set的封装奠定基础 红黑树的概念 红黑树也是一种二叉搜索树&#xff0c;但是在每一个节点的内部新增了一个用以表示该节点颜…