Skip to content

Commit

Permalink
makefile update
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua-Riek committed Feb 21, 2022
1 parent 3324dfc commit 05fa942
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .gdbinit
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

exec-file bin/boot12.elf
add-symbol-file bin/boot12.elf 0x9FA00 -readnow
b realEntry
b reallocatedEntry
set tdesc filename target.xml

target remote localhost:1234
Expand Down
24 changes: 7 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ physical address specified by *LOAD_ADDR*.

Please install the packages below, or type:
```
$ sudo apt-get install nasm qemu dosfstools build-essential
$ sudo apt-get install nasm qemu dosfstools mtools build-essential
```

This project also uses an i686-elf cross-compiler, you can click
Expand Down Expand Up @@ -71,23 +71,13 @@ A successful install should look like:
```
$ make install
dd if=/dev/zero of=bin/boot12.img bs=1024 count=1440 status=none
mkfs.vfat -F12 bin/boot12.img
mkfs.fat 4.1 (2017-01-24)
sudo umount -f /mnt/tmp > /dev/null 2>&1 || true
sudo mkdir -p /mnt/tmp
sudo mount bin/boot12.img /mnt/tmp
sudo cp ./bin/demo.bin /mnt/tmp
sudo umount -f /mnt/tmp
dd if=./bin/boot12.bin of=./bin/boot12.img bs=1 skip=62 seek=62 conv=notrunc status=none
mkfs.vfat -F12 bin/boot12.img 1> /dev/null
mcopy -n -i bin/boot12.img ./bin/demo.bin ::
dd if=bin/boot12.bin of=bin/boot12.img bs=1 skip=62 seek=62 conv=notrunc status=none
dd if=/dev/zero of=bin/boot16.img bs=1024 count=16384 status=none
mkfs.vfat -F16 bin/boot16.img
mkfs.fat 4.1 (2017-01-24)
sudo umount -f /mnt/tmp > /dev/null 2>&1 || true
sudo mkdir -p /mnt/tmp
sudo mount bin/boot16.img /mnt/tmp
sudo cp ./bin/demo.bin /mnt/tmp
sudo umount -f /mnt/tmp
dd if=./bin/boot16.bin of=./bin/boot16.img bs=1 skip=62 seek=62 conv=notrunc status=none
mkfs.vfat -F16 bin/boot16.img 1> /dev/null
mcopy -i bin/boot16.img ./bin/demo.bin ::
dd if=bin/boot16.bin of=bin/boot16.img bs=1 skip=62 seek=62 conv=notrunc status=none
```

[boot12.asm]: src/boot12.asm
Expand Down
42 changes: 11 additions & 31 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,44 +78,24 @@ $(OBJDIR)/boot16.o: $(SRCDIR)/boot16.asm | $(OBJDIR)
# Makefile target for the demo file
demo: $(BINDIR)/demo.bin

$(BINDIR)/demo.bin: $(SRCDIR)/demo.asm | $(OBJDIR)
$(BINDIR)/demo.bin: $(SRCDIR)/demo.asm | $(BINDIR)
$(NASM) $^ -f bin -o $@


# Default rule to intall the bootloader
install: boot12-install boot16-install


# Write the FAT12 bootloader to a disk image
boot12-install: $(BINDIR)/boot12.img
# Makefile target to create both bootloader disk images
install: $(BINDIR)/boot12.img $(BINDIR)/boot16.img

$(BINDIR)/boot12.img: $(BINDIR)/boot12.bin $(BINDIR)/demo.bin
dd if=/dev/zero of=$@ bs=1024 count=1440 status=none
mkfs.vfat -F12 $@

sudo umount -f /mnt/tmp > /dev/null 2>&1 || true
sudo mkdir -p /mnt/tmp
sudo mount $@ /mnt/tmp
sudo cp $(BINDIR)/demo.bin /mnt/tmp
sudo umount -f /mnt/tmp

dd if=$(BINDIR)/boot12.bin of=$(BINDIR)/boot12.img bs=1 skip=62 seek=62 conv=notrunc status=none


# Write the FAT12 bootloader to a disk image
boot16-install: $(BINDIR)/boot16.img
mkfs.vfat -F12 $@ 1> /dev/null
mcopy -n -i $@ $(BINDIR)/demo.bin ::
dd if=$< of=$@ bs=1 skip=62 seek=62 conv=notrunc status=none

$(BINDIR)/boot16.img: $(BINDIR)/boot16.bin $(BINDIR)/demo.bin
dd if=/dev/zero of=$@ bs=1024 count=16384 status=none
mkfs.vfat -F16 $@

sudo umount -f /mnt/tmp > /dev/null 2>&1 || true
sudo mkdir -p /mnt/tmp
sudo mount $@ /mnt/tmp
sudo cp $(BINDIR)/demo.bin /mnt/tmp
sudo umount -f /mnt/tmp

dd if=$(BINDIR)/boot16.bin of=$(BINDIR)/boot16.img bs=1 skip=62 seek=62 conv=notrunc status=none
mkfs.vfat -F16 $@ 1> /dev/null
mcopy -i $@ $(BINDIR)/demo.bin ::
dd if=$< of=$@ bs=1 skip=62 seek=62 conv=notrunc status=none


# Create the obj dir
Expand All @@ -138,8 +118,8 @@ clobber: clean

# Run the disk image
run:
$(QEMU) -hda $(BINDIR)/boot16.img
$(QEMU) -fda $(BINDIR)/boot12.img

# Start a debug session with qemu
debug:
$(QEMU) -S -s -hda $(DISKIMG)
$(QEMU) -S -s -hda $(BINDIR)/boot12.img

0 comments on commit 05fa942

Please sign in to comment.