mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
scripts,Makefile: add creation of bootable disk images
Add support for creating bootable media for use with USB or HDD boot. Also add support for running the generated media in QEMU.
This commit is contained in:
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
if [ $# != 3 ]
|
||||
then
|
||||
echo "usage: $0 size diskname"
|
||||
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="$PWD/$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" {} ::{} \;
|
||||
Reference in New Issue
Block a user