zoukankan      html  css  js  c++  java
  • 在proxmox中模拟树莓派

    总体来说,有2种思路:

    1、可以通过proxmox中的qemu-system-arm命令来模拟,这种方式需要 使用github上经过修改的kernel以及dtb(设备树文件,dt表示device tree),需要3个文件:raspbian的img文件(需要从官网下载)、dtb文件、经过修改的kernel(这2个文件需要从github上下载)
    raspbian官网下载地址:
    http://downloads.raspberrypi.org/raspbian/images/
    对应的lite镜像 http://downloads.raspberrypi.org/raspbian_lite/images/

    dtb文件以及kernel下载地址:
    https://github.com/dhruvvyas90/qemu-rpi-kernel 在此github上还有详细的使用说明

    在proxmox上使用,难点: 注意配套使用proxmox的bridge网卡而不要使用github示例中的qemu内置nat网卡

    qemu-system-arm 
    -M versatilepb,accel=tcg   -----accel=tcg才能启动
    -cpu arm1176 
    -m 256 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -net user,hostfwd=tcp::5022-:22 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    
    qemu-system-arm 
    -machine versatilepb 
    -cpu arm1176 
    -m 256 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -netdev 'type=tap,id=net1,ifname=tap101i1,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' 
    -device 'virtio-net-pci,mac=1A:E8:8F:FA:D7:5C,netdev=net1,bus=pci.0,addr=0x13,id=net1,bootindex=301' 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    

    提示错误:qemu-system-arm: -machine accel=kvm: No accelerator found
    参考:https://www.reddit.com/r/qemu_kvm/comments/87h8nw/accelkvm_no_accelerator_found_only_for_arm/ (需要FQ)
    结论:
    KVM uses virtualization features of the host processor to run binaries of the same architecture. You can't emulate ARM through x86/x86_64 KVM because they're different architectures.

    qemu-system-arm
    -M versatilepb,accel=tcg
    -nographic
    -cpu arm1176
    -m 256
    -hda /root/raspbian/2020-02-13-raspbian-buster.img
    -dtb /root/raspbian/versatile-pb-buster.dtb
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster
    -append 'root=/dev/sda2 panic=1'
    -no-reboot
    可以正常启动(-nographic ),不知道为什么不能使用accel=kvm只能用模拟tcg 如下:

    注意启动过程有2个fail
    vpb_sic_write: Bad register offset 0x2c
    Booting Linux on physical CPU 0x0
    Linux version 4.19.50+ (niklas@ubuntu) (gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)) #1 Tue Nov 26 01:49:16 CET 2019
    CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
    CPU: VIPT aliasing data cache, unknown instruction cache
    OF: fdt: Machine model: ARM Versatile PB
    Memory policy: Data cache writeback
    random: get_random_bytes called from start_kernel+0x88/0x414 with crng_init=0
    Built 1 zonelists, mobility grouping on.  Total pages: 64960
    Kernel command line: root=/dev/sda2 panic=1
    Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
    Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
    Memory: 252032K/262144K available (5406K kernel code, 211K rwdata, 1360K rodata, 196K init, 142K bss, 10112K reserved, 0K cma-reserved)
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
        vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
        lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .text : 0x(ptrval) - 0x(ptrval)   (5408 kB)
          .init : 0x(ptrval) - 0x(ptrval)   ( 196 kB)
          .data : 0x(ptrval) - 0x(ptrval)   ( 212 kB)
           .bss : 0x(ptrval) - 0x(ptrval)   ( 143 kB)
    NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
    VIC @(ptrval): id 0x00041190, vendor 0x41
    FPGA IRQ chip 0 "intc" @ (ptrval), 20 irqs, parent IRQ: 47
    clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
    sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
    Failed to initialize '/amba/timer@101e3000': -22
    sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    Console: colour dummy device 80x30
    console [tty0] enabled
    Calibrating delay loop... 956.00 BogoMIPS (lpj=4780032)
    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
    Setting up static identity map for 0x8220 - 0x827c
    devtmpfs: initialized
    VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    futex hash table entries: 256 (order: -1, 3072 bytes)
    NET: Registered protocol family 16
    DMA: preallocated 256 KiB pool for atomic coherent allocations
    OF: amba_device_add() failed (-19) for /amba/smc@10100000
    OF: amba_device_add() failed (-19) for /amba/mpmc@10110000
    OF: amba_device_add() failed (-19) for /amba/sctl@101e0000
    OF: amba_device_add() failed (-19) for /amba/watchdog@101e1000
    OF: amba_device_add() failed (-19) for /amba/sci@101f0000
    OF: amba_device_add() failed (-19) for /amba/ssp@101f4000
    OF: amba_device_add() failed (-19) for /amba/fpga/sci@a000
    Serial: AMBA PL011 UART driver
    101f1000.uart: ttyAMA0 at MMIO 0x101f1000 (irq = 28, base_baud = 0) is a PL011 rev1
    console [ttyAMA0] enabled
    101f2000.uart: ttyAMA1 at MMIO 0x101f2000 (irq = 29, base_baud = 0) is a PL011 rev1
    101f3000.uart: ttyAMA2 at MMIO 0x101f3000 (irq = 30, base_baud = 0) is a PL011 rev1
    10009000.uart: ttyAMA3 at MMIO 0x10009000 (irq = 54, base_baud = 0) is a PL011 rev1
    vgaarb: loaded
    SCSI subsystem initialized
    clocksource: Switched to clocksource arm,sp804
    NET: Registered protocol family 2
    tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
    TCP established hash table entries: 2048 (order: 1, 8192 bytes)
    TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
    TCP: Hash tables configured (established 2048 bind 2048)
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    NetWinder Floating Point Emulator V0.97 (double precision)
    workingset: timestamp_bits=14 max_order=16 bucket_order=2
    Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
    jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
    9p: Installing v9fs 9p2000 file system support
    Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
    io scheduler noop registered
    io scheduler deadline registered
    io scheduler cfq registered (default)
    io scheduler mq-deadline registered
    io scheduler kyber registered
    pl061_gpio 101e4000.gpio: PL061 GPIO chip @0x101e4000 registered
    pl061_gpio 101e5000.gpio: PL061 GPIO chip @0x101e5000 registered
    pl061_gpio 101e6000.gpio: PL061 GPIO chip @0x101e6000 registered
    pl061_gpio 101e7000.gpio: PL061 GPIO chip @0x101e7000 registered
    versatile-pci 10001000.pci: host bridge /amba/pci@10001000 ranges:
    versatile-pci 10001000.pci:    IO 0x43000000..0x4300ffff -> 0x00000000
    versatile-pci 10001000.pci:   MEM 0x50000000..0x5fffffff -> 0x50000000
    versatile-pci 10001000.pci:   MEM 0x60000000..0x6fffffff -> 0x60000000
    versatile-pci 10001000.pci: PCI core found (slot 11)
    versatile-pci 10001000.pci: PCI host bridge to bus 0000:00
    pci_bus 0000:00: root bus resource [bus 00-ff]
    pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
    pci_bus 0000:00: root bus resource [mem 0x50000000-0x5fffffff]
    pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff pref]
    PCI: bus0: Fast back to back transfers disabled
    pci 0000:00:0c.0: BAR 2: assigned [mem 0x50000000-0x50001fff]
    pci 0000:00:0c.0: BAR 1: assigned [mem 0x50002000-0x500023ff]
    pci 0000:00:0c.0: BAR 0: assigned [io  0x1000-0x10ff]
    drm-clcd-pl111 dev:20: no max memory bandwidth specified, assume unlimited
    drm-clcd-pl111 dev:20: set up callbacks for Versatile PL110
    drm-clcd-pl111 dev:20: found bridge on endpoint 0
    drm-clcd-pl111 dev:20: Using non-panel bridge
    [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
    [drm] No driver support for vblank timestamp query.
    drm-clcd-pl111 dev:20: enable Versatile CLCD connectors
    Console: switching to colour frame buffer device 128x48
    drm-clcd-pl111 dev:20: fb0: DRM emulated frame buffer device
    [drm] Initialized pl111 1.0.0 20170317 for dev:20 on minor 0
    brd: module loaded
    loop: module loaded
    sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
    sym0: <895a> rev 0x0 at pci 0000:00:0c.0 irq 66
    sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
    sym0: SCSI BUS has been reset.
    scsi host0: sym-2.2.3
    random: fast init done
    scsi 0:0:0:0: Direct-Access     QEMU     QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
    scsi target0:0:0: tagged command queuing enabled, command queue depth 16.
    scsi target0:0:0: Beginning Domain Validation
    scsi target0:0:0: Domain Validation skipping write tests
    scsi target0:0:0: Ending Domain Validation
    scsi 0:0:2:0: CD-ROM            QEMU     QEMU CD-ROM      2.5+ PQ: 0 ANSI: 5
    scsi target0:0:2: tagged command queuing enabled, command queue depth 16.
    scsi target0:0:2: Beginning Domain Validation
    scsi target0:0:2: Domain Validation skipping write tests
    scsi target0:0:2: Ending Domain Validation
    sr 0:0:2:0: Power-on or device reset occurred
    sr 0:0:2:0: [sr0] scsi3-mmc drive: 16x/50x cd/rw xa/form2 cdda tray
    cdrom: Uniform CD-ROM driver Revision: 3.20
    sd 0:0:0:0: Power-on or device reset occurred
    sd 0:0:0:0: [sda] 7397376 512-byte logical blocks: (3.79 GB/3.53 GiB)
    sd 0:0:0:0: [sda] Write Protect is off
    sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
    of-flash 34000000.flash: versatile/realview flash protection
    34000000.flash: Found 1 x32 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
    Intel/Sharp Extended Query Table at 0x0031
    Using buffer write method
     sda: sda1 sda2
    sd 0:0:0:0: [sda] Attached SCSI disk
    smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico@fluxnic.net>
    smc91x 10010000.net eth0: SMC91C11xFD (rev 1) at (ptrval) IRQ 41
    smc91x 10010000.net eth0: Ethernet addr: 52:54:00:12:34:56
    rtc-ds1307 0-0068: registered as rtc0
    versatile reboot driver registered
    device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
    mmci-pl18x fpga:05: /aliases ID not available
    mmci-pl18x fpga:05: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 59,60 (pio)
    mmci-pl18x fpga:05: DMA channels RX none, TX none
    mmci-pl18x fpga:0b: /aliases ID not available
    mmci-pl18x fpga:0b: mmc1: PL181 manf 41 rev0 at 0x1000b000 irq 49,50 (pio)
    mmci-pl18x fpga:0b: DMA channels RX none, TX none
    leds-syscon 10000000.core-module:led@08.0: registered LED versatile:0
    leds-syscon 10000000.core-module:led@08.1: registered LED versatile:1
    leds-syscon 10000000.core-module:led@08.2: registered LED versatile:2
    leds-syscon 10000000.core-module:led@08.3: registered LED versatile:3
    leds-syscon 10000000.core-module:led@08.4: registered LED versatile:4
    leds-syscon 10000000.core-module:led@08.5: registered LED versatile:5
    leds-syscon 10000000.core-module:led@08.6: registered LED versatile:6
    leds-syscon 10000000.core-module:led@08.7: registered LED versatile:7
    ledtrig-cpu: registered to indicate activity on CPUs
    NET: Registered protocol family 17
    Bridge firewalling registered
    9pnet: Installing 9P2000 support
    input: AT Raw Set 2 keyboard as /devices/platform/amba/amba:fpga/10006000.kmi/serio0/input/input0
    rtc-ds1307 0-0068: setting system clock to 2020-11-19 04:46:41 UTC (1605761201)
    uart-pl011 101f1000.uart: no DMA platform data
    input: ImExPS/2 Generic Explorer Mouse as /devices/platform/amba/amba:fpga/10007000.kmi/serio1/input/input2
    EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
    VFS: Mounted root (ext4 filesystem) readonly on device 8:2.
    devtmpfs: mounted
    Freeing unused kernel memory: 196K
    This architecture does not have kernel memory protection.
    Run /sbin/init as init process
    systemd[1]: Failed to lookup module alias 'autofs4': Function not implemented
    systemd[1]: systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
    systemd[1]: Detected architecture arm.
    
    Welcome to Raspbian GNU/Linux 10 (buster)!
    
    systemd[1]: Set hostname to <raspberrypi>.
    random: systemd: uninitialized urandom read (16 bytes read)
    systemd[1]: Initializing machine ID from random generator.
    systemd[1]: Installed transient /etc/machine-id file.
    systemd[1]: File /lib/systemd/system/systemd-journald.service:12 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling.
    systemd[1]: Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.)
    random: systemd: uninitialized urandom read (16 bytes read)
    random: systemd: uninitialized urandom read (16 bytes read)
    systemd[1]: Created slice User and Session Slice.
    [  OK  ] Created slice User and Session Slice.
    random: systemd: uninitialized urandom read (16 bytes read)
    systemd[1]: Listening on udev Control Socket.
    [  OK  ] Listening on udev Control Socket.
    systemd[1]: Listening on initctl Compatibility Named Pipe.
    [  OK  ] Listening on initctl Compatibility Named Pipe.
    [  OK  ] Listening on udev Kernel Socket.
    [  OK  ] Created slice system-systemdx2dfsck.slice.
    [  OK  ] Reached target Slices.
    [  OK  ] Listening on Journal Socket.
             Mounting Kernel Debug File System...
             Starting udev Coldplug all Devices...
             Starting Restore / save the current clock...
             Starting Set the console keyboard layout...
    systemd[1]: Mounting POSIX Message Queue File System...
             Mounting POSIX Message Queue File System...
    systemd[1]: Starting Load Kernel Modules...
             Starting Load Kernel Modules...
    systemd[1]: Listening on Syslog Socket.
    [  OK  ] Listening on Syslog Socket.
    systemd[1]: Listening on fsck to fsckd communication Socket.
    [  OK  ] Listening on fsck to fsckd communication Socket.
    systemd[1]: Listening on Journal Socket (/dev/log).
    [  OK  ] Listening on Journal Socket (/dev/log).
    systemd[1]: Condition check resulted in Journal Audit Socket being skipped.
    systemd[1]: Starting Journal Service...
             Starting Journal Service...
    systemd[1]: Started Forward Password Requests to Wall Directory Watch.
    [  OK  ] Started Forward Password R…uests to Wall Directory Watch.
    systemd[1]: Created slice system-getty.slice.
    [  OK  ] Created slice system-getty.slice.
    systemd[1]: Reached target Swap.
    [  OK  ] Reached target Swap.
             Mounting RPC Pipe File System...
    [  OK  ] Created slice system-serialx2dgetty.slice.
    [  OK  ] Mounted Kernel Debug File System.
    [  OK  ] Started Restore / save the current clock.
    [  OK  ] Mounted POSIX Message Queue File System.
    [FAILED] Failed to start Load Kernel Modules.
    See 'systemctl status systemd-modules-load.service' for details.
    [  OK  ] Mounted RPC Pipe File System.
             Starting Apply Kernel Variables...
             Starting File System Check on Root Device...
    [  OK  ] Started Apply Kernel Variables.
    [  OK  ] Started File System Check Daemon to report status.
    [  OK  ] Started File System Check on Root Device.
             Starting Remount Root and Kernel File Systems...
    [  OK  ] Started Journal Service.
    [  OK  ] Started Set the console keyboard layout.
    [  OK  ] Started Remount Root and Kernel File Systems.
             Starting Load/Save Random Seed...
             Starting Flush Journal to Persistent Storage...
             Starting Create System Users...
    [  OK  ] Started udev Coldplug all Devices.
             Starting Helper to synchronize boot up for ifupdown...
    [  OK  ] Started Load/Save Random Seed.
    [  OK  ] Started Flush Journal to Persistent Storage.
    [  OK  ] Started Helper to synchronize boot up for ifupdown.
    [  OK  ] Started Create System Users.
             Starting Create Static Device Nodes in /dev...
    [  OK  ] Started Create Static Device Nodes in /dev.
    [  OK  ] Reached target Local File Systems (Pre).
             Starting udev Kernel Device Manager...
    [  OK  ] Started udev Kernel Device Manager.
             Starting Show Plymouth Boot Screen...
    [  OK  ] Started Show Plymouth Boot Screen.
    [  OK  ] Started Forward Password R…s to Plymouth Directory Watch.
    [  OK  ] Reached target Local Encrypted Volumes.
    [  OK  ] Reached target Paths.
    [  OK  ] Found device /dev/ttyAMA0.
    [  OK  ] Found device QEMU_HARDDISK boot.
             Starting File System Check…isk/by-partuuid/ea7d04d6-01...
    [  OK  ] Started File System Check …/disk/by-partuuid/ea7d04d6-01.
             Mounting /boot...
    [  OK  ] Mounted /boot.
    [  OK  ] Reached target Local File Systems.
             Starting Raise network interfaces...
             Starting Create Volatile Files and Directories...
             Starting Commit a transient machine-id on disk...
             Starting Tell Plymouth To Write Out Runtime Data...
             Starting Set console font and keymap...
             Starting Preprocess NFS configuration...
    [  OK  ] Started Tell Plymouth To Write Out Runtime Data.
    [  OK  ] Started Set console font and keymap.
    [  OK  ] Started Commit a transient machine-id on disk.
    [  OK  ] Started Preprocess NFS configuration.
    [  OK  ] Reached target NFS client services.
    [  OK  ] Reached target Remote File Systems (Pre).
    [  OK  ] Reached target Remote File Systems.
    [  OK  ] Started Create Volatile Files and Directories.
             Starting Update UTMP about System Boot/Shutdown...
             Starting Network Time Synchronization...
    [  OK  ] Started Update UTMP about System Boot/Shutdown.
    [  OK  ] Started Network Time Synchronization.
    [  OK  ] Reached target System Initialization.
    [  OK  ] Started Daily Cleanup of Temporary Directories.
    [  OK  ] Listening on triggerhappy.socket.
    [  OK  ] Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
    [  OK  ] Listening on D-Bus System Message Bus Socket.
    [  OK  ] Reached target Sockets.
    [  OK  ] Reached target Basic System.
             Starting Login Service...
             Starting LSB: Switch to on…nless shift key is pressed)...
    [  OK  ] Started D-Bus System Message Bus.
             Starting rng-tools.service...
             Starting Regenerate SSH host keys...
             Starting System Logging Service...
             Starting Check for v3d driver...
             Starting Check for Raspberry Pi EEPROM updates...
             Starting Avahi mDNS/DNS-SD Stack...
    [  OK  ] Started Regular background program processing daemon.
             Starting triggerhappy global hotkey daemon...
             Starting LSB: Resize the r…ilesystem to fill partition...
             Starting Disk Manager...
             Starting dphys-swapfile - …unt, and delete a swap file...
             Starting WPA supplicant...
             Starting dhcpcd on all interfaces...
    [  OK  ] Reached target System Time Synchronized.
    [  OK  ] Started Daily rotation of log files.
    [  OK  ] Started Daily apt download activities.
    [  OK  ] Started Daily apt upgrade and clean activities.
    [  OK  ] Started Daily man-db regeneration.
    [  OK  ] Reached target Timers.
    [  OK  ] Started System Logging Service.
    [  OK  ] Started triggerhappy global hotkey daemon.
    [  OK  ] Started Raise network interfaces.
    [FAILED] Failed to start rng-tools.service.
    See 'systemctl status rng-tools.service' for details.
    [  OK  ] Started Check for v3d driver.
    [  OK  ] Started Check for Raspberry Pi EEPROM updates.
    [  OK  ] Started dhcpcd on all interfaces.
             Starting Authorization Manager...
    [  OK  ] Started Login Service.
    [  OK  ] Started Avahi mDNS/DNS-SD Stack.
    [  OK  ] Started WPA supplicant.
    [  OK  ] Reached target Network.
             Starting Permit User Sessions...
             Starting /etc/rc.local Compatibility...
    [  OK  ] Started LSB: Switch to ond…(unless shift key is pressed).
    [  OK  ] Started /etc/rc.local Compatibility.
    [  OK  ] Started Permit User Sessions.
             Starting Hold until boot process finishes up...
             Starting Light Display Manager...
    [  OK  ] Started dphys-swapfile - s…mount, and delete a swap file.
    [  OK  ] Started Authorization Manager.
    [  OK  ] Started LSB: Resize the ro… filesystem to fill partition.
    [  OK  ] Started Hold until boot process finishes up.
    
    Raspbian GNU/Linux 10 raspberrypi ttyAMA0
    

    查看systemd-module-load服务如下:

    调试如下:

    qemu-system-arm 
    -M versatilepb,accel=tcg 
    -cpu arm1176 
    -m 256 
    -net user,hostfwd=tcp::5022-:22 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    提示
    WARNING: Image format was not specified for '/root/raspbian/2020-02-13-raspbian-buster.img' 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.
    qemu-system-arm: warning: vlan 0 with no nics
    Running QEMU with SDL 1.2 is deprecated, and will be removed
    in a future release. Please switch to SDL 2.0 instead
    Could not initialize SDL(No available video device) - exiting
    
    
    qemu-system-arm 
    -M versatilepb,accel=tcg 
    -cpu arm1176 
    -m 256 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    提示以上错误
    
    qemu-system-arm 
    -M versatilepb,accel=tcg 
    -cpu arm1176 
    -m 256 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -nodefaults 
    -no-reboot
    提示以上错误
    
    
    
    qemu-system-arm 
    -M versatilepb 
    -disable-kvm 
    -cpu arm1176 
    -m 256 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -nodefaults 
    -no-reboot
    提示qemu-system-arm: -disable-kvm: invalid option
    
    
    qemu-system-arm 
    -M versatilepb,accel=tcg 
    -nographic 
    -cpu arm1176 
    -m 256 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    正常启动,有2个服务没有启动
    
    qemu-system-arm 
    -M versatilepb,accel=tcg 
    -serial mon:stdio 
    -nographic 
    -cpu arm1176 
    -m 256 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    正常启动,有2个服务没有启动
    
    qemu-system-arm 
    -M versatilepb,accel=tcg 
    -serial mon:stdio 
    -nographic 
    -cpu arm1176 
    -m 256 
    -netdev 'type=tap,id=net1,ifname=tap101i1,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' 
    -device 'virtio-net-pci,mac=1A:E8:8F:FA:D7:5C,netdev=net1,bus=pci.0,addr=0x13,id=net1,bootindex=301' 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    提示qemu-system-arm: could not configure /dev/net/tun (tap101i1): Device or resource busy
    
    
    qemu-system-arm 
    -M versatilepb,accel=tcg 
    -serial mon:stdio 
    -nographic 
    -cpu arm1176 
    -m 256 
    -netdev 'type=tap,id=net1,ifname=vmbr0' 
    -device 'virtio-net-pci,mac=1A:E8:8F:FA:D7:5C,netdev=net1,id=net1' 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    提示qemu-system-arm: could not configure /dev/net/tun (vmbr0): Invalid argument
    
    
    qemu-system-arm 
    -M versatilepb,accel=tcg 
    -serial mon:stdio 
    -nographic 
    -cpu arm1176 
    -m 256 
    -netdev 'type=tap,id=net1,ifname=tap101i1' 
    -device 'virtio-net-pci,mac=1A:E8:8F:FA:D7:5C,netdev=net1,id=net1' 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    提示qemu-system-arm: could not configure /dev/net/tun (tap101i1): Device or resource busy
    
    
    qemu-system-arm 
    -M versatilepb,accel=tcg 
    -serial mon:stdio 
    -nographic 
    -cpu arm1176 
    -m 256 
    -net user,hostfwd=tcp::5022-:22 
    -hda /root/raspbian/2020-02-13-raspbian-buster.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    提示:正常启动,2个服务没有启动 rng-tools.service   systemctl status systemd-modules-load.service  没有看到网络应该和systemd-modules-load没有启动有关系
    
    

    以上采用lite版本(没有gui)的img来启动,如下:

    qemu-system-arm 
    -M versatilepb,accel=tcg 
    -cpu arm1176 
    -nographic 
    -m 256 
    -hda /root/raspbian/2020-02-13-raspbian-buster-lite.img 
    -dtb /root/raspbian/versatile-pb-buster.dtb 
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster 
    -append 'root=/dev/sda2 panic=1' 
    -no-reboot
    发现只有一个服务rng-tools服务没有正常启动,其他服务正常,网络默认有个qemu nat网卡,可以正常解析域名的ip,说明可以正常上网,如何设定tap桥接网卡呢??
    

    systemctl status rng-tools.service如下:

    以上的netdev bridge配置参考proxmox原有的bridge的netdev配置:
    -netdev 'type=tap,id=net0,ifname=tap101i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on'
    -device 'virtio-net-pci,mac=C2:70:7B:D0:05:14,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'

    -netdev 'type=tap,id=net1,ifname=tap101i1,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on'
    -device 'virtio-net-pci,mac=1A:E8:8F:FA:D7:C5,netdev=net1,bus=pci.0,addr=0x13,id=net1,bootindex=301'
    目前不太理解其中vhost是什么意思??

    2、可以使用通过proxmox来模拟正常的raspbian x86系统,下载地址:
    http://downloads.raspberrypi.org/rpd_x86/images/

    raspbian x86系统的介绍:
    https://www.raspberrypi.org/downloads/raspberry-pi-desktop/

    参考:
    使用QEMU模拟树莓派Raspberry Pi 重点参考 https://cloud.tencent.com/developer/article/1685107
    使用QEMU扩展树莓派镜像增加剩余使用空间 https://blog.csdn.net/talkxin/article/details/81264605 这篇文章没有测试过
    x86下用qemu起不带GUI的虚拟机 https://blog.csdn.net/wujianyongw4/article/details/80169778

    raspbian登录pi raspberry
    qemu-system-arm -machine help可以查看支持的machine类型

    在proxmox中最新测试:
    qemu-system-arm
    -M versatilepb,accel=tcg
    -serial mon:stdio
    -nographic
    -cpu arm1176
    -m 256
    -netdev 'type=tap,id=net1,ifname=tapywh'
    -device 'virtio-net-pci,mac=1A:E8:8F:FA:D7:5C,netdev=net1,id=net1'
    -hda /root/raspbian/2020-02-13-raspbian-buster.img
    -dtb /root/raspbian/versatile-pb-buster.dtb
    -kernel /root/raspbian/kernel-qemu-4.19.50-buster
    -append 'root=/dev/sda2 panic=1'
    -no-reboot
    发现proxmox会自动增加tapywh,自动加入到vmbr0的bridge中,树莓派可以自动获取到ip地址。但还是存在2个服务没有启动。这里面涉及到qemu-kvm bridge的相关设定。

  • 相关阅读:
    批处理实现mysql的备份
    paper 8:支持向量机系列五:Numerical Optimization —— 简要介绍求解求解 SVM 的数值优化算法。
    paper 7:支持向量机系列四:Outliers —— 介绍支持向量机使用松弛变量处理 outliers 方法。
    paper 6:支持向量机系列三:Kernel —— 介绍核方法,并由此将支持向量机推广到非线性的情况。
    paper 5:支持向量机系列二: Support Vector —— 介绍支持向量机目标函数的 dual 优化推导,并得出“支持向量”的概念。
    paper 4:支持向量机系列一: Maximum Margin Classifier —— 支持向量机简介。
    paper 3:matlab中save,load使用方法小结
    paper 2:图像处理常用的Matlab函数汇总
    paper 1:图像特征提取
    学习用CMake来编写Qt程序
  • 原文地址:https://www.cnblogs.com/weihua2020/p/14004842.html
Copyright © 2011-2022 走看看