Changed to using Boch to better handle debugging the kernel. Updated build system with a new script to handle working with the build_numbers.c file.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
megs: 32
|
||||
display_library: x
|
||||
romimage: file=/usr/share/bochs/BIOS-bochs-latest
|
||||
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
|
||||
ata0-master: type=cdrom, path=kernel.iso, status=inserted
|
||||
boot: cdrom
|
||||
log: bochs.log
|
||||
clock: sync=realtime, time0=local
|
||||
cpu: count=1, ips=1000000
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
#Following the the spec set here https://semver.org/ (2.0.0)
|
||||
#we have three parts to a version number:
|
||||
major=0
|
||||
minor=0
|
||||
patch_level=0
|
||||
#And there is a fourth additional label for the build metadata.
|
||||
#These labels are for pre-release and build metadata.
|
||||
meta=0
|
||||
|
||||
file_contents=""
|
||||
#Looping code from
|
||||
#https://stackoverflow.com/questions/10929453/read-a-file-line-by-line-assigning-the-value-to-a-variable
|
||||
#Adding numbers in bash:
|
||||
#https://stackoverflow.com/questions/6348902/how-can-i-add-numbers-in-a-bash-script
|
||||
while IFS=' ' read -ra line; do
|
||||
if [[ $line != \#define* ]]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
#Lob off the quotes surrounding the version number.
|
||||
#After lobbing off the quotes, replace all instances of '-' with a period.
|
||||
version_number=($(echo ${line[2]:1:-1} | tr "-" "."))
|
||||
#The symbol name that #define was setting (i.e. KERNEL_VERSION_NUMBER).
|
||||
symbol=${line[1]}
|
||||
#Read in the version number and split it on all periods.
|
||||
IFS='.' read -a chunks <<<$version_number
|
||||
|
||||
version_part_counter=0
|
||||
|
||||
for i in "${chunks[@]}"; do
|
||||
|
||||
case "$version_part_counter" in
|
||||
"0")
|
||||
major=$i
|
||||
;;
|
||||
"1")
|
||||
minor=$i
|
||||
;;
|
||||
"2")
|
||||
patch_level=$i
|
||||
;;
|
||||
"3")
|
||||
#Check to see if a second parameter has been passed.
|
||||
#It doesn't matter what its value is only that one is present.
|
||||
#If there isn't a second parameter set, then we increment the meta build
|
||||
#number, otherwise we decrement.
|
||||
if [ "$2" != "reset" ]
|
||||
then
|
||||
echo "Incrementing meta build number."
|
||||
meta=$(($i + 1))
|
||||
else
|
||||
echo "Resetting meta build number."
|
||||
meta=0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
version_part_counter=$(($version_part_counter + 1))
|
||||
done
|
||||
|
||||
ver="$major.$minor.$patch_level-$meta"
|
||||
|
||||
file_contents="$file_contents#ifndef ${symbol}\n#define ${symbol} \"$ver\"\n#endif\n"
|
||||
done < "$1"
|
||||
|
||||
printf "$file_contents" > "$1"
|
||||
@@ -0,0 +1,26 @@
|
||||
ENTRY(loader)
|
||||
|
||||
SECTIONS {
|
||||
. = 0x00100000; /* Load the code at 1 MB */
|
||||
|
||||
.text ALIGN (0x1000) :
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
|
||||
.rodata ALIGN (0x1000) :
|
||||
{
|
||||
*(.rodata*)
|
||||
}
|
||||
|
||||
.data ALIGN (0x1000) :
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
|
||||
.bss ALIGN (0x1000) :
|
||||
{
|
||||
*(COMMON)
|
||||
*(.bss)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
#Handles the final linking of the OS binaries to build the kernel.
|
||||
#This script will allow for rolling back the build number found in the
|
||||
#build_numbers.c file.
|
||||
|
||||
ld $1 -T support_files/link.ld -o $2 $3 $4
|
||||
|
||||
if [[ $? == 0 ]]
|
||||
then
|
||||
./support_files/handle_build_numbers.sh build_numbers.c
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user