当前位置: 首页 > news >正文

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

相关文章:

qemu 之 uboot、linux 启动

目录 编译uboot、kernel 编译启动从 uboot 中引导启动 linux注参考 本文主要说明 arm64 在 qemu 上的相关启动。 编译 使用的是 qemu-8.1.1 版本&#xff0c;编译命令如下: ../configure --cc/usr/local/bin/gcc --prefix/home/XXX/qemu_out --enable-virtfs --enable-slir…...

C语言--每日五道选择题--Day8

第一题 1、下列程序的输出是&#xff08; &#xff09; #include<stdio.h> int main() {int a[12] {1,2,3,4,5,6,7,8,9,10,11,12};int *p[4];int i;for(i0;i<4;i){p[i]&a[i*3];}printf("%d\n"&#xff0c;p[3][2]);return 0; } A: 上述程序有错误 B: 6…...

Outlook如何删除邮箱账户

Outlook如何删除邮箱账户 说明&#xff1a; 最近有用户询问到“我的Outlook登陆了很多个邮箱账号&#xff0c;不知道怎么退出”接下来将具体操作步骤加以说明 操作指引&#xff1a; 1、首先打开Outlook该软件&#xff0c;然后点击“文件” 2、点击账户设置下拉菜单 3、在下拉…...

ultrascale+mpsoc系列的ZYNQ中DDR4参数设置说明

ultrascalempsoc系列的ZYNQ中DDR4参数设置说明 标题1 概述标题2 讲述平台标题3 ZYNQ的DDR设置界面参数标题4 DDR参数界面说明如下 标题1 概述 本文用于讲诉ultrascalempsoc系列中的ZYNQ的DDR4的参数设置与实际硬件中的DDR选型之间的关系&#xff0c;为FPGA设计人员探明道路。 …...

maven-六类属性

Maven的六类属性_maven内置属性-CSDN博客 系统变量指的是java系统的变量&#xff0c;环境变量指的系统变量和用户变量 java系统仅针对java程序&#xff0c;环境变量是全局的。两者都可以传进java进程。 参考 01.java环境变量&#xff08;env&#xff09;和系统属性&#xf…...

微服务概念

微服务 微服务是什么 In short, the microservice architectural style [1] is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource A…...

响应式摄影科技传媒网站模板源码带后台

模板信息&#xff1a; 模板编号&#xff1a;540 模板编码&#xff1a;UTF8 模板颜色&#xff1a;黑白 模板分类&#xff1a;摄像、婚庆、家政、保洁 适合行业&#xff1a; 模板介绍&#xff1a; 本模板自带eyoucms内核&#xff0c;无需再下载eyou系统&#xff0c;原创设计、手…...

探索C#事件(Event)的强大应用

摘要 在现代软件开发中&#xff0c;对象之间的通信和交互是一个常见而重要的问题。为了解决这个问题&#xff0c;C#作为一种面向对象的编程语言提供了一种强大的特性&#xff1a;事件&#xff08;Event&#xff09;。事件可以帮助开发人员实现对象间的松耦合&#xff0c;提高代…...

学习c#的第四天

目录 C# 变量 C# 中的变量定义与初始化 接受来自用户的值 C# 中的 Lvalues 和 Rvalues 不同类型变量进行运算 静态变量 局部变量 C# 常量 整数常量 浮点常量 字符常量 字符串常量 定义常量 扩展知识 Convert.ToDouble 与 Double.Parse 的区别 静态常量和动态常…...

解析JSON字符串:属性值为null的时候不被序列化

如果希望属性值为null及不序列化&#xff0c;只序列化不为null的值。 1、测试代码 配置代码&#xff1a; mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); 或者通过注解JsonInclude(JsonInclude.Include.NON_NULL) //常见问题2&#xff1a;属性为null&a…...

短视频短剧小程序系统:用技术丰富你的碎片时间

