Skip to content

Commit ce56d39

Browse files
aero.py: use the disk image
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
1 parent ad0ac5f commit ce56d39

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

aero.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,13 @@ def prepare_iso(args, kernel_bin, user_bins):
476476

477477
return None
478478

479+
# create the disk image
480+
disk_path = os.path.join(BUILD_DIR, 'disk.img')
481+
482+
if not os.path.exists(disk_path):
483+
log_info('creating disk image')
484+
os.system('bash ./tools/mkimage.sh')
485+
479486
return iso_path
480487

481488

@@ -486,7 +493,10 @@ def run_in_emulator(build_info: BuildInfo, iso_path):
486493
qemu_args = ['-cdrom', iso_path,
487494
'-m', args.memory,
488495
'-smp', '1',
489-
'-serial', 'stdio']
496+
'-serial', 'stdio',
497+
'-drive', 'file=build/disk.img,if=none,id=NVME1', '-device', 'nvme,drive=NVME1,serial=nvme',
498+
# Specify the boot order (where `d` is the first CD-ROM drive)
499+
'--boot', 'd']
490500

491501
if args.bios == 'uefi':
492502
qemu_args += ['-bios',

tools/mkimage.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
#!/bin/bash
2+
13
# sync the sysroot
24
echo "sysroot: syncing base-files"
35
cp -r base-files/. sysroot/system-root/
46

7+
IMAGE_PATH=build/disk.img
8+
59
# make the disk image
6-
rm -rf disk.img
10+
rm -rf $IMAGE_PATH
711

8-
dd if=/dev/zero bs=1G count=0 seek=512 of=disk.img
9-
parted -s disk.img mklabel gpt
10-
parted -s disk.img mkpart primary 2048s 100%
11-
sudo losetup -Pf --show disk.img > loopback_dev
12+
dd if=/dev/zero bs=1G count=0 seek=512 of=$IMAGE_PATH
13+
parted -s $IMAGE_PATH mklabel gpt
14+
parted -s $IMAGE_PATH mkpart primary 2048s 100%
15+
sudo losetup -Pf --show $IMAGE_PATH > loopback_dev
1216
sudo mkfs.ext2 `cat loopback_dev`p1 -I128
1317
rm -rf disk_image/
1418
mkdir disk_image

0 commit comments

Comments
 (0)