-
Notifications
You must be signed in to change notification settings - Fork 1
/
mkiso.sh
executable file
·45 lines (45 loc) · 1.57 KB
/
mkiso.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh -e
#
# http://github.com/bonsai-linux/tools
#
# create a ramfs iso of our rootfs
#
# Requires: bonsai-{core,kernel,init,bpm}, syslinux, dash
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
# functions
msg() { printf "%s\n" "→ $*" ; }
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
# config
root=~/.local/bonsai
builddir="$PWD"/build
bonsai=$root/src/bonsai
rm -r "${builddir:?}" 2>/dev/null ||: ; mkdir -p "$builddir"
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
msg 'relinking world...'
$bonsai --relink-world --chroot
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
msg 'zipping up the root file system...'
cd "$root"
find . | cpio -R root:root -H newc -o | gzip > "$builddir"/rootfs.gz
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
msg 'copying kernel image...'
cd "$builddir"
cp -f "$root"/src/pkgs/bonsai-kernel/vmlinuz ./kernel.gz
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
msg 'copying bootloader...'
cp -f "$root"/src/pkgs/syslinux/isolinux.bin ./isolinux.bin
cp -f "$root"/src/pkgs/syslinux/ldlinux.c32 ./ldlinux.c32
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
msg 'creating syslinux config...'
echo 'default kernel.gz initrd=rootfs.gz' > isolinux.cfg
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
msg 'creating iso...'
xorriso \
-as mkisofs \
-o "$builddir"/bonsai.iso \
-b isolinux.bin \
-c boot.cat \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table .
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*