Jak nabootovat (a kde sehnat) ARM verzi Alpine linuxu v QEMU

Ahoj,
rad bych si zkusil nabootovat Alpine linux v ARM verzi v qemu. Dokonce proto mam i prakticke vyuziti.

Podarilo se mi takto spustit OpenWrt na Raspberry Pi 3. Dost me prekvapila rychlost, cekal jsem, ze to bude nepouzitelne pomale - bylo to jen pomale :-)
Jenze v OpenWrt  je malo aplikaci, ktere chci zkusit.

Po hodne dlouhem testovani jsem se dohrabal k tomuto temer funkcnimu postupu:
Kód: [Vybrat]
wget http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/armhf/alpine-uboot-3.7.0-armhf.tar.gz
wget http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/armhf/alpine-minirootfs-3.7.0-armhf.tar.gz

qemu-img create -f raw sd.img 512M

sudo losetup /dev/loop0 sd.img
sudo kpartx -av /dev/loop0
lsblk
sudo mkfs.ext3 /dev/mapper/loop0p1   # *musi byt ext3, s ext4 alpine nebootoval*
sudo mount -t ext3 /dev/mapper/loop0p1 /mnt

sudo cp alpine-minirootfs-3.7.0-armhf.tar.gz /mnt/
sudo cp alpine-uboot-3.7.0-armhf.tar.gz /mnt
cd /mnt/
sudo tar xzvf alpine-minirootfs-3.7.0-armhf.tar.gz
sudo tar xzvf alpine-uboot-3.7.0-armhf.tar.gz
sudo rm alpine-minirootfs-3.7.0-armhf.tar.gz
sudo rm alpine-uboot-3.7.0-armhf.tar.gz
cd ..
sudo umount /mnt
sudo kpartx -dv /dev/loop0
sudo losetup -d /dev/loop0

file sd.img
  #sd.img: DOS/MBR boot sector; partition 1 : ID=0x83, start-CHS (0x10,0,1), end-CHS (0x3ff,3,32), startsector 2048, 1046528 sectors

tar xzf alpine-uboot-3.7.0-armhf.tar.gz
cp {boot/dtbs/vexpress-v2p-ca9.dtb,boot/vmlinuz-hardened,boot/initramfs-hardened} .
rm alpine-*
ls
  #initramfs-hardened  sd.img  vexpress-v2p-ca9.dtb  vmlinuz-hardened

qemu-system-arm -sd sd.img -m 256 -M vexpress-a9 -dtb vexpress-v2p-ca9.dtb -kernel vmlinuz-hardened -initrd initramfs-hardened -append "modules=loop,squashfs,sd-mod,usb-storage,ext4 modloop=/boot/modloop-hardened root=/dev/mmcblk0p1 console=ttyAMA0" -net nic,vlan=0 -net nic,vlan=1 -net user,vlan=1 -localtime -nographic

Vytvorim si image, na ktery rozbalim uboot a alpine minirootfs. Cele to pak Qemu dam mistoSD karty.
Qemu bootuje, ale nakonec skonci na can't run '/sbin/openrc': No such file or directory.
openrc opravdu v alpine minirootfs neni. Jenze jiny alpine rootfs jsem nenasel. A ubuntu rootfs se mi zda zbytecny velky. Chtel bych alpine.

