diff --git a/example-os/.gitignore b/example-os/.gitignore index 605e551..6dc21ac 100644 --- a/example-os/.gitignore +++ b/example-os/.gitignore @@ -4,4 +4,6 @@ /os.reasm /os.reasm.disasm /os.file +/os.fdisk /os.arm.disasm +/os.zip diff --git a/example-os/Makefile b/example-os/Makefile index 7b8d6c2..01c0f61 100644 --- a/example-os/Makefile +++ b/example-os/Makefile @@ -2,14 +2,15 @@ os_filename = os.bat tests = test/qemu-system-i386 test/qemu-system-arm test/virtualbox test/bochs test/gui-sh test/dosbox os_image_size_kb = 1440 -os_sectors_before_partition = 720 +os_partition_start_sectors = 3 +os_partition_size_sectors = 717 # 720 - start # CHS parameters for 1.44 MB floppy disk os_floppy_chs_h = 2 os_floppy_chs_s = 9 .PHONY: all # all: os.arm.disasm -all: $(os_filename) os.ndisasm.disasm os.reasm.asm os.reasm os.file .gitignore Makefile +all: $(os_filename) os.ndisasm.disasm os.reasm.asm os.reasm os.file os.fdisk .gitignore Makefile ../deploy-screenshots: Makefile mkdir -p $@ @@ -19,16 +20,22 @@ $(os_filename): os.asm ../deploy-screenshots Makefile rm -f $@ nasm -o $@ $< mformat -v "Example OS" \ - -T $$(($(os_image_size_kb)*1024/512-$(os_sectors_before_partition))) \ + -T $$(($(os_partition_size_sectors))) \ -h $(os_floppy_chs_h) \ -s $(os_floppy_chs_s) \ - -i "$@@@$$(($(os_sectors_before_partition)*512))" -# mcopy … "$@@@$$(($(os_sectors_before_partition)*512))" + -i "$@@@$$(($(os_partition_start_sectors)*512))" +# mcopy … "$@@@$$(($(os_partition_start_sectors)*512))" + zip os.zip $@ + dd seek=$$(($(os_image_size_kb)*1024-$$(wc -c os.zip | cut -d ' ' -f 1))) bs=1 if=os.zip of=$@ + zip --adjust-sfx $@ chmod a+x-w $@ os.file: $(os_filename) Makefile file -kr $< > $@ +os.fdisk: $(os_filename) Makefile + fdisk -l $< > $@ + os.ndisasm.disasm: $(os_filename) Makefile ../utils/compact-ndisasm.sh $< $@ @@ -49,7 +56,7 @@ os.reasm: os.reasm.asm $(os_filename) Makefile .PHONY: clean clean: Makefile - rm -f $(os_filename) os.ndisasm.disasm os.reasm.asm os.reasm os.file os.arm.disasm + rm -f $(os_filename) os.ndisasm.disasm os.reasm.asm os.reasm os.file os.arm.disasm os.zip .gitignore: Makefile echo /$(os_filename) > $@ @@ -58,11 +65,17 @@ clean: Makefile echo /os.reasm >> $@ echo /os.reasm.disasm >> $@ echo /os.file >> $@ + echo /os.fdisk >> $@ echo /os.arm.disasm >> $@ + echo /os.zip >> $@ .PHONY: test -test: $(tests) all Makefile +test: $(tests) test/zip all Makefile .PHONY: $(tests) $(tests): $(os_filename) ../deploy-screenshots Makefile cd .. && ./utils/gui-wrapper.sh 800x600x24 ./$@.sh example-os/$< + +.PHONY: test/zip +test/zip: + unzip -t os.zip diff --git a/example-os/os.asm b/example-os/os.asm index 8ab9c3f..85b77cf 100644 --- a/example-os/os.asm +++ b/example-os/os.asm @@ -53,7 +53,7 @@ db "ExOSxx" ;; 0x1b8 unique disk ID (4 bytes, can be any value) ;;; 3 bytes End Head Sector Cylinder (8 bits + 6 bits + 10 bits) ;;; 4 bytes LBA offset ;;; 4 bytes LBA length -db 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3d, 0x0b, 0x00, 0x00 ;; 0x1be p1 +db 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x0b, 0x00, 0x00, 0x3d, 0x0b, 0x00, 0x00 ;; 0x1be p1 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ;; 0x1ce p2 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ;; 0x1de p3 db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ;; 0x1ee p4