2023-05-26 19:24:50 +00:00
|
|
|
#!/bin/bash
|
2023-04-24 20:00:51 +00:00
|
|
|
|
2023-05-26 19:24:50 +00:00
|
|
|
echo "|==== Building the NightLoader with Build-Script v0.1 ====|"
|
|
|
|
echo " "
|
2023-04-24 20:00:51 +00:00
|
|
|
|
|
|
|
|
2023-05-26 19:24:50 +00:00
|
|
|
|
|
|
|
# Legacy Bootloader for old BIOS-platforms
|
|
|
|
echo "STARTING TO BUILD LEGACY-BIOS LOADER!"
|
|
|
|
|
|
|
|
# Build the stage-1 bootloader; the first disk-sector.
|
|
|
|
cd code/legacy-bios/bootsector
|
|
|
|
bash build.sh $1 $2
|
|
|
|
mv bootsector.bin ../../../
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Build the stage 2 - starter; it is just there to jump
|
|
|
|
# to the *executable file* which the UEFI-codepath also uses.
|
|
|
|
cd starter
|
|
|
|
bash build.sh $1 $2
|
|
|
|
mv starter.bin ../../../
|
|
|
|
cd ../../../
|
|
|
|
|
|
|
|
mv bootsector.bin build/objects/
|
|
|
|
mv starter.bin build/objects/
|
|
|
|
|
|
|
|
echo "FINISHED BUILDING LEGACY-BIOS LOADER"
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Creating disk image for a basic NightLoader-installation"
|
|
|
|
|
|
|
|
# Create the partition's image-file by allocating 256MB and
|
|
|
|
# creating a FAT32 - partition which then resides there.
|
|
|
|
truncate -s 256M partition.bin
|
|
|
|
mkfs.fat -F32 -nNIGHT partition.bin
|
|
|
|
|
|
|
|
# Mount the partition-image to a specific directory (needs
|
|
|
|
# root-permissions), copy over the freshly built binaries to
|
|
|
|
# the path they belobng to and unmount the partition.
|
|
|
|
mount partition.bin partition/
|
|
|
|
mkdir -p partition/nightloader/
|
|
|
|
cp starter.bin partition/
|
|
|
|
umount partition.bin
|
|
|
|
mv partition.bin build/objects/
|
|
|
|
|
|
|
|
# Create a disk image by including the first disk sector.
|
|
|
|
cat build/objects/bootsector.bin > nightloader.bin
|
|
|
|
cat build/objects/partition.bin >> nightloader.bin
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
echo "Finished building the NightLoader!"
|
|
|
|
echo " "
|
|
|
|
|