Skip to content

Commit

Permalink
makefile: qemu AHCI disk
Browse files Browse the repository at this point in the history
Makefile rules to create a 8M disk image, and have it connected in qemu.
  • Loading branch information
Orycterope committed Mar 10, 2019
1 parent 9641289 commit e6cca9b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ target
Cargo.lock
isofiles/boot/kfs-*
os.iso
DISK.img
.idea
.gdbinit
.gdb_history
Expand Down
36 changes: 32 additions & 4 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,47 @@ mkisofs-rs external/grub/isofiles isofiles -o os.iso -b boot/grub/i386-pc/eltori
'''
]

[tasks.disk]
workspace = false
description = "Creates an empty disk image."
command = "dd"
args = [ "if=/dev/zero", "of=DISK.img", "count=8M", "iflag=count_bytes" ]

# because we can't have a dependency on a file ರ_ರ
[tasks.create-disk-if-not-exist]
workspace = false
description = "Invokes the task `disk` if DISK.img does not already exist."
condition_script = [ "[ ! -e DISK.img ]" ]
run_task = "disk"

[tasks.qemu]
workspace = false
description = "Runs the bootable ISO in qemu."
dependencies = ["iso-release"]
dependencies = ["iso-release", "create-disk-if-not-exist"]
command = "qemu-system-i386"
args = ["-cdrom", "os.iso", "-serial", "stdio", "-vnc", "${VNC_PORT}", "-no-reboot", "-enable-kvm"]
args = [
"-cdrom", "os.iso",
"-serial", "stdio",
"-vnc", "${VNC_PORT}",
"-no-reboot",
"-enable-kvm",
"-drive", "id=diskA,file=DISK.img,format=raw,if=none", "-device", "ahci,id=ahci", "-device", "ide-drive,drive=diskA,bus=ahci.0",
]

[tasks.qemu-debug]
workspace = false
description = "Runs the bootable ISO in qemu with gdb support"
dependencies = ["iso"]
dependencies = ["iso", "create-disk-if-not-exist"]
command = "qemu-system-i386"
args = ["-cdrom", "os.iso", "-serial", "stdio", "-vnc", "${VNC_PORT}", "-no-reboot", "-gdb", "tcp::${GDB_PORT}", "-S", "-d", "cpu_reset"]
args = [
"-cdrom", "os.iso",
"-serial", "stdio",
"-vnc", "${VNC_PORT}",
"-no-reboot",
"-gdb", "tcp::${GDB_PORT}", "-S",
"-d", "cpu_reset",
"-drive", "id=diskA,file=DISK.img,format=raw,if=none", "-device", "ahci,id=ahci", "-device", "ide-drive,drive=diskA,bus=ahci.0",
]

[tasks.doc]
workspace = false
Expand Down

0 comments on commit e6cca9b

Please sign in to comment.