Last active
October 3, 2023 22:49
-
-
Save ignisf/9273360 to your computer and use it in GitHub Desktop.
FreeBSD kernel, rootfs generation script (useful for running freebsd on qumu with MALTA emulation)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -e | |
| export TARGET=mips | |
| export TARGET_ARCH=mips | |
| export KERNCONF=MALTA | |
| export DESTDIR=/nfsroot/$TARGET.$TARGET_ARCH | |
| export KERNDIR=/tftpboot/$TARGET.$TARGET_ARCH | |
| export IMAGEDIR=/images | |
| export WERROR= | |
| export NO_CLEAN=yes | |
| make -C /usr/src buildworld buildkernel | |
| mkdir -p $DESTDIR | |
| mkdir -p $KERNDIR | |
| mkdir -p $IMAGEDIR | |
| make -C /usr/src installworld installkernel distribution | |
| echo "/dev/ada0 / ffs rw 0 1" > $DESTDIR/etc/fstab | |
| echo 'hostname="malta.local"' > $DESTDIR/etc/rc.conf | |
| rm -f $KERNDIR/$KERNCONF | |
| ln -s $DESTDIR/boot/kernel $KERNDIR/$KERNCONF | |
| rm -f $IMAGEDIR/FreeBSD-$KERNCONF.$TARGET.$TARGET_ARCH.kernel | |
| ln -s $KERNDIR/$KERNCONF/kernel $IMAGEDIR/FreeBSD-$KERNCONF.$TARGET.$TARGET_ARCH.kernel | |
| portsnap -d $DESTDIR/var/db/portsnap -p $DESTDIR/usr/ports fetch | |
| if [ ! -d $DESTDIR/usr/ports ]; then | |
| portsnap -d $DESTDIR/var/db/portsnap -p $DESTDIR/usr/ports extract | |
| else | |
| portsnap -d $DESTDIR/var/db/portsnap -p $DESTDIR/usr/ports update | |
| fi | |
| rm -f $IMAGEDIR/FreeBSD-$TARGET.$TARGET_ARCH.rootfs | |
| makefs -t ffs -B be -b 50% -f 50% $IMAGEDIR/FreeBSD-$TARGET.$TARGET_ARCH.rootfs $DESTDIR |
Author
I am sorry @cyberkulebyaka but this is from a different lifetime for me, I literally have no idea what was going on whenever I created this gist. I'd suggest asking in the FreeBSD mailing lists regarding this one, sorry :(
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, can u help?
I try repeat, but when i start qemu-system-mips got error:
I just try run with -append "nokaslr" and without it... For build i use FreeBSD release/13.1 source code