2021-06-04 15:57:45 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# shellcheck disable=SC1091
|
|
|
|
. ./init_functions.sh
|
2023-05-30 06:57:23 +00:00
|
|
|
. /usr/share/misc/source_deviceinfo
|
2021-06-04 15:57:45 +00:00
|
|
|
NBD_PORT=9999
|
2022-02-01 17:55:28 +00:00
|
|
|
NBD_BLOCK_SIZE=${deviceinfo_rootfs_image_sector_size:-512}
|
2021-06-04 15:57:45 +00:00
|
|
|
|
|
|
|
setup_usb_network
|
|
|
|
start_unudhcpd
|
|
|
|
|
2022-01-24 00:34:07 +00:00
|
|
|
show_splash "Waiting for netboot...\\nhttps://postmarketos.org/netboot"
|
2021-06-04 15:57:45 +00:00
|
|
|
|
|
|
|
# Attempt to load the kernel module if CONFIG_BLK_DEV_NBD=m
|
|
|
|
modprobe nbd
|
|
|
|
|
|
|
|
# Check that we actually have nbd0 available, otherwise show an error screen.
|
|
|
|
if [ ! -b /dev/nbd0 ]; then
|
|
|
|
echo "Failed to get /dev/nbd0, stopping."
|
2022-01-24 00:34:07 +00:00
|
|
|
show_splash "ERROR: Failed to initialise netboot\\nhttps://postmarketos.org/netboot"
|
2023-12-18 22:48:14 +00:00
|
|
|
fail_halt_boot
|
2021-06-04 15:57:45 +00:00
|
|
|
fi
|
|
|
|
|
2023-08-26 15:17:52 +00:00
|
|
|
client_ip="${unudhcpd_client_ip:-172.16.42.2}"
|
|
|
|
|
|
|
|
while ! busybox nbd-client "$client_ip" $NBD_PORT /dev/nbd0 -b "$NBD_BLOCK_SIZE"; do
|
2021-06-04 15:57:45 +00:00
|
|
|
echo "Connection attempt not successful, continuing..."
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
2023-08-26 15:17:52 +00:00
|
|
|
echo "Connected to $client_ip!"
|
2021-06-04 15:57:45 +00:00
|
|
|
|
2023-06-30 17:08:32 +00:00
|
|
|
# Show "Loading" splash again when continuing
|
|
|
|
show_splash "Loading..."
|
|
|
|
|
2021-06-04 15:57:45 +00:00
|
|
|
mount_subpartitions
|