forked from PoliEcho-holding-org/kern
Project restructure (no new code added)
Moved all header files into include/ and removed their C counterparts -> code inside .h files Also added a kernel.ld linker file since we don't have many code files in src/ now, i removed src/kernel/ only real code change is that i moved memcopy() and memset() into string.h from system.h
This commit is contained in:
@@ -9,25 +9,22 @@ echo "Assembling ./src/boot.asm..."
|
||||
nasm -fbin ./src/boot.asm -o ./build/boot.bin
|
||||
|
||||
# Kernel
|
||||
echo "Assembling ./src/kernel/entry.asm..."
|
||||
nasm -felf32 ./src/kernel/entry.asm -o ./build/entry.o
|
||||
echo "Assembling ./src/entry.asm..."
|
||||
nasm -felf32 ./src/entry.asm -o ./build/entry.o
|
||||
|
||||
for file in ./src/kernel/*.c; do
|
||||
for file in ./src/*.c; do
|
||||
filename=$(basename "$file" .c)
|
||||
echo "Compiling $file..."
|
||||
i386-elf-gcc -ffreestanding -Wall -Wextra -m32 -c "$file" -o "./build/$filename.o"
|
||||
i386-elf-gcc -ffreestanding -Wall -Wextra -m32 -Iinclude -c "$file" -o "./build/$filename.o"
|
||||
done
|
||||
|
||||
echo "Linking kernel object files..."
|
||||
mv ./build/disk.o ./build/f_disk.o # Very temporary fix to issue with disk.o not linking or something weird
|
||||
i386-elf-ld -o ./build/kernel.bin -Ttext 0x1000 --oformat binary ./build/*.o
|
||||
i386-elf-ld -o ./build/kernel.bin -Tkernel.ld --oformat binary ./build/*.o
|
||||
|
||||
# OS Image
|
||||
echo "Creating kern.iso disk image..."
|
||||
cat build/boot.bin build/kernel.bin > build/os.bin
|
||||
dd if=/dev/zero of=./kern.iso bs=512 count=2880
|
||||
dd if=./build/os.bin of=./kern.iso conv=notrunc
|
||||
dd if=./fs/test.txt of=./kern.iso bs=512 seek=21 conv=notrunc # We skip 21 (10.5kB) because that's the bootloader (0.5kB) and kernel (10kB)
|
||||
|
||||
echo -e "\nDone!\n"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user