Moved external scripts into nakefile.
This commit is contained in:
parent
fad439c25e
commit
f375ef47c5
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,7 +1,8 @@
|
|||||||
**/nimcache/
|
**/nimcache/
|
||||||
isodir/
|
isodir/
|
||||||
myos.iso
|
*.iso
|
||||||
*.o
|
*.o
|
||||||
myos.bin
|
*.bin
|
||||||
serial.log
|
serial.log
|
||||||
nakefile
|
nakefile
|
||||||
|
|
||||||
|
@ -13,9 +13,6 @@ compile:
|
|||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- './nakefile build'
|
- './nakefile build'
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- myos.bin
|
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
- triggers
|
- triggers
|
||||||
@ -28,10 +25,10 @@ create_disc:
|
|||||||
script:
|
script:
|
||||||
- 'apk add xorriso grub-bios'
|
- 'apk add xorriso grub-bios'
|
||||||
- './nakefile build-release'
|
- './nakefile build-release'
|
||||||
- './builddisc.sh'
|
- './nakefile build-disc'
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- myos.iso
|
- alcedo.iso
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
- triggers
|
- triggers
|
||||||
|
10
builddisc.sh
10
builddisc.sh
@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
rm -r isodir
|
|
||||||
mkdir -p isodir/boot/grub
|
|
||||||
cp myos.bin isodir/boot/kernel
|
|
||||||
cp grub.cfg isodir/boot/grub/grub.cfg
|
|
||||||
if command -v grub-mkrescue; then
|
|
||||||
grub-mkrescue -o myos.iso isodir
|
|
||||||
elif command -v grub2-mkrescue; then
|
|
||||||
grub2-mkrescue -o myos.iso isodir
|
|
||||||
fi
|
|
@ -1,6 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
if grub-file --is-x86-multiboot myos.bin; then
|
|
||||||
echo multiboot confirmed
|
|
||||||
else
|
|
||||||
echo the file is not multiboot
|
|
||||||
fi
|
|
35
nakefile.nim
35
nakefile.nim
@ -3,18 +3,21 @@ import os, osproc, strutils
|
|||||||
|
|
||||||
let
|
let
|
||||||
standardOptions = """--skipCfg -d:version:"""" & execProcess("git rev-parse HEAD").strip() & """" kernel.nim"""
|
standardOptions = """--skipCfg -d:version:"""" & execProcess("git rev-parse HEAD").strip() & """" kernel.nim"""
|
||||||
outputFile = "myos.bin"
|
outputFile = "alcedo.bin"
|
||||||
|
outputIso = "alcedo.iso"
|
||||||
|
|
||||||
task "clean", "Removes build files.":
|
task "clean", "Removes build files.":
|
||||||
removeFile("boot.o")
|
removeFile("boot.o")
|
||||||
removeFile("serial.log")
|
removeFile("serial.log")
|
||||||
removeDir("nimcache")
|
removeDir("kernel/nimcache")
|
||||||
|
removeDir("isodir")
|
||||||
removeFile(outputFile)
|
removeFile(outputFile)
|
||||||
|
removeFile(outputIso)
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
task "bootloader", "Builds the bootloader.":
|
task "bootloader", "Builds the bootloader.":
|
||||||
echo "Building bootloader."
|
echo "Building bootloader."
|
||||||
direShell "nasm -felf32 kernel/arch/i386/boot.s -o boot.o"
|
direShell("nasm -felf32 kernel/arch/i386/boot.s -o boot.o")
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
task "build", "Builds the operating system.":
|
task "build", "Builds the operating system.":
|
||||||
@ -22,8 +25,8 @@ task "build", "Builds the operating system.":
|
|||||||
runTask("bootloader")
|
runTask("bootloader")
|
||||||
echo "Compiling and linking."
|
echo "Compiling and linking."
|
||||||
withDir("kernel"):
|
withDir("kernel"):
|
||||||
direShell "nim cc -o:", "../" & outputFile, standardOptions
|
direShell("nim cc -o:../" & outputFile, standardOptions)
|
||||||
runTask("checkMultiboot")
|
runTask("check-multiboot")
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
task "build-release", "Builds the operating system, release mode.":
|
task "build-release", "Builds the operating system, release mode.":
|
||||||
@ -31,21 +34,31 @@ task "build-release", "Builds the operating system, release mode.":
|
|||||||
runTask("bootloader")
|
runTask("bootloader")
|
||||||
echo "Compiling and linking (release mode)."
|
echo "Compiling and linking (release mode)."
|
||||||
withDir("kernel"):
|
withDir("kernel"):
|
||||||
direShell "nim cc -d:release -o:", "../" & outputFile, standardOptions
|
direShell("nim cc -d:release -o:../" & outputFile, standardOptions)
|
||||||
runTask("checkMultiboot")
|
runTask("check-multiboot")
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
task "checkMultiboot", "Checks the grub multiboot header.":
|
task "check-multiboot", "Checks the grub multiboot header.":
|
||||||
echo "Checking multiboot."
|
echo "Checking multiboot."
|
||||||
direShell "grub-file --is-x86-multiboot", outputFile
|
direShell("grub-file --is-x86-multiboot", outputFile)
|
||||||
echo "Multibook check successful."
|
echo "Multibook check successful."
|
||||||
|
|
||||||
|
task "build-disc", "Creates an ISO with the GRUB bootloader.":
|
||||||
|
removeDir("isodir")
|
||||||
|
createDir("isodir/boot/grub")
|
||||||
|
copyFile("myos.bin", "isodir/boot/kernel")
|
||||||
|
copyFile("grub.cfg", "isodir/boot/grub/grub.cfg")
|
||||||
|
if not shell("grub-mkrescue -o ", outputIso, " isodir"):
|
||||||
|
direShell("grub2-mkrescue -o ", outputIso, " isodir")
|
||||||
|
|
||||||
task "debug", "Runs the operating system using QEMU with debug build and flags.":
|
task "debug", "Runs the operating system using QEMU with debug build and flags.":
|
||||||
runTask("build")
|
runTask("build")
|
||||||
|
runTask("build-disc")
|
||||||
echo "Running in Qemu."
|
echo "Running in Qemu."
|
||||||
direShell "qemu-system-i386 -kernel", outputFile ,"-serial stdio -no-reboot -no-shutdown -d int,cpu_reset"
|
direShell("qemu-system-i386 -drive format=raw,file=" & outputIso ,"-serial stdio -no-reboot -no-shutdown -d int,cpu_reset")
|
||||||
|
|
||||||
task "run", "Runs the operating system using QEMU.":
|
task "run", "Runs the operating system using QEMU.":
|
||||||
runTask("build-release")
|
runTask("build-release")
|
||||||
|
runTask("build-disc")
|
||||||
echo "Running in Qemu."
|
echo "Running in Qemu."
|
||||||
direShell "qemu-system-i386 -kernel", outputFile ,"-serial stdio"
|
direShell("qemu-system-i386 -drive format=raw,file=" & outputIso ,"-serial stdio")
|
||||||
|
Loading…
Reference in New Issue
Block a user