Takhle mi to bootuje podle prikazu vyse:
Kód: [Vybrat]
$ qemu-system-arm -sd sd.img -m 256 -M vexpress-a9 -dtb vexpress-v2p-ca9.dtb -kernel vmlinuz-hardened -initrd initramfs-hardened -append "modules=loop,squashfs,sd-mod,usb-storage,ext4 modloop=/boot/modloop-hardened root=/dev/mmcblk0p1 console=ttyAMA0" -net nic,vlan=0 -net nic,vlan=1 -net user,vlan=1 -localtime -nographic
WARNING: Image format was not specified for 'sd.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.
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
Warning: hub port hub1port0 has no peer
Warning: vlan 1 with no nics
Warning: vlan 0 is not connected to host network
Warning: netdev hub1port0 has no peer
Warning: requested NIC (anonymous, model unspecified) was not created (not supported by this machine?)
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.65-1-hardened (buildozer@build-3-7-armhf) (gcc version 6.4.0 (Alpine 6.4.0) ) #2-Alpine SMP Mon Nov 27 15:37:20 GMT 2017
[    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] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] Memory policy: Data cache writeback
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] percpu: Embedded 13 pages/cpu @8fd7a000 s23180 r8192 d21876 u53248
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 64960
[    0.000000] Kernel command line: modules=loop,squashfs,sd-mod,usb-storage,ext4 modloop=/boot/modloop-hardened root=/dev/mmcblk0p1 console=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: 14824(90%)
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 246072K/262144K available (4213K kernel code, 484K rwdata, 1828K rodata, 684K init, 349K bss, 16072K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0x90800000 - 0xff800000   (1776 MB)
[    0.000000]     lowmem  : 0x80000000 - 0x90000000   ( 256 MB)
[    0.000000]     pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)
[    0.000000]     modules : 0x7f000000 - 0x7fe00000   (  14 MB)
[    0.000000]       .text : 0x80208000 - 0x80625694   (4214 kB)
[    0.000000]       .init : 0x80819000 - 0x808c4000   ( 684 kB)
[    0.000000]       .data : 0x808c4000 - 0x8093d360   ( 485 kB)
[    0.000000]        .bss : 0x8093d360 - 0x80994b48   ( 350 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:16 nr_irqs:16 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 erratum 769419 enabled
[    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.000227] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.003212] clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[    0.003864] Failed to initialize '/smb@04000000/motherboard/iofpga@7,00000000/timer@12000': -22
[    0.010946] Console: colour dummy device 80x30
[    0.011478] Calibrating local timer... 99.85MHz.
[    0.038517] Calibrating delay loop... 557.87 BogoMIPS (lpj=1394688)
[    0.108468] pid_max: default: 32768 minimum: 501
[    0.110221] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.110280] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.122390] CPU: Testing write buffer coherency: ok
[    0.134004] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.134376] Setting up static identity map for 0x60208280 - 0x602082d8
[    0.146439] EFI services will not be available.
[    0.160708] Brought up 1 CPUs
[    0.160814] SMP: Total of 1 processors activated (557.87 BogoMIPS).
[    0.160884] CPU: All CPU(s) started in SVC mode.
[    0.169873] devtmpfs: initialized
[    0.187565] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
[    0.206146] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302231375000 ns
[    0.207067] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.211785] pinctrl core: initialized pinctrl subsystem
[    0.238600] NET: Registered protocol family 16
[    0.241186] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.337150] cpuidle: using governor ladder
[    0.337514] cpuidle: using governor menu
[    0.341187] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.348661] Serial: AMBA PL011 UART driver
[    0.370051] OF: amba_device_add() failed (-19) for /memory-controller@100e0000
[    0.372104] OF: amba_device_add() failed (-19) for /memory-controller@100e1000
[    0.373673] OF: amba_device_add() failed (-19) for /watchdog@100e5000
[    0.378764] irq: type mismatch, failed to map hwirq-75 for /interrupt-controller@1e001000!
[    0.409782] 10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 38, base_baud = 0) is a PL011 rev1
[    0.434354] console [ttyAMA0] enabled
[    0.438964] 1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 39, base_baud = 0) is a PL011 rev1
[    0.443405] 1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 40, base_baud = 0) is a PL011 rev1
[    0.448839] 1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 41, base_baud = 0) is a PL011 rev1
[    0.452569] OF: amba_device_add() failed (-19) for /smb@04000000/motherboard/iofpga@7,00000000/wdt@0f000
[    0.500530] vgaarb: loaded
[    0.502428] pps_core: LinuxPPS API ver. 1 registered
[    0.502847] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.503182] PTP clock support registered
[    0.519778] clocksource: Switched to clocksource arm,sp804
[    0.522082] VFS: Disk quotas dquot_6.6.0
[    0.525203] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.580731] NET: Registered protocol family 2
[    0.587827] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.588216] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[    0.588491] TCP: Hash tables configured (established 2048 bind 2048)
[    0.589505] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.589773] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.592578] NET: Registered protocol family 1
[    0.605647] Trying to unpack rootfs image as initramfs...
[    1.571713] Freeing initrd memory: 5468K
[    1.574860] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 1 counters available
[    1.588898] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    1.608414] Key type asymmetric registered
[    1.609835] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    1.610136] io scheduler noop registered
[    1.611135] io scheduler cfq registered (default)
[    1.630581] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    1.630887] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[    1.639833] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    1.646757] Serial: AMBA driver
[    1.650294] msm_serial: driver initialized
[    1.722237] brd: module loaded
[    1.725422] libphy: Fixed MDIO Bus: probed
[    1.735060] gre: GRE over IPv4 demultiplexor driver
[    1.736055] Key type dns_resolver registered
[    1.736443] ThumbEE CPU extension supported.
[    1.736649] Registering SWP/SWPB emulation handler
[    1.739734] registered taskstats version 1
[    1.741538] hctosys: unable to open rtc device (rtc0)
[    1.747603] uart-pl011 10009000.uart: no DMA platform data
[    1.763216] Freeing unused kernel memory: 684K
[    1.763706] This architecture does not have kernel memory protection.
Alpine Init 3.2.0-r0
 * Loading boot drivers: [    2.560176] loop: module loaded
