Automating image-file creation
This commit is contained in:
parent
bcf49f4fef
commit
32ccb3abd1
2 changed files with 28 additions and 4 deletions
29
Makefile
29
Makefile
|
@ -4,13 +4,13 @@ clean:
|
|||
|
||||
start32.bin: src/*
|
||||
fasm src/start32.asm start32.bin
|
||||
image: start32.bin mount
|
||||
image: start32.bin mount grub-cfg roska.img mnt/roska/
|
||||
cp start32.bin mnt/roska/
|
||||
sync
|
||||
|
||||
qemu-multiboot: start32.bin
|
||||
qemu-system-i386 -kernel start32.bin -serial stdio
|
||||
qemu-image: image
|
||||
qemu-image: image roska.img
|
||||
qemu-system-i386 roska.img -serial stdio
|
||||
|
||||
mount: roska.img mnt/
|
||||
|
@ -18,8 +18,29 @@ mount: roska.img mnt/
|
|||
sudo mount -o loop,offset=1048576,umask=177,dmask=022,uid=$(shell id -u),gid=$(shell id -g) roska.img mnt/; \
|
||||
fi;
|
||||
umount:
|
||||
@sudo umount mnt
|
||||
@if mountpoint -q "mnt/"; then \
|
||||
sudo umount mnt/; \
|
||||
fi;
|
||||
mnt/:
|
||||
@mkdir mnt
|
||||
@mkdir -p mnt
|
||||
mnt/roska/: mount roska.img
|
||||
@mkdir -p mnt/roska
|
||||
build/:
|
||||
@mkdir build
|
||||
|
||||
roska.img: mnt/
|
||||
dd if=/dev/zero of=roska.img bs=16M count=1
|
||||
echo 'type=83' | sudo sfdisk roska.img
|
||||
sudo losetup /dev/loop0 roska.img
|
||||
sudo losetup /dev/loop1 roska.img -o1048576
|
||||
sudo mkdosfs -F32 -f 2 /dev/loop1
|
||||
sudo mount /dev/loop1 mnt/
|
||||
sudo grub-install --target=i386-pc --root-directory=mnt --boot-directory=mnt/boot --no-floppy --modules="normal part_msdos multiboot" /dev/loop0
|
||||
sudo umount mnt/
|
||||
sudo losetup -d /dev/loop1
|
||||
sudo losetup -d /dev/loop0
|
||||
grub-cfg: grub.cfg mount
|
||||
cp grub.cfg mnt/boot/grub/grub.cfg
|
||||
lo-unsetup: umount
|
||||
sudo losetup -d /dev/loop1
|
||||
sudo losetup -d /dev/loop0
|
||||
|
|
3
grub.cfg
Normal file
3
grub.cfg
Normal file
|
@ -0,0 +1,3 @@
|
|||
menuentry "rOSka" {
|
||||
multiboot /roska/start32.bin
|
||||
}
|
Loading…
Reference in a new issue