postmarketos-mkinitfs-hook-netboot: new aport (MR 2222)

Co-authored-by: Luca Weiss <luca@z3ntu.xyz>
This commit is contained in:
Mark Hargreaves 2021-06-04 18:57:45 +03:00 committed by Luca Weiss
parent 98bf52af8b
commit ac23869e4c
No known key found for this signature in database
GPG key ID: 72D843B89D4DD756
4 changed files with 58 additions and 0 deletions

View file

@ -21,6 +21,7 @@ sh_files="
./main/postmarketos-mkinitfs/init.sh
./main/postmarketos-mkinitfs/init_functions.sh
./main/postmarketos-mkinitfs-hook-debug-shell/20-debug-shell.sh
./main/postmarketos-mkinitfs-hook-netboot/netboot.sh
./main/postmarketos-update-kernel/update-kernel.sh
./main/swclock-offset/swclock-offset-boot.sh
./main/swclock-offset/swclock-offset-shutdown.sh

View file

@ -0,0 +1,26 @@
# Maintainer: Mark <clashclanacc2602@gmail.com>
pkgname=postmarketos-mkinitfs-hook-netboot
pkgver=1
pkgrel=0
pkgdesc="Netboot postmarketOS using nbd feature"
url="https://postmarketos.org"
depends="postmarketos-mkinitfs"
source="
netboot.sh
netboot.modules
"
arch="noarch"
license="GPL-2.0-or-later"
options="!check" # No tests
package() {
install -Dm644 "$srcdir"/netboot.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/netboot.sh
install -Dm644 "$srcdir"/netboot.modules \
"$pkgdir"/etc/postmarketos-mkinitfs/modules/30-netboot.modules
}
sha512sums="
9f302b5fb13966d1e6bd9445fe0cf12a2e4fc7e0db50837f3b772628d46df6bec70da00dec3c4ce6b33075e1f906c02f5b796ac521c609b082d2fe9a523fb6cb netboot.sh
3c9c812a6cd25640e6cf4d722cff6c6356d5666ec6009b4c65f89e62211cc406d2cd09e0fdda6b1c1906ee32c3854988ab701cee8811208e3ef666f09e638568 netboot.modules
"

View file

@ -0,0 +1 @@
nbd

View file

@ -0,0 +1,30 @@
#!/bin/sh
# shellcheck disable=SC1091
. /etc/deviceinfo
. ./init_functions.sh
NBD_PORT=9999
NBD_IP=172.16.42.2
setup_usb_network
start_unudhcpd
show_splash /splash-netboot-waiting.ppm.gz
# 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."
show_splash /splash-netboot-error.ppm.gz
pmos_loop_forever
fi
while ! busybox nbd-client $NBD_IP $NBD_PORT /dev/nbd0 -b 512; do
echo "Connection attempt not successful, continuing..."
sleep 1
done
echo "Connected to $NBD_IP!"
mount_subpartitions