From bcc833522cc25b7217e81644b804675ab19c1a63 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Fri, 14 Nov 2014 11:28:08 +0100 Subject: cleaning up directories and build system --- Makefile | 47 +++++++++++++++++++++++++---------------------- font/Makefile | 5 +++++ font/binarize.py | 40 ++++++++++++++++++++++++++++++++++++++++ font/fill.asm | 11 ----------- tools/binarize.py | 40 ---------------------------------------- 5 files changed, 70 insertions(+), 73 deletions(-) create mode 100644 font/Makefile create mode 100644 font/binarize.py delete mode 100644 font/fill.asm delete mode 100644 tools/binarize.py diff --git a/Makefile b/Makefile index 93e06ab..090e85f 100644 --- a/Makefile +++ b/Makefile @@ -56,40 +56,45 @@ newrun: clean run include Makefile.common -include $(DEPS) -#master boot record +######### RECURSIVE MAKES ######################## + +# master boot record MBR=./boot1/mbr.bin $(MBR): - make -C boot1 + make -C boot1 mbr.bin -#stage 2 bootloader +# stage 2 bootloader STAGE2=./boot2/stage2.bin $(STAGE2): - make -C boot2 + make -C boot2 stage2.bin -#multiprocessor binary entry +# multiprocessor binary entry MP_BIN=./boot2/mp.bin $(MP_BIN): make -C boot2 mp.bin -#some fillup data (zeros) -FILLUP=./data/fill.bin +# fonts +FOOLFONT=./font/binfont.bin +$(FOOLFONT): + make -C font binfont.bin -####### userspace ######### -userspace/ext2.img: - make -C userspace +# userspace +USERSPACE=./userspace/ext2.img +$(USERSPACE): + make -C userspace ext2.img ############ linking kernel binary ############ +FILLUP=fill.img +$(FILLUP): + dd if=/dev/zero of=$(FILLUP) bs=512 count=50000 + + # the kernel_entry.o needs to be FIRST!! kernel.bin: $(KERNEL_ENTRY) $(ASMOBJECTS) $(OBJECTS) $(CC) $(CFLAGS) -o $@ -Wl,-Ttext,$(KERNEL_START),--oformat,binary $^ -############ fool-font ############ -binfont.bin: data/binfont.src - python tools/binarize.py $< $@ - - ############ assembling of final image ############ # master boot record, kernel binary and fool-font @@ -101,13 +106,10 @@ FoolOS.img: $(MBR) $(STAGE2) kernel.bin $(FILLUP) FoolData.img dd if=kernel.bin of=$@ bs=512 seek=10 conv=notrunc #will end up at 0x100000 in ram (this is what the booloader starts loading secotr: 10) dd if=FoolData.img of=$@ bs=512 seek=842 conv=notrunc #data starts at 0x168000 -binfont.img: binfont.bin - cat $^ > $@ - -FoolData.img: binfont.bin $(MP_BIN) userspace/ext2.img +FoolData.img: $(FOOLFONT) $(MP_BIN) $(USERSPACE) dd if=$(MP_BIN) of=$@ bs=512 seek=0 conv=notrunc - dd if=binfont.bin of=$@ bs=512 seek=1 conv=notrunc - dd if=userspace/ext2.img of=$@ bs=512 seek=4 conv=notrunc #will end up at 0x80800 in ram + dd if=$(FOOLFONT) of=$@ bs=512 seek=1 conv=notrunc + dd if=$(USERSPACE) of=$@ bs=512 seek=4 conv=notrunc #will end up at 0x80800 in ram ############ virtual machines stuff ############ @@ -130,10 +132,11 @@ stick: FoolOS.img ############ cleanup ############ clean_release: - -rm *.bin FoolData.img binfont.img bochs.log $(KERNEL_ENTRY) $(ASMOBJECTS) $(OBJECTS) $(FILLUP) $(MBR) $(MP_BIN) bochs.out ne2k-tx.log ne2k-txdump.txt $(STAGE2) $(DEPS) + -rm *.bin FoolData.img bochs.log $(KERNEL_ENTRY) $(ASMOBJECTS) $(OBJECTS) $(FILLUP) $(MBR) $(MP_BIN) bochs.out ne2k-tx.log ne2k-txdump.txt $(STAGE2) $(DEPS) make -C boot1 clean make -C boot2 clean make -C userspace clean + make -C font clean clean: clean_release -rm FoolOS.img FoolOS.vdi diff --git a/font/Makefile b/font/Makefile new file mode 100644 index 0000000..f758bfd --- /dev/null +++ b/font/Makefile @@ -0,0 +1,5 @@ +############ fool-font ############ +binfont.bin: binfont.src + python binarize.py $< $@ +clean: + -rm binfont.bin diff --git a/font/binarize.py b/font/binarize.py new file mode 100644 index 0000000..6dcbdef --- /dev/null +++ b/font/binarize.py @@ -0,0 +1,40 @@ +# this is a simple script to convert the ascii files into binaries +# everything but 0 an 1 , or alternatively _ and X is ignored in +# source file. + +import binascii +import sys + + +f=open(sys.argv[1],'r') +o=open(sys.argv[2],'wb') + +print "binarizing " + sys.argv[1] + " to "+sys.argv[2] + "." + +b="" +l=0 + +while True: + + c=f.read(1) + + if not c: + break + + if c=="0" or c=='_': + l+=1 + b+="0" + + if c=="1" or c=='X': + l+=1 + b+="1" + + if l==8: +# print b + l=0 + o.write(chr(int(b,2))) + b="" + +o.close() + + diff --git a/font/fill.asm b/font/fill.asm deleted file mode 100644 index ce9cb5f..0000000 --- a/font/fill.asm +++ /dev/null @@ -1,11 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;; Miguel's FoolOS Helper Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; -; -; fill an empty floppy disk -; -; - -;times 1474560 db 0x69 -times 14745600 db 0x69 diff --git a/tools/binarize.py b/tools/binarize.py deleted file mode 100644 index 6dcbdef..0000000 --- a/tools/binarize.py +++ /dev/null @@ -1,40 +0,0 @@ -# this is a simple script to convert the ascii files into binaries -# everything but 0 an 1 , or alternatively _ and X is ignored in -# source file. - -import binascii -import sys - - -f=open(sys.argv[1],'r') -o=open(sys.argv[2],'wb') - -print "binarizing " + sys.argv[1] + " to "+sys.argv[2] + "." - -b="" -l=0 - -while True: - - c=f.read(1) - - if not c: - break - - if c=="0" or c=='_': - l+=1 - b+="0" - - if c=="1" or c=='X': - l+=1 - b+="1" - - if l==8: -# print b - l=0 - o.write(chr(int(b,2))) - b="" - -o.close() - - -- cgit v1.2.3