在当今快节奏的生活中&#xff0c;人们的休闲时间变得越来越碎片化。短视频短剧小程序系统正是利用这一现象&#xff0c;通过技术手段为人们提供了丰富多样的娱乐内容&#xff0c;让碎片时间变得更加充实。 一、短视频短剧小程序系统的技术特点 高效加载与流畅播放&#xff1…...

服务器数据恢复—磁盘出现坏道掉线导致raid5阵列崩溃的数据恢复案例

服务器数据恢复环境&#xff1a; 某品牌服务器中有一组16块SAS接口硬盘组建的raid5磁盘阵列。 服务器故障&检测&#xff1a; 服务器raid5阵列中有2块硬盘掉线&#xff0c;上层服务器应用崩溃&#xff0c;导致服务器数据丢失。丢失的数据主要是4个1.5TB大小的卷中的数据&am…...

Android R.fraction

来源 我是在看Android10原生代码&#xff0c;绘制状态栏蓝牙电量相关类中第一次看到R.fraction的&#xff0c;如类BatteryMeterDrawable <fraction name"battery_button_height_fraction">10%</fraction> mButtonHeightFraction context.getResources(…...

C语言精华题目锦集1

第一题 test.c文件中包括如下语句&#xff0c;文件中定义的四个变量中&#xff0c;是指针类型的是&#xff08;&#xff09;【多选】 #define INT_PTR int* typedef int* intptr; INT_PRT a,b; int_ptr c,d;A:a  B:b  C:c  D:d #define是宏定义&#xff0c;此时在程序中IN…...

头歌答案Python——JSON基础

目录 ​编辑 Python——JSON基础 第1关&#xff1a;JSON篇&#xff1a;JSON基础知识 任务描述 第2关&#xff1a;JSON篇&#xff1a;使用json库 任务描述 Python——XPath基础 第1关&#xff1a;XPath 路径表达式 任务描述 第2关&#xff1a;XPath 轴定位 任务描述…...

TDengine 与煤科院五大系统实现兼容性互认,助力煤矿智能化安全体系搭建

近日&#xff0c;涛思数据与煤炭科学技术研究院&#xff08;以下简称煤科院&#xff09;已完成数个产品兼容互认证工作&#xff0c;经双方共同严格测试&#xff0c;涛思数据旗下物联网、工业大数据平台 TDengine V3.X 与煤炭科学技术研究院旗下煤矿复合灾害监测监控预警系统、煤…...

231030期就业班开班咯!我在前方护航,让你稳稳入职

就业哪家强&#xff1f;还得看优橙! 11月9日&#xff0c;231030期就业班的小伙伴结束了为期8天的基础班学习&#xff0c;正式进入了就业班。优橙教育也为新一批就业班的同学举办了开班典礼。 典礼环节中不仅有多彩的抽奖活动&#xff0c;也有丰富的超值礼品&#xff0c;旨在鼓…...

小白学安全-漏洞编号的理解 CVE/CAN/BUGTRAQ/CNCVE/CNVD/CNNVD

1、以CVE开头&#xff0c;如CVE-1999-1046这样的 CVE的英文全称是“Common Vulnerabilities&Exposures”公共漏洞和暴露。CVE就好像是一个字典表&#xff0c;为广泛认同的信息安全漏洞或者已经暴露出来的弱点给出一个公共的名称。使用一个共同的名字&#xff0c;能够帮助用…...

助力燃气安全运行:智慧燃气管网背景延展

关键词&#xff1a;城市燃气管网、智慧燃气管网、智慧管网、智慧燃气管网解决方案、智慧燃气 01背景 当前&#xff0c;随着我国城市化进程不断加快&#xff0c;城市燃气管网也不断延伸&#xff0c;运行规模庞大&#xff0c;地下管线复杂&#xff0c;不少城市建设“重地上轻地…...

低代码、零代码开源与不开源:区别解析

在如今日益发展的数字时代&#xff0c;程序开发变得越来越重要。为了实现日益提高的业务需求&#xff0c;开发人员必须能够以更高效、更灵活的方式构建和交货软件解决方案。低代码和零代码开源是近几年流行的两种开发方法。本文将探讨它们与传统非开源程序开发的差别&#xff0…...

