Updated to build excalibur
authorRalph Ronnquist <rrq@rrq.au>
Sun, 27 Apr 2025 22:23:21 +0000 (08:23 +1000)
committerRalph Ronnquist <rrq@rrq.au>
Sun, 27 Apr 2025 22:23:21 +0000 (08:23 +1000)
mkit.sh

diff --git a/mkit.sh b/mkit.sh
index 2fb62d0e5e20594bf7dff267ea2e4f2bbae05d12..c52cba285137ce3862b8f39abc0862e0cf356dc4 100755 (executable)
--- a/mkit.sh
+++ b/mkit.sh
@@ -16,11 +16,14 @@ MAPFILE=save/mapfile.txt
 DEPFILE=save/mapdepends.txt
 
 REPOS=(
-    deb.devuan.org/merged_daedalus_main
+    deb.devuan.org/merged_excalibur_main
     deb.devuan.org/merged_ceres_main
 )
 ARCH="amd64"
 MBR=dos # gpt
+# silly-links setup
+LIB=/usr/lib
+BIN=/usr/bin
 
 : > $MAPFILE
 : > $DEPFILE
@@ -167,11 +170,20 @@ fi
 echo "# Extract static busybox, and fluff it up for more utilities"
 mkdir -p initrd
 debextract initrd $(debfile busybox-static head)
-for L in $(initrd/bin/busybox --listfull) ; do
-    mkdir -p $(dirname initrd/$L)
+if [ "$BIN" = "/usr/bin" ] ; then
+    for D in bin sbin lib ; do
+       mkdir -p initrd/usr/$D
+       ln -s usr/$D initrd/$D
+    done
+else
+    for D in bin sbin lib ; do
+       mkdir -p initrd/$D initrd/usr/$D
+    done
+fi
+for L in $(initrd$BIN/busybox --listfull) ; do
     [ -e "initrd/$L" ] && continue
     case "$L" in
-       bin/busybox) : ;;
+       bin/busybox) [ -e initrd/$L ] || ln -s usr/$L initrd/$L ;;
        usr/*) ln -s ../../bin/busybox initrd/$L ;;
        sbin/*) ln -s ../bin/busybox initrd/$L ;;
        bin/*)  ln -s busybox initrd/$L ;;
@@ -213,22 +225,27 @@ MODULES=(
 MOODLES=""
 B=$(pwd)
 for m in ${MODULES[@]} ; do
-    km=$(find kernel/lib/modules -name $m.ko)
+    km=$(find kernel$LIB/modules -name "$m.ko*")
     if [ -z "$km" ] ; then
        echo "Missing module $m"
        continue
     fi
     im=initrd/${km#kernel/}
+    im=${im%.xz}
     MOODLES+=" $B/$im"
     mkdir -p $(dirname $im)
-    cp -n $km $im
+    if [ -z "${km##*xz}" ] ; then
+       xzcat $km > $im
+    else
+       cp -n $km $im
+    fi
 done
 V=${KERNEL#linux-image-}
-mkdir -p initrd/boot initrd/lib/modules/$V
+mkdir -p initrd/boot initrd$LIB/modules/$V
 cp kernel/boot/System.map-$V initrd/
-cp kernel/lib/modules/$V/modules.order initrd/lib/modules/$V/
-cp kernel/lib/modules/$V/modules.builtin initrd/lib/modules/$V/
-depmod -F initrd/System.map-$V -b initrd $V $MOODLES
+cp kernel$LIB/modules/$V/modules.order initrd$LIB/modules/$V/
+cp kernel$LIB/modules/$V/modules.builtin initrd$LIB/modules/$V/
+depmod -F initrd/System.map-$V -b initrd -o initrd $V 
 
 echo "# setup a scripted init. The kernel runs this via the #! interpreter"
 rm -f initrd/sbin/init # just in case