Subject: Issue with booting Alpine on an ARM SBC over the network

From: "Emmanuel Blot" <[email-masked]>
Date: Fri, 06 Sep 2019 16:02:00 +0200

Hi,

I’d like to boot an Orange Pi Zero SBC over the network (PXE-like 
boot)

I have first downloaded and successfully booted and used the ARM vanilla
image on the OPi0, including networking, from the MMC device, to ensure
a regular boot from a MMC card was Ok.

Next I have:

* installed uboot on OPi0 embedded SPI, and booted it up w/o any MMC
* installed and run a small bootp/dhcp/pxe/tftp/http server on a local 
host
   to allocate IP through DHCP and serve files to the OPi0 overt TFTP & 
HTTP.
* added the missing drivers to the initramfs file (namely: dwmac_sun8i,
   mdio_mux, stmmac_platform, stmmac and af_packet)
* built the uBoot-compatible initramfs file

I’m now able to boot up the Alpine vanilla kernel, that is
   vmlinuz + modified uinitrd + OPi0 DTB.

However, I do not see a way to provide Alpine Linux w/ a modloop file: 
even
if it could be (inefficiently) downloaded over TFTP, I did not find a 
way to
specify the modloop file as a preloaded RAM area.
 From https://wiki.alpinelinux.org/wiki/PXE_boot#HOWTO, it appears the 
proper
way is to serve it over HTTP. So far, so good.

Nevertheless, it seems that the modloop= kernel argument does nothing: 
it
does not trigger any attempt to download a file over HTTP.

To sum up, I have defined the boot environment as:

   dhcp ${kernel_addr_r} boot/vmlinuz-vanilla
   dhcp ${ramdisk_addr_r} boot/uinitramfs-vanilla-net
   dhcp ${fdt_addr_r} boot/dtbs/sun8i-h2-plus-orangepi-zero.dtb

   setenv bootargs "bootargs=earlyprintk
                    console=ttyS0,115200
                    modules=loop,dwmac-sun8i
                    ip=${ipaddr}::${gatewayip}:${netmask}:opi0:eth0:none
                    modloop=http://${serverip}:8000/boot/modloop-vanilla
                    apkovl=http://${serverip}:8000/alpine.apkovl.tar.gz"

   bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}

The TCP/IP stack and wget work as expected, as alpine.apkovl.tar.gz is
successfully downloaded (apkovl= argument).

However, no trace about the modloop… What did I miss? I did not find a
reference to this argument in the init script BTW.

These are the last lines of the boot sequence trace message:

  * Mounting boot media: [    2.920674] sunxi-mmc 1c0f000.mmc: Linked as 
a consumer to regulator.2
[    2.929237] sunxi-mmc 1c0f000.mmc: Got CD GPIO
[    2.957549] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 
16384 KB
[    2.965675] sunxi-mmc 1c10000.mmc: Linked as a consumer to 
regulator.4
[    2.973525] sunxi-mmc 1c10000.mmc: Dropping the link to regulator.4
ok.
  * Setting IP (eth0)...: [    8.428907] sunxi-mmc 1c10000.mmc: Linked 
as a consumer to regulator.4
[    8.437202] Generic PHY 0.1:01: attached PHY driver [Generic PHY] 
(mii_bus:phy_addr=0.1:01, irq=POLL)
[    8.437723] sunxi-mmc 1c10000.mmc: Dropping the link to regulator.4
[    8.456542] dwmac-sun8i 1c30000.ethernet eth0: No Safety Features 
support found
[    8.463882] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management 
Counters available
[    8.471591] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by 
HW
ok.
Connecting to 10.113.141.152:8000 (10.113.141.152:8000)
[   12.645254] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 
100Mbps/Full - flow control rx/tx
alpine.apkovl.tar.gz 100% |********************************|   611  
0:00:00 ETA
  * Loading user settings from /tmp/alpine.apkovl.tar.gz: ok.
  * Installing packages to root filesystem: OK: 0 MiB in 0 packages
ok.
grep: /sysroot/etc/inittab: No such file or directory
/sbin/init not found in new root. Launching emergency recovery shell
Type exit to continue boot.
sh: can't access tty; job control turned off
/ #

Thanks,
Emmanuel.
​