未来机器人的大脑:如何用神经网络模拟器实现更智能的决策?

编辑&#xff1a;陈萍萍的公主一点人工一点智能 未来机器人的大脑&#xff1a;如何用神经网络模拟器实现更智能的决策&#xff1f;RWM通过双自回归机制有效解决了复合误差、部分可观测性和随机动力学等关键挑战&#xff0c;在不依赖领域特定归纳偏见的条件下实现了卓越的预测准…...

设计模式和设计原则回顾

设计模式和设计原则回顾 23种设计模式是设计原则的完美体现,设计原则设计原则是设计模式的理论基石, 设计模式 在经典的设计模式分类中(如《设计模式:可复用面向对象软件的基础》一书中),总共有23种设计模式,分为三大类: 一、创建型模式(5种) 1. 单例模式(Sing…...

React Native 导航系统实战(React Navigation)

导航系统实战&#xff08;React Navigation&#xff09; React Navigation 是 React Native 应用中最常用的导航库之一&#xff0c;它提供了多种导航模式&#xff0c;如堆栈导航&#xff08;Stack Navigator&#xff09;、标签导航&#xff08;Tab Navigator&#xff09;和抽屉…...

无法与IP建立连接,未能下载VSCode服务器

如题&#xff0c;在远程连接服务器的时候突然遇到了这个提示。 查阅了一圈&#xff0c;发现是VSCode版本自动更新惹的祸&#xff01;&#xff01;&#xff01; 在VSCode的帮助->关于这里发现前几天VSCode自动更新了&#xff0c;我的版本号变成了1.100.3 才导致了远程连接出…...

苍穹外卖--缓存菜品

1.问题说明 用户端小程序展示的菜品数据都是通过查询数据库获得&#xff0c;如果用户端访问量比较大&#xff0c;数据库访问压力随之增大 2.实现思路 通过Redis来缓存菜品数据&#xff0c;减少数据库查询操作。 缓存逻辑分析&#xff1a; ①每个分类下的菜品保持一份缓存数据…...

Mac软件卸载指南,简单易懂!

刚和Adobe分手&#xff0c;它却总在Library里给你写"回忆录"&#xff1f;卸载的Final Cut Pro像电子幽灵般阴魂不散&#xff1f;总是会有残留文件&#xff0c;别慌&#xff01;这份Mac软件卸载指南&#xff0c;将用最硬核的方式教你"数字分手术"&#xff0…...

C# 类和继承(抽象类)

抽象类 抽象类是指设计为被继承的类。抽象类只能被用作其他类的基类。 不能创建抽象类的实例。抽象类使用abstract修饰符声明。 抽象类可以包含抽象成员或普通的非抽象成员。抽象类的成员可以是抽象成员和普通带 实现的成员的任意组合。抽象类自己可以派生自另一个抽象类。例…...

初学 pytest 记录

安装 pip install pytest用例可以是函数也可以是类中的方法 def test_func():print()class TestAdd: # def __init__(self): 在 pytest 中不可以使用__init__方法 # self.cc 12345 pytest.mark.api def test_str(self):res add(1, 2)assert res 12def test_int(self):r…...

【数据分析】R版IntelliGenes用于生物标志物发现的可解释机器学习

禁止商业或二改转载&#xff0c;仅供自学使用&#xff0c;侵权必究&#xff0c;如需截取部分内容请后台联系作者! 文章目录 介绍流程步骤1. 输入数据2. 特征选择3. 模型训练4. I-Genes 评分计算5. 输出结果 IntelliGenesR 安装包1. 特征选择2. 模型训练和评估3. I-Genes 评分计…...

python报错No module named ‘tensorflow.keras‘

是由于不同版本的tensorflow下的keras所在的路径不同&#xff0c;结合所安装的tensorflow的目录结构修改from语句即可。 原语句&#xff1a; from tensorflow.keras.layers import Conv1D, MaxPooling1D, LSTM, Dense 修改后&#xff1a; from tensorflow.python.keras.lay…...