summaryrefslogtreecommitdiff
path: root/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'package.nix')
-rw-r--r--package.nix12
1 files changed, 7 insertions, 5 deletions
diff --git a/package.nix b/package.nix
index 150b46b..1cef31a 100644
--- a/package.nix
+++ b/package.nix
@@ -11,7 +11,12 @@ in
version = "0.1.0";
src = ./.;
buildPhase = ''
- ${nasm}/bin/nasm boot.asm -o ${bootImg}
+ ${nasm}/bin/nasm boot.asm -o boot.bin
+ ${nasm}/bin/nasm kernel.asm -o kernel.bin
+
+ dd if=/dev/zero of=${bootImg} bs=512 count=2
+ dd if=boot.bin of=${bootImg} conv=notrunc
+ dd if=kernel.bin of=${bootImg} bs=512 seek=1 conv=notrunc
'';
installPhase = ''
mkdir -p $out/bin
@@ -26,13 +31,10 @@ in
cp $(echo $out)/bin/${bootImg} ./.bootler/${bootImg}
chmod a+w ./.bootler/${bootImg}
- echo "press any key to continue. Qemu will clear the screen..."
- read -s -n 1
-
# run image
${qemu}/bin/qemu-system-x86_64 \
-nographic \
- -hda ./.bootler/${bootImg}
+ -drive file=./.bootler/${bootImg},format=raw,index=0,media=disk
# clean up
rm ./.bootler -r