Add Ti(ny) Lo(ader) build script
All checks were successful
build ipxe / make ipxe (push) Successful in 5m3s
All checks were successful
build ipxe / make ipxe (push) Successful in 5m3s
This commit is contained in:
parent
cb861565a0
commit
f041247eef
69
tilo/build.sh
Executable file
69
tilo/build.sh
Executable file
@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
|
||||
#get latest non patch release candidate kernel and busybox version
|
||||
busybox_latest="$(curl -s "https://api.github.com/repos/mirror/busybox/tags" | jq -r '.[0].name' | tr "_" ".")"
|
||||
kernel_latest="$(curl -s "https://api.github.com/repos/torvalds/linux/tags" | jq -r '.[] .name' | awk '$0 !~/-/' | head -n1 | cut -c2-4)"
|
||||
|
||||
#backups for when hitting ratelimits during testing :)
|
||||
#kernel_latest="6.7"
|
||||
#busybox_latest="1.36.0"
|
||||
|
||||
echo "Using kernel version: $kernel_latest"
|
||||
echo "Using busybox version: $busybox_latest"
|
||||
|
||||
kernel_major="$(echo "$kernel_latest" | cut -c1)"
|
||||
kernel_url="https://mirrors.edge.kernel.org/pub/linux/kernel/v$kernel_major.x"
|
||||
|
||||
mkdir -p src
|
||||
cd src
|
||||
|
||||
wget "$kernel_url/linux-$kernel_latest.tar.xz"
|
||||
tar -xf linux-$kernel_latest.tar.xz
|
||||
cd linux-$kernel_latest
|
||||
make defconfig
|
||||
make -j 8 || exit
|
||||
|
||||
cd ..
|
||||
|
||||
wget https://busybox.net/downloads/busybox-$busybox_latest.tar.bz2
|
||||
tar -xf busybox-$busybox_latest.tar.bz2
|
||||
cd busybox-$busybox_latest
|
||||
make defconfig
|
||||
sed 's/^.*CONFIG_STATIC[^_].*$/CONFIG_STATIC=y/g' -i .config
|
||||
make -j$(nproc) || exit
|
||||
cd ..
|
||||
|
||||
cd ..
|
||||
|
||||
cp src/linux-$kernel_latest/arch/x86/boot/bzImage ./
|
||||
|
||||
mkdir initrd
|
||||
cd initrd
|
||||
|
||||
mkdir -p bin dev proc sys
|
||||
cd bin
|
||||
cp ../../src/busybox-$busybox_latest/busybox ./
|
||||
for prog in $(./busybox --list); do
|
||||
ln -s /bin/busybox ./$prog
|
||||
done
|
||||
|
||||
cd ..
|
||||
|
||||
echo '#!/bin/sh' > init
|
||||
echo 'mount -t sysfs sysfs /sys' >> init
|
||||
echo 'mount -t proc proc /proc' >> init
|
||||
echo 'mount -t devtmpfs udev /dev' >> init
|
||||
echo 'sysctl -w kernel.printk="2 4 1 7"' >> init
|
||||
echo 'clear' >> init
|
||||
#todo: recompile to check if this fixes ctrl +c issues
|
||||
echo '::respawn:-/bin/sh' >> init
|
||||
#echo '/bin/sh' >> init
|
||||
|
||||
chmod -R 777 .
|
||||
|
||||
find . | cpio -o -H newc > ../initrd.img
|
||||
|
||||
cd ..
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user