This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-iso.sh
executable file
·81 lines (61 loc) · 2.12 KB
/
build-iso.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
function setup_colors {
if test -t 1; then
ncolors=$(tput colors)
if test -n "$ncolors" -a $ncolors -ge 8; then
bold="$(tput bold)"
normal="$(tput sgr0)"
red="$(tput setaf 1)"
cyan="$(tput setaf 6)"
export error="${bold}${red}error${normal}:"
export status="${bold}${cyan}status${normal}:"
else
export error="error:"
export status="status:"
fi
else
export error="error:"
export status="status:"
fi
}
function error {
echo "$error $1" >&2
exit 1
}
function build_project {
echo "$status building PhantomOS initializer, kernel, modules, and userspace"
cargo build || error "cargo build failed"
export INIT_PATH=target/x86_64/debug/libphantomos_init.so
echo "$status PhantomOS successfully built"
}
function build_limine {
echo $status building Limine bootloader
git submodule update --init
test -d build-limine || mkdir build-limine
pushd build-limine > /dev/null
test -x ../limine/configure || ../limine/autogen.sh || error "limine autogen failed"
../limine/configure BUILD_ELTORITO_EFI=yes || error "limine configure failed"
E9_OUTPUT=1 make || error "limine build failed"
popd > /dev/null
echo $status Limine bootloader successfully built
}
function build_iso {
echo $status building ISO image
rm -rf build-iso
mkdir -p build-iso/boot
cp -v $INIT_PATH build-iso/phantomos.elf
cp -v limine-iso.cfg build-iso/limine.cfg
cp -v build-limine/bin/{limine-cd-efi.bin,limine-cd.bin,limine.sys} build-iso/boot/
xorriso -as mkisofs -b boot/limine-cd.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot boot/limine-cd-efi.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
build-iso -o phantomos.iso || error "ISO build failed"
build-limine/bin/limine-deploy phantomos.iso || error "limine deploy failed"
echo $status ISO image successfully built
}
pushd $(dirname $0) > /dev/null
setup_colors
build_project
build_limine
build_iso
popd > /dev/null