2021-02-03 15:21:21 +00:00
|
|
|
#!/bin/mksh
|
2021-01-30 07:29:13 +00:00
|
|
|
#
|
|
|
|
# Creates an ISO from the following built packages.
|
2021-02-03 15:21:21 +00:00
|
|
|
# mksh bmake gmake libressl cmake curl rsync linux flex
|
|
|
|
# byacc om4 zlib samurai libffi python ca-certificates
|
|
|
|
# zlib expat gettext-tiny git kati netbsd-curses kakoune
|
2021-02-03 22:06:18 +00:00
|
|
|
# lazybox llvm musl
|
2021-01-30 07:29:13 +00:00
|
|
|
#
|
|
|
|
# This should be enough to completely rebuild LazyBox from Source
|
|
|
|
#
|
|
|
|
|
|
|
|
# Create the root fs dir
|
|
|
|
mkdir isoroot
|
|
|
|
mkdir isoout
|
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
mkdir diskroot
|
|
|
|
|
|
|
|
cp_packages (){
|
2021-02-03 15:21:21 +00:00
|
|
|
#NOTE: this will assume that there always is a '*-dev'/'*-doc' package,\n this is not true.
|
|
|
|
# That's why the errors are shown to some one who cares.
|
|
|
|
for pkg in ${packages[@]}
|
|
|
|
do
|
2021-02-04 12:02:44 +00:00
|
|
|
echo "Going to copy: $pkg to $1"
|
|
|
|
tar -xf pkgs/${pkg}/out/${pkg}.*.tar.xz -C $1
|
|
|
|
tar -xf pkgs/${pkg}/out/${pkg}-dev.*.tar.xz -C $1 2> /dev/null
|
|
|
|
tar -xf pkgs/${pkg}/out/${pkg}-doc.*.tar.xz -C $1 2> /dev/null
|
2021-02-03 15:21:21 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
#packages=(musl mksh bmake gmake libressl cmake curl rsync linux flex byacc om4 zlib samurai libffi python ca-certificates zlib expat gettext-tiny git kati netbsd-curses kakoune lazybox)
|
|
|
|
packages=(musl linux mksh busybox toybox lazybox)
|
|
|
|
cp_packages ./isoroot
|
2021-01-30 07:29:13 +00:00
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
#packages=(musl mksh busybox toybox llvm bmake gmake libressl cmake curl rsync linux flex byacc om4 zlib samurai libffi python ca-certificates zlib expat gettext-tiny git kati netbsd-curses kakoune lazybox rust less heirloom-doctools file pci-ids)
|
|
|
|
#cp_packages ./diskroot
|
2021-01-30 07:29:13 +00:00
|
|
|
|
|
|
|
cat >isoroot/init << EOF
|
|
|
|
#!/bin/sh
|
|
|
|
exec /sbin/init
|
|
|
|
EOF
|
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
rm isoroot/sbin/init
|
|
|
|
cat >isoroot/sbin/init << EOF
|
2021-01-30 07:29:13 +00:00
|
|
|
#!/bin/sh
|
2021-02-04 12:02:44 +00:00
|
|
|
|
2021-01-30 07:29:13 +00:00
|
|
|
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
mkdir /proc
|
|
|
|
mkdir /sys
|
|
|
|
mkdir /tmp
|
|
|
|
mount -t proc proc /proc
|
|
|
|
mount -t sysfs sysfs /sys
|
|
|
|
mount -t tmpfs tmpfs /tmp
|
|
|
|
|
|
|
|
busybox mdev -s
|
|
|
|
busybox mdev -d
|
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
exec /bin/sh
|
|
|
|
|
|
|
|
mkdir /mnt
|
|
|
|
|
|
|
|
# while not mount $(blkid -L LAZYBOX_BS_MEDIA) /mnt; do
|
|
|
|
# echo "Failed to mount boot disk"
|
|
|
|
# echo "Retrying"
|
|
|
|
# sleep 0.5
|
|
|
|
# done
|
2021-01-30 07:29:13 +00:00
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
exec switch_root /mnt
|
2021-01-30 07:29:13 +00:00
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
EOF
|
2021-01-30 07:29:13 +00:00
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
chmod +x isoroot/init
|
|
|
|
chmod +x isoroot/sbin/init
|
2021-01-30 07:29:13 +00:00
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
# mkdir -p isoroot/etc/init.d/
|
2021-01-30 07:29:13 +00:00
|
|
|
|
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
# cat >isoroot/etc/init.d/rcS << EOF
|
|
|
|
# #!/bin/sh
|
|
|
|
# export PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
# mkdir /proc
|
|
|
|
# mkdir /sys
|
|
|
|
# mkdir /tmp
|
|
|
|
# mount -t proc proc /proc
|
|
|
|
# mount -t sysfs sysfs /sys
|
|
|
|
# mount -t tmpfs tmpfs /tmp
|
2021-01-30 07:29:13 +00:00
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
# echo 0 > /proc/sys/kernel/printk
|
|
|
|
|
|
|
|
# ln -s /proc/self/fd/0 /dev/stdin
|
|
|
|
# ln -s /proc/self/fd/1 /dev/stdout
|
|
|
|
# ln -s /proc/self/fd/2 /dev/stderr
|
|
|
|
|
|
|
|
# busybox mdev -s
|
|
|
|
# busybox mdev -d
|
|
|
|
|
|
|
|
# mkdir -p /dev/pts
|
|
|
|
# mount -t devpts devpts /dev/pts
|
|
|
|
|
|
|
|
# hostname -F /etc/hostname
|
|
|
|
|
|
|
|
# mount -a
|
|
|
|
|
|
|
|
# #busybox modprobe broadcom
|
|
|
|
# #busybox modprobe tg3
|
|
|
|
# #ifconfig eth0 192.168.2.16
|
|
|
|
# #busybox route add default gw 192.168.2.1
|
|
|
|
# #busybox modprobe radeon
|
|
|
|
|
|
|
|
# #busybox telnetd
|
|
|
|
|
|
|
|
# #clear
|
|
|
|
|
|
|
|
# EOF
|
|
|
|
# chmod +x isoroot/etc/init.d/rcS
|
|
|
|
|
|
|
|
# cp /etc/inittab isoroot/etc/
|
2021-01-30 07:29:13 +00:00
|
|
|
|
|
|
|
cd isoroot
|
|
|
|
find . | cpio -ov | gzip -9 >../isoout/initramfs.img
|
|
|
|
cp boot/vmlinuz ../isoout/vmlinuz
|
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
# cd ../isoout
|
|
|
|
# mkdir -p EFI/BOOT
|
|
|
|
# cp ~/Shell.efi EFI/BOOT/BOOTX64.EFI
|
2021-01-30 07:29:13 +00:00
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
# cat >startup.nsh << EOF
|
|
|
|
# \vmlinuz initrd=\initramfs.img console=ttyS0 console=tty0
|
2021-01-30 07:29:13 +00:00
|
|
|
|
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
# EOF
|
2021-01-30 07:29:13 +00:00
|
|
|
|
|
|
|
exit
|
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
dd if=/dev/zero of=lazybox.img count=524288
|
|
|
|
fdisk lazybox.img
|
|
|
|
|
|
|
|
#losetup -o 32256 /dev/loop0 lazybox.img
|
2021-01-30 07:29:13 +00:00
|
|
|
mount /dev/loop0 ./isoroot
|
|
|
|
rm -r isoroot/*
|
|
|
|
cp -r isoout/* isoroot
|
|
|
|
umount ./isoroot
|