Compare commits

..

2 Commits

Author SHA1 Message Date
Eric-Paul Ickhorn 1c6e48c075 Added help output in the build.bash and made it a little more elaborate overall 2023-05-27 01:26:38 +02:00
Eric-Paul Ickhorn b08d77c16f Moved POSIX-UEFI to a more sensible location 2023-05-27 01:24:45 +02:00
25 changed files with 218 additions and 46 deletions

View File

@ -1,37 +1,116 @@
#!/bin/bash
echo "|==== Building the NightLoader with Build-Script v0.1 ====|"
echo "|================| NightLoader Build-Script v0.1 |================|"
echo " "
echo " "
BUILD_ROOT=$PWD
QUIET="FALSE"
VERBOSE="FALSE"
if [[ $2 == "-q" ]]; then
QUIET="TRUE"
fi
if [[ $3 == "-q" ]]; then
QUIET="TRUE"
fi
if [[ $4 == "-q" ]]; then
QUIET="TRUE"
fi
if [[ $5 == "-q" ]]; then
QUIET="TRUE"
fi
if [[ $2 == "-v" ]]; then
VERBOSE="TRUE"
fi
if [[ $3 == "-v" ]]; then
VERBOSE="TRUE"
fi
if [[ $4 == "-v" ]]; then
VERBOSE="TRUE"
fi
if [[ $5 == "-v" ]]; then
VERBOSE="TRUE"
fi
if [[ $QUIET == "TRUE" ]]; then
if [[ $VERBOSE == "TRUE" ]]; then
echo "ERROR: '-v' and 'q' cannot coexist!"
exit
fi
fi
log() {
if [[ $QUIET -eq "TRUE" ]]; then
return
fi
echo $1
}
# START OF ACTION FUNCTIONS
initialize_build_environment() {
cd $BUILD_ROOT/libs/original/posix-uefi
bash build.bash $BUILD_ROOT
}
clean_build_environment() {
echo "TODO: Clean Environment"
}
build_debug() {
# Legacy Bootloader for old BIOS-platforms
echo "STARTING TO BUILD LEGACY-BIOS LOADER!"
log "Building legacy-bootloader for target 'debug'"
# Build the stage-1 bootloader; the first disk-sector.
cd code/legacy-bios/bootsector
bash build.sh $1 $2
mv bootsector.bin ../../../
bash build.bash $BUILD_ROOT "debug"
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 ../../../
bash build.bash $BUILD_ROOT "debug"
cd ../../../
mv bootsector.bin build/objects/
mv starter.bin build/objects/
log "Legacy-bootloader was built for target 'debug'"
log " "
log " "
log " "
echo "FINISHED BUILDING LEGACY-BIOS LOADER"
echo " "
echo " "
echo " "
log "Building UEFI-bootloader for target 'debug'"
cd code/uefi/stage_2
bash build.bash $BUILD_ROOT "debug"
log "UEFI-bootloader was built for target 'debug'"
log " "
log " "
log " "
cd ../../../
echo "Creating disk image for a basic NightLoader-installation"
log "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.
@ -51,8 +130,101 @@ mv partition.bin build/objects/
cat build/objects/bootsector.bin > nightloader.bin
cat build/objects/partition.bin >> nightloader.bin
echo " "
echo " "
echo "Finished building the NightLoader!"
echo " "
log " "
log " "
log "Finished building the NightLoader!"
log " "
}
build_release() {
echo "TODO: Release-Build"
}
build_all() {
build_debug
build_release
}
print_help() {
echo "NightLoader Short Help for 'build.bash', for a more thorough help use '$0 manual'"
echo " "
echo "Available Commands are: 'all', 'clean', 'debug', 'help', 'init', 'manual' 'release'"
echo "| all: Initializes the environment (if needed) build all targets (debug & release)"
echo "| but does NOT clean up the environment's build-files, etc.. The version of"
echo "| the build is needed as an argument. See: Example [1]"
echo "|"
echo "| clean: Removes all cached files."
echo "|"
echo "| debug: Builds the 'debug'-target. The 'debug'-target has more information which"
echo "| is needed for contributing to the NightLoader. This shouldn't be used for"
echo "| actual usage as it bloats the executable size quite a bit."
echo "|"
echo "| init: Updates & Initializes the dependencies and performs a one-time setup."
echo "| There can be one argument which tells which dependency should be updated."
echo "| Possible values are:"
echo "| - 'posix-uefi': Clone and build POSIX-UEFI."
echo "| - 'all-depends': Update (download) and build all dependencies."
echo "| For further information, see: Examples [4] [5]"
echo "|"
echo "| manual: A longer manual to the NightLoader, referencing the documentation in the"
echo "| './docs/'-folder and making it interactive."
echo "| For further information, see: Examples [6] [7] [8] [9] [10]"
echo "|"
echo "| release: Builds the 'release'-target. This target should be used for building the"
echo "| optimized version of the NightLoader which can actually be suitable for"
echo "| using in, for example, a hobbyist's operating system. This requires the"
echo "| current version of the NightLoader as an argument. See: Example [11]"
echo " "
echo "Additional options:"
echo "| -q : Disable as much output as possible"
echo "| -v : Output as much as possible; will be passed to all sub-commands"
echo " "
echo "Examples:"
echo "[1] \$ $1 all v0.1.0"
echo "[2] \$ $1 clean"
echo "[3] \$ $1 debug v0.1.0"
echo "[4] \$ $1 init all-depends"
echo "[5] \$ $1 init posix-uefi"
echo "[6] \$ $1 manual"
echo "[7] \$ $1 manual interactive"
echo "[8] \$ $1 manual list"
echo "[9] \$ $1 manual bios"
echo "[10] \$ $1 manual uefi"
echo "[11] \$ $1 release v0.1.0"
echo "[12] \$ $1 help # You obviously alreay know this. ^^"
}
print_manual() {
echo "TODO: Print Manual"
}
# START OF ACTION CHOOSER
case $1 in
"all")
build_all "$0"
;;
"clean")
clean_build_environment "$0"
;;
"debug")
build_debug "$0"
;;
"help")
print_help "$0"
;;
"init")
initialize_build_environment "$0"
;;
"manual")
print_manual "$0"
;;
"release")
build_release "$0"
;;
esac