[    2.571496] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    2.593130] SCSI subsystem initialized
[    2.624983] usbcore: registered new interface driver usbfs
[    2.625959] usbcore: registered new interface driver hub
[    2.628141] usbcore: registered new device driver usb
[    2.638821] usbcore: registered new interface driver usb-storage
ok.
 * Mounting root: [    4.796710] clcd-pl11x 10020000.clcd: PL111 designer 41 rev2 at 0x10020000
[    4.809537] clcd-pl11x 10020000.clcd: /clcd@10020000 hardware, 1024x768@59 display
[    4.820240] clcd-pl11x 1001f000.clcd: PL111 designer 41 rev2 at 0x1001f000
[    4.822244] clcd-pl11x 1001f000.clcd: /smb@04000000/motherboard/iofpga@7,00000000/clcd@1f000 hardware, 640x480@59 display
[    4.891303] mmci-pl18x 10005000.mmci: Got CD GPIO
[    4.891632] mmci-pl18x 10005000.mmci: Got WP GPIO
[    4.893618] mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 34,35 (pio)
[    4.894548] mmci-pl18x 10005000.mmci: DMA channels RX none, TX none
[    4.981191] mmc0: new SD card at address 4567
[    5.050007] mmcblk0: mmc0:4567 QEMU! 512 MiB
[    5.060632]  mmcblk0: p1
[   14.077287] Console: switching to mono frame buffer device 128x48
[   14.457299] random: fast init done
[   14.807981] random: crng init done
[   15.141032] EXT4-fs (mmcblk0p1): mounting ext3 file system using the ext4 subsystem
[   15.190897] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
ok.
can't run '/sbin/openrc': No such file or directory
can't run '/sbin/openrc': No such file or directory
can't run '/sbin/openrc': No such file or directory

Uz mi dosly vsechny napady :-(

A nereste prosim, jestli to ma vubec smysl, proste to chci zkusit.
Na tohle zlata x86. Tam bych dal "qemu -hda disk.img" a vse by fungovalo.

A k tomu jeste druha otazka: kdyz chci zkusit na ARM desce (treba raspberry, nebo orange) emulaci pomoci qemu, je lepsi emulovat na armu arm, nebo na armu emulovat x86? Nebo to je rychlostne jedno?
Osobne tipuji na armu arm, ale nemam proto zadny podlozeny duvod.
"Kdo v zájmu bezpečí obětuje část své svobody, v konečném důsledku přijde o svobodu i svou bezpečnost."