Skip to content

Instantly share code, notes, and snippets.

@tuxmartin
Last active September 8, 2023 08:38
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save tuxmartin/f348d4247beda04e6029366da494f164 to your computer and use it in GitHub Desktop.
Save tuxmartin/f348d4247beda04e6029366da494f164 to your computer and use it in GitHub Desktop.
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.ext4 /dev/mapper/loop0p1
mount -t ext4 /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
sudo 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
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
rm alpine-*
ls
#alpine.apkovl.tar.gz apks boot extlinux sd.img u-boot
qemu-system-arm -sd sd.img -m 256 -M vexpress-a9 -dtb boot/dtbs/vexpress-v2p-ca9.dtb -kernel boot/vmlinuz-hardened -initrd boot/initramfs-hardened -append "modules=loop,squashfs,sd-mod,usb-storage,ext4 modloop=/boot/modloop-hardened root=/dev/mmcblk0 console=ttyAMA0" -nographic
martin@martin:~/lede$ qemu-system-arm -sd sd.img -m 256 -M vexpress-a9 -dtb boot/dtbs/vexpress-v2p-ca9.dtb -kernel boot/vmlinuz-hardened -initrd boot/initramfs-hardened -append "modules=loop,squashfs,sd-mod,usb-storage,ext4 modloop=/boot/modloop-hardened root=/dev/mmcblk0 console=ttyAMA0" -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
[ 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/mmcblk0 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: 14828(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.000230] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.003377] clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[ 0.004027] Failed to initialize '/smb@04000000/motherboard/iofpga@7,00000000/timer@12000': -22
[ 0.011244] Console: colour dummy device 80x30
[ 0.011773] Calibrating local timer... 100.74MHz.
[ 0.039056] Calibrating delay loop... 557.87 BogoMIPS (lpj=1394688)
[ 0.074036] pid_max: default: 32768 minimum: 501
[ 0.075833] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.075891] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.089781] CPU: Testing write buffer coherency: ok
[ 0.101231] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.101598] Setting up static identity map for 0x60208280 - 0x602082d8
[ 0.114941] EFI services will not be available.
[ 0.129741] Brought up 1 CPUs
[ 0.129851] SMP: Total of 1 processors activated (557.87 BogoMIPS).
[ 0.129924] CPU: All CPU(s) started in SVC mode.
[ 0.138952] devtmpfs: initialized
[ 0.159007] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
[ 0.178134] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302231375000 ns
[ 0.179111] futex hash table entries: 1024 (order: 4, 65536 bytes)
[ 0.183681] pinctrl core: initialized pinctrl subsystem
[ 0.213912] NET: Registered protocol family 16
[ 0.216791] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.293602] cpuidle: using governor ladder
[ 0.293743] cpuidle: using governor menu
[ 0.294731] hw-breakpoint: debug architecture 0x4 unsupported.
[ 0.297406] Serial: AMBA PL011 UART driver
[ 0.305487] OF: amba_device_add() failed (-19) for /memory-controller@100e0000
[ 0.306663] OF: amba_device_add() failed (-19) for /memory-controller@100e1000
[ 0.307140] OF: amba_device_add() failed (-19) for /watchdog@100e5000
[ 0.309168] irq: type mismatch, failed to map hwirq-75 for /interrupt-controller@1e001000!
[ 0.322932] 10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 38, base_baud = 0) is a PL011 rev1
[ 0.340336] console [ttyAMA0] enabled
[ 0.345476] 1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 39, base_baud = 0) is a PL011 rev1
[ 0.349335] 1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 40, base_baud = 0) is a PL011 rev1
[ 0.354952] 1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 41, base_baud = 0) is a PL011 rev1
[ 0.358275] OF: amba_device_add() failed (-19) for /smb@04000000/motherboard/iofpga@7,00000000/wdt@0f000
[ 0.406155] vgaarb: loaded
[ 0.408464] pps_core: LinuxPPS API ver. 1 registered
[ 0.408702] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.409146] PTP clock support registered
[ 0.429862] clocksource: Switched to clocksource arm,sp804
[ 0.434498] VFS: Disk quotas dquot_6.6.0
[ 0.435045] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.496930] NET: Registered protocol family 2
[ 0.505223] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.505642] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.506038] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.506939] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.507345] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.511104] NET: Registered protocol family 1
[ 0.518669] Trying to unpack rootfs image as initramfs...
[ 1.561867] Freeing initrd memory: 5468K
[ 1.565170] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 1 counters available
[ 1.582019] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[ 1.601368] Key type asymmetric registered
[ 1.601927] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 1.602203] io scheduler noop registered
[ 1.603007] io scheduler cfq registered (default)
[ 1.622258] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[ 1.622763] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[ 1.632049] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 1.638411] Serial: AMBA driver
[ 1.640074] msm_serial: driver initialized
[ 1.716959] brd: module loaded
[ 1.719889] libphy: Fixed MDIO Bus: probed
[ 1.729984] gre: GRE over IPv4 demultiplexor driver
[ 1.731043] Key type dns_resolver registered
[ 1.731397] ThumbEE CPU extension supported.
[ 1.731604] Registering SWP/SWPB emulation handler
[ 1.734487] registered taskstats version 1
[ 1.736373] hctosys: unable to open rtc device (rtc0)
[ 1.741289] uart-pl011 10009000.uart: no DMA platform data
[ 1.755620] Freeing unused kernel memory: 684K
[ 1.755898] This architecture does not have kernel memory protection.
Alpine Init 3.2.0-r0
* Loading boot drivers: [ 2.461387] loop: module loaded
[ 2.471253] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 2.502950] SCSI subsystem initialized
[ 2.533771] usbcore: registered new interface driver usbfs
[ 2.535033] usbcore: registered new interface driver hub
[ 2.536868] usbcore: registered new device driver usb
[ 2.545949] usbcore: registered new interface driver usb-storage
ok.
* Mounting root: [ 4.303452] clcd-pl11x 10020000.clcd: PL111 designer 41 rev2 at 0x10020000
[ 4.325440] clcd-pl11x 10020000.clcd: /clcd@10020000 hardware, 1024x768@59 display
[ 4.333813] clcd-pl11x 1001f000.clcd: PL111 designer 41 rev2 at 0x1001f000
[ 4.341721] clcd-pl11x 1001f000.clcd: /smb@04000000/motherboard/iofpga@7,00000000/clcd@1f000 hardware, 640x480@59 display
[ 4.428195] mmci-pl18x 10005000.mmci: Got CD GPIO
[ 4.428529] mmci-pl18x 10005000.mmci: Got WP GPIO
[ 4.436042] mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 34,35 (pio)
[ 4.436384] mmci-pl18x 10005000.mmci: DMA channels RX none, TX none
[ 4.498974] mmc0: new SD card at address 4567
[ 4.554596] mmcblk0: mmc0:4567 QEMU! 512 MiB
[ 4.575282] mmcblk0: p1
[ 14.121155] Console: switching to mono frame buffer device 128x48
[ 14.592219] random: fast init done
[ 15.005071] random: crng init done
mount: mounting /dev/mmcblk0 on /sysroot failed: Invalid argument
failed.
initramfs emergency recovery shell launched. Type 'exit' to continue boot
sh: can't access tty; job control turned off
/ #
@ambiamber
Copy link

I got here while doing Google searches so I guess other people will too.
Here's a script to create a 32-bit Alpine armv7 VM that works:
https://gist.github.com/ambiamber/4e70be9ae0c7ecbbdbd7880b36db59ca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment