-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathgenbootimg.sh
More file actions
executable file
·44 lines (35 loc) · 862 Bytes
/
genbootimg.sh
File metadata and controls
executable file
·44 lines (35 loc) · 862 Bytes
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
#!/usr/bin/bash
if [ $# != 3 ]
then
echo "usage: $0 size diskname imgdir"
exit 1
fi
if [ -z $1 ]
then
echo "please pass a non empty size"
exit 1
fi
if [ -z $2 ]
then
echo "please pass a non empty disk name"
exit 1
fi
if [ -z $3 ]
then
echo "please pass a non empty imgdir"
exit 1
fi
# most of the below shamelessly stolen from
# https://github.com/limine-bootloader/limine-c-template/blob/trunk/GNUmakefile
# at commit 7310a9b098731cbd4242ed82f5c9b9c60ae14919
rm -f "$2"
truncate -s "$1" "$2"
sgdisk "$2" -n 1:2048 -t 1:ef00
host-pkgs/limine/usr/local/bin/limine bios-install "$2"
mformat -i "$2@@1M"
mmd -i "$2@@1M" ::/EFI ::/EFI/BOOT ::/boot ::/boot/limine
img="$2"
cd "$3"
#find . -type d -exec mmd -i "$img@@1M" ::{} \;
# FIXME ^^^ breaks, but there's no dirs yet, so it doesn't matter :P
find . -type f -exec mcopy -i "$img@@1M" {} ::{} \;