build: correction des makefiles et ajout du disque dur UEFI

This commit is contained in:
Nicolas Hordé 2020-09-17 09:52:56 +02:00
parent 5afa43629d
commit 7cd20f6c0b
10 changed files with 308 additions and 149 deletions

BIN
final/harddiskuefi.img.xz Normal file

Binary file not shown.

View File

@ -1,47 +1,57 @@
harddiskuefi.img.before: REMOVE=rm -f
xz -d -k harddiskuefi.img.xz INSTALL=sudo apt-get install
dd if=harddiskuefi.img of=harddiskuefi.img.part1 skip=13672 bs=512 COPY=cp
dd if=harddiskuefi.img of=harddiskuefi.img.before count=13672 bs=512 DISKCOPY=dd
mkdir ./mnt -p COMPRESS=xz
sync SYNC=sync
CREATEDIR=mkdir
CAT=cat
MAKE=make -C
harddiskuefi.img.final: initram.img harddiskuefi.img.before all: harddisk.img.final harddiskuefi.img.final
harddiskuefi.img.before:
$(COMPRESS) -d -k harddiskuefi.img.xz
$(DISKCOPY) if=harddiskuefi.img of=harddiskuefi.img.part1 skip=13672 bs=512
$(DISKCOPY) if=harddiskuefi.img of=harddiskuefi.img.before count=13672 bs=512
$(SYNC)
$(CREATEDIR) ./mnt -p
harddiskuefi.img.final: harddiskuefi.img.before
mount.fuse-ext2 -o rw+ harddiskuefi.img.part1 ./mnt mount.fuse-ext2 -o rw+ harddiskuefi.img.part1 ./mnt
cp ../system/system.sys ./mnt/boot/ $(COPY) ../system/system.sys ./mnt/boot/
cp ./initram.img ./mnt/boot/ $(SYNC)
sync
fusermount ./mnt -u fusermount ./mnt -u
cat harddiskuefi.img.before > harddiskuefi.img.final cat harddiskuefi.img.before > harddiskuefi.img.final
cat harddiskuefi.img.part1 >> harddiskuefi.img.final cat harddiskuefi.img.part1 >> harddiskuefi.img.final
sync $(SYNC)
harddisk.img.before: harddisk.img.before:
xz -d -k harddisk.img.xz $(COMPRESS) -d -k harddisk.img.xz
dd if=harddisk.img of=harddisk.img.part1 skip=63 bs=512 $(DISKCOPY) if=harddisk.img of=harddisk.img.part1 skip=63 bs=512
dd if=harddisk.img of=harddisk.img.before count=63 bs=512 $(DISKCOPY) if=harddisk.img of=harddisk.img.before count=63 bs=512
mkdir ./mnt -p $(SYNC)
sync $(CREATEDIR) ./mnt -p
harddisk.img.final: initram.img harddisk.img.before harddisk.img.final: harddisk.img.before
mount.fuse-ext2 -o rw+ harddisk.img.part1 ./mnt mount.fuse-ext2 -o rw+ harddisk.img.part1 ./mnt
cp ../system/system.sys ./mnt/boot/ $(COPY) ../system/system.sys ./mnt/boot/
cp ./initram.img ./mnt/boot/ $(SYNC)
sync
fusermount ./mnt -u fusermount ./mnt -u
cat harddisk.img.before > harddisk.img.final cat harddisk.img.before > harddisk.img.final
cat harddisk.img.part1 >> harddisk.img.final cat harddisk.img.part1 >> harddisk.img.final
sync $(SYNC)
initram.img: initram.img:
make -C ../programs $(MAKE) ../programs
littleclean: littleclean:
rm -f *.final $(REMOVE) *.final
togit: clean togit: clean
clean: clean:
rm -f *.before $(REMOVE) *.before
rm -f *.part1 $(REMOVE) *.part1
rm -f *.img $(REMOVE) *.img
rm -f *.final $(REMOVE) *.final

View File

@ -12,14 +12,30 @@ mkfs.ext2 ${lo}p2
mount ${lo}p1 /mnt mount ${lo}p1 /mnt
mkdir /mnt/grub mkdir /mnt/grub
echo -en "(hd0) ${lo}\n(hd0,1) ${lo}p1\n(hd0,2) ${lo}p2" > /mnt/grub/device.map echo -en "(hd0) ${lo}\n(hd0,1) ${lo}p1\n(hd0,2) ${lo}p2" > /mnt/grub/device.map
grub-install --no-floppy --boot-directory=/mnt/ --efi-directory=/mnt/ ${lo} --install-modules="part_gpt ext2 configfile normal multiboot2 video video_colors video_cirrus video_fb videotest all_video" --locales=fr --target=x86_64-efi --no-nvram #LS MINICMD pour avoir vision paritions
grub-install --no-floppy --boot-directory=/mnt/ --efi-directory=/mnt/ ${lo} --install-modules="part_gpt ext2 configfile normal linux16 video video_colors video_cirrus video_fb videotest all_video" --locales=fr --target=x86_64-efi --no-nvram
mkdir /mnt/EFI/BOOT mkdir /mnt/EFI/BOOT
cp /mnt/EFI/ubuntu/grubx64.efi /mnt/EFI/BOOT/bootx64.efi cp /mnt/EFI/ubuntu/grubx64.efi /mnt/EFI/BOOT/bootx64.efi
#grub-mkimage -d /usr/lib/grub/x86_64-efi -o /mnt/EFI/BOOT/bootx64.efi -c /mnt/EFI/ubuntu/grub.cfg -p "(hd0,1)/grub/" -O x86_64-efi part_gpt ext2 configfile normal multiboot2 video video_color video_cirrus video_fb videotest all_video #grub-mkimage -d /usr/lib/grub/x86_64-efi -o /mnt/EFI/BOOT/bootx64.efi -c /mnt/EFI/ubuntu/grub.cfg -p "(hd0,1)/grub/" -O x86_64-efi part_gpt ext2 configfile normal multiboot2 video video_color video_cirrus video_fb videotest all_video
echo -en "set timeout=4\nset default=0\n\nmenuentry "cos2000" {\nmultiboot2 (hd0,2)/boot/system.sys\nboot\n}" > /mnt/grub/grub.cfg echo -en "\
insmod ext2
insmod biosdisk
insmod part_msdos
insmod linux
insmod vbe
insmod gfxterm
insmod png
insmod font
set timeout=4\n\
set default=0\n\
menuentry "cos2000" {\n\
set root=(hd0,gpt2)\n\
linux16 /boot/system.sys root=hd0,gpt2\n
boot\n\
}" > /mnt/grub/grub.cfg
umount /mnt umount /mnt
mount ${lo}p2 /mnt mount ${lo}p2 /mnt
mkdir /mnt/boot/ mkdir /mnt/boot/
umount /mnt umount /mnt
losetup -d ${lo} losetup -d ${lo}
#xz -c harddiskuefi.img > harddiskuefi.img.xzcl xz -c harddiskuefi.img > harddiskuefi.img.xz

View File

@ -9,9 +9,10 @@ CONVERT=dos2unix
INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl
REMOVE=rm -f REMOVE=rm -f
CHANGEPERM=chmod 644 CHANGEPERM=chmod 644
SYNC=sync
all: libs.o all: libs.o
sync $(SYNC)
togit: clean indent togit: clean indent
@ -41,7 +42,7 @@ clean:
$(REMOVE) */*.c~ $(REMOVE) */*.c~
$(REMOVE) ../include/*.h~ $(REMOVE) ../include/*.h~
$(REMOVE) ./TEST/*.c $(REMOVE) ./TEST/*.c
sync $(SYNC)
indent: indent:
$(CHANGEPERM) *.c $(CHANGEPERM) *.c
@ -56,4 +57,5 @@ indent:
$(CONVERT) ../include/*.h $(CONVERT) ../include/*.h
$(INDENT) ../include/*.h $(INDENT) ../include/*.h
$(REMOVE) ../include/*.h~ $(REMOVE) ../include/*.h~
sync $(SYNC)

174
makefile
View File

@ -1,26 +1,44 @@
DEBUG=exec gnome-terminal --geometry=120x55+1+1 -x ./debug/debug.sh ##### Variables
GODEBUG=exec gnome-terminal --geometry=120x55+1+1 -x ./debug/debug.sh
REMOVE=rm -f REMOVE=rm -f
INSTALL=sudo apt-get install INSTALL=sudo apt-get install
COPY=cp COPY=cp
EMULATOR=bochs -f OLDEMUX86=bochs -f
GIT=git status GIT=git status
MAKECALL=python makesyscall.py MAKECALL=python makesyscall.py
MAKE=make -C
SYNC=sync
KILL=killall
TAR=tar cf - Source\ C | gzip -f - > backup.tar.gz
HEXDUMP=hexdump -C ./final/harddisk.img.final|head -c10000
TMUXKILL=tmux kill-session -t
TRUE=|| true
SPICE=spicy --uri=spice://127.0.0.1?port=5900
SOURCE=xxd -i
EMUX86=qemu-system-i386
EMUX64=qemu-system-x86_64
LEGACY=-m 1G -drive format=raw,file=./final/harddisk.img.final --enable-kvm -cpu host -s -vga qxl -spice port=5900,addr=127.0.0.1,disable-ticketing
UEFI=-m 5G -drive format=raw,file=./final/harddiskuefi.img.final --bios /usr/share/qemu/OVMF.fd --enable-kvm -cpu host -s -vga qxl -spice port=5900,addr=127.0.0.1,disable-ticketing
DEBUG=-S -monitor telnet:127.0.0.1:6666,server,nowait
WAIT2S=sleep 2
all: tools programs bits32 bits64 harddisk uefi ##### Construction
sync
bits32: ARCH=bits32 all: tools programs system32 system64 harddisk harddiskuefi
bits32: lib/libs.o system/system.sys $(SYNC)
sync
bits64: ARCH=bits64 system32: ARCH=bits32
bits64: lib/libs.o system/system.sys system32: lib/libs.o system/system.sys
sync $(SYNC)
system64: ARCH=bits64
system64: lib/libs.o system/system.sys
$(SYNC)
tools: tools/build tools: tools/build
tools/build: tools/build:
make -C tools $(MAKE) tools
syscall: clean remakeapi all syscall: clean remakeapi all
@ -28,67 +46,75 @@ remakeapi:
$(MAKECALL) $(MAKECALL)
programs: programs:
make -C programs $(MAKE) programs
harddisk: final/harddisk.img.final harddisk: final/harddisk.img.final
uefi: final/harddiskuefi.img.final harddiskuefi: final/harddiskuefi.img.final
install: install:
$(INSTALL) gcc qemu fusefat fuseext2 gdb ovmf bsdmainutils tar bsdmainutils cramfsprogs indent binutils bochs bochs-x bochsbios dos2unix gnome-terminal $(INSTALL) gcc qemu fusefat fuseext2 gdb ovmf bsdmainutils tar bsdmainutils indent binutils bochs bochs-x bochsbios dos2unix gnome-terminal spice-client-gtk python2
wget http://ftp.fr.debian.org/debian/pool/main/c/cramfs/cramfsprogs_1.1-6_amd64.deb -O /tmp/cramfsprogs_1.1-6_amd64.deb
dpkg -i /tmp/cramfsprogs_1.1-6_amd64.deb
togit: togit:
make -C system togit $(MAKE) system togit
make -C lib togit $(MAKE) lib togit
make -C final togit $(MAKE) final togit
make -C programs togit $(MAKE) programs togit
make -C tools togit $(MAKE) tools togit
$(GIT) $(GIT)
sync $(SYNC)
clean: clean:
$(RM) -f .gdb_history $(REMOVE) .gdb_history
make -C system clean $(MAKE) system clean
make -C lib clean $(MAKE) lib clean
make -C final clean $(MAKE) final clean
make -C programs clean $(MAKE) programs clean
make -C tools clean $(MAKE) tools clean
sync $(SYNC)
littleclean: littleclean:
make -C system clean $(MAKE) system clean
make -C lib clean $(MAKE) lib clean
make -C final littleclean $(MAKE) final littleclean
make -C programs clean $(MAKE) programs clean
sync $(SYNC)
indent: indent:
make -C system indent $(MAKE) system indent
make -C lib indent $(MAKE) lib indent
make -C programs indent $(MAKE) programs indent
make -C tools indent $(MAKE) tools indent
sync $(SYNC)
backup: clean backup: clean
cd .. cd ..
tar cf - Source\ C | gzip -f - > backup.tar.gz $(TAR)
test: tools programs bits32 harddisk qemu test: test32
test64: tools programs bits64 uefi qemu64 retest: retest32
retest: littleclean test test32: tools programs system32 harddisk qemu32
test64: tools programs system64 harddiskuefi qemu64
retest32: littleclean test32
retest64: littleclean test64 retest64: littleclean test64
testbochs: tools programs bits32 harddisk bochs-debug testbochs: tools programs system32 harddisk bochs-debug
view: view:
hexdump -C ./final/harddisk.img.final|head -c10000 $(HEXDUMP)
debug: debug-system ##### Debuguage
redebug: littleclean debug-system debug: debug-system32
redebug32: littleclean debug-system32
debug64: debug-system64 debug64: debug-system64
@ -96,48 +122,56 @@ redebug64: littleclean debug-system64
kernel: debug-kernel kernel: debug-kernel
debug-boot: tools programs bits32 harddisk qemu-debug debug-boot: tools programs system32 harddisk qemu-debug32
sleep 2 $(WAIT2S)
$(DEBUG) ./debug/boot.txt $(GODEBUG) ./debug/boot.txt
debug-system: tools programs bits32 harddisk qemu-debug debug-system32: tools programs system32 harddisk qemu-debug32
sleep 2 $(WAIT2S)
$(DEBUG) ./debug/system.txt $(GODEBUG) ./debug/system.txt
debug-system64: tools programs bits64 uefi qemu-debug64 debug-system64: tools programs system32 harddiskuefi qemu-debug64
sleep 2 $(WAIT2S)
$(DEBUG) ./debug/system.txt $(GODEBUG) ./debug/system.txt
bochs-debug: killer bochs-debug: killer
$(EMULATOR) ./debug/config.bochs $(OLDEMUX86) ./debug/config.bochs
killer: killer:
killall bochs-debug || true $(KILL) bochs-debug $(TRUE)
killall qemu-system-x86_64 || true $(KILL) qemu-system-x86_64 $(TRUE)
killall qemu-system-i386 || true $(KILL) qemu-system-i386 $(TRUE)
killall gnome-terminal-server || true $(KILL) gnome-terminal-server $(TRUE)
tmux kill-session -t debug || true $(TMUXKILL) debug $(TRUE)
qemu-debug: killer ##### Emulation
qemu-system-i386 -monitor telnet:127.0.0.1:6666,server,nowait -m 1G -drive format=raw,file=./final/harddisk.img.final -s -S &
qemu-debug32: killer
$(EMUX86) $(LEGACY) $(DEBUG) &
$(SPICE) &
qemu-debug64: killer qemu-debug64: killer
qemu-system-x86_64 -monitor telnet:127.0.0.1:6666,server,nowait -m 5G -drive format=raw,file=./final/harddiskuefi.img.final --bios /usr/share/qemu/OVMF.fd -s -S & $(EMUX64) $(UEFI) $(DEBUG) &
$(SPICE) &
qemu: killer qemu32: killer
qemu-system-i386 -m 1G -drive format=raw,file=./final/harddisk.img.final --enable-kvm -cpu host -s & $(EMUX86) $(LEGACY) &
$(WAIT2S)
$(SPICE)
qemu64: killer qemu64: killer
qemu-system-x86_64 -m 5G -drive format=raw,file=./final/harddiskuefi.img.final --bios /usr/share/qemu/OVMF.fd --enable-kvm -cpu host -s & $(EMUX64) $(UEFI) &
$(WAIT2S)
$(SPICE)
system/system.sys: system/system.sys:
make -C system $(MAKE) system
final/harddisk.img.final: final/harddisk.img.final:
make -C final harddisk.img.final $(MAKE) final harddisk.img.final
final/harddiskuefi.img.final: final/harddiskuefi.img.final:
make -C final harddiskuefi.img.final $(MAKE) final harddiskuefi.img.final
lib/libs.o: lib/libs.o:
make -C lib $(MAKE) lib

View File

@ -7,9 +7,10 @@ CONVERT=dos2unix
INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl
REMOVE=rm -f REMOVE=rm -f
CHANGEPERM=chmod 644 CHANGEPERM=chmod 644
SYNC=sync
all: libs.a all: libs.a
sync $(SYNC)
togit: clean indent togit: clean indent
@ -26,7 +27,7 @@ clean:
$(REMOVE) *.o $(REMOVE) *.o
$(REMOVE) *.c~ $(REMOVE) *.c~
$(REMOVE) *.a $(REMOVE) *.a
sync $(SYNC)
indent: indent:
$(CHANGEPERM) *.c $(CHANGEPERM) *.c
@ -37,4 +38,5 @@ indent:
$(CONVERT) ../include/*.h $(CONVERT) ../include/*.h
$(INDENT) ../include/*.h $(INDENT) ../include/*.h
$(REMOVE) ../include/*.h~ $(REMOVE) ../include/*.h~
sync $(SYNC)

View File

@ -8,9 +8,11 @@ REMOVE=rm -f
CHANGELF=elfedit --output-osabi FenixOS CHANGELF=elfedit --output-osabi FenixOS
CHANGEPERM=chmod 644 CHANGEPERM=chmod 644
MOVE=mv MOVE=mv
SYNC=sync
MAKE=make -C
all: lib/libs.a ../final/initram.img all: lib/libs.a ../final/initram.img
sync $(SYNC)
togit: clean indent togit: clean indent
@ -19,7 +21,7 @@ togit: clean indent
mkcramfs ../final/cramfs/ ../final/initram.img mkcramfs ../final/cramfs/ ../final/initram.img
lib/libs.a: lib/libs.a:
make -C lib $(MAKE) lib
%: %.c %: %.c
$(CC) $@.o $< $(CC) $@.o $<
@ -33,12 +35,13 @@ clean:
$(REMOVE) *.c~ $(REMOVE) *.c~
(find ../final/cramfs/executables -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \;;true) (find ../final/cramfs/executables -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \;;true)
(find . -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \;;true) (find . -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \;;true)
sync $(SYNC)
indent: indent:
make -C lib indent $(MAKE) lib indent
$(CHANGEPERM) *.c $(CHANGEPERM) *.c
$(CONVERT) *.c $(CONVERT) *.c
$(INDENT) *.c $(INDENT) *.c
$(REMOVE) *.c~ $(REMOVE) *.c~
sync $(SYNC)

View File

@ -13,12 +13,14 @@ VOFFSET=sed -n -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)
COMP=gzip -9 -f COMP=gzip -9 -f
BUILD=../tools/build BUILD=../tools/build
MKPIGGY=../tools/mkpiggy MKPIGGY=../tools/mkpiggy
MAKE=make -C
SYNC=sync
all: system.sys all: system.sys
system.sys: piggy.o voffset.h zoffset.h realmode/setup.bin system.sys: piggy.o voffset.h zoffset.h realmode/setup.bin
$(BUILD) realmode/setup.bin system.bin zoffset.h system.sys $(BUILD) realmode/setup.bin system.bin zoffset.h system.sys
sync $(SYNC)
allpiggy.o: piggy.o decompress.o header.o allpiggy.o: piggy.o decompress.o header.o
$(LINK) -T allpiggy piggy.o decompress.o header.o $(LINK) -T allpiggy piggy.o decompress.o header.o
@ -49,7 +51,7 @@ piggy.S: system.bin.gz
$(MKPIGGY) $^ > $@ $(MKPIGGY) $^ > $@
realmode/setup.bin: realmode/setup.bin:
make -C realmode $(MAKE) realmode
system.o: system.c system.o: system.c
$(GCC) $@ $^ $(GCC) $@ $^
@ -58,7 +60,7 @@ system_asm.o: system_asm.S
$(ASM) $@ $^ $(ASM) $@ $^
clean: clean:
make -C realmode clean $(MAKE) realmode clean
$(REMOVE) system $(REMOVE) system
$(REMOVE) piggy.S $(REMOVE) piggy.S
$(REMOVE) *.o $(REMOVE) *.o
@ -72,12 +74,98 @@ clean:
$(REMOVE) *.sys $(REMOVE) *.sys
$(REMOVE) *.s $(REMOVE) *.s
$(REMOVE) *.c~ $(REMOVE) *.c~
sync $(SYNC)
indent: indent:
make -C realmode indent $(MAKE) realmode indent
$(CHANGEPERM) *.c $(CHANGEPERM) *.c
$(CONVERT) *.c $(CONVERT) *.c
$(INDENT) *.c $(INDENT) *.c
$(REMOVE) *.c~ $(REMOVE) *.c~
sync $(SYNC)
GCC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -I ../include -m32 -fno-pie -no-pie -c -o
ASM=gcc -nostdinc -ffreestanding -fno-builtin -m32 -c -fno-pie -no-pie -I ../include -D__ASSEMBLY__ -c -o
LINK=ld -m elf_i386 -n
CONVERT=dos2unix
INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl
REMOVE=rm -f
CHANGEPERM=chmod 644
NM=nm
OBJCOPY=objcopy -O binary -R .note -R .comment -S
OBJDEBUG=objcopy --only-keep-debug
ZOFFSET=sed -n -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p'
VOFFSET=sed -n -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p'
COMP=gzip -9 -f
BUILD=../tools/build
MKPIGGY=../tools/mkpiggy
MAKE=make -C
SYNC=sync
all: system.sys
system.sys: piggy.o voffset.h zoffset.h realmode/setup.bin
$(BUILD) realmode/setup.bin system.bin zoffset.h system.sys
$(SYNC)
allpiggy.o: piggy.o decompress.o header.o
$(LINK) -T allpiggy piggy.o decompress.o header.o
voffset.h: system
$(NM) system|$(VOFFSET)>voffset.h
zoffset.h: piggy.o
$(NM) piggy.o|$(ZOFFSET)>zoffset.h
togit: clean indent
piggy.o: piggy.S
$(ASM) $@ $^
system: system.o system_asm.o ../lib/libs.o
$(LINK) -T system.ld system.o system_asm.o ../lib/libs.o
$(OBJDEBUG) system system.sym
$(NM) system > system.map
system.bin: system
$(OBJCOPY) $^ $@
system.bin.gz: system.bin
cat $^|$(COMP) > $@
piggy.S: system.bin.gz
$(MKPIGGY) $^ > $@
realmode/setup.bin:
$(MAKE) realmode
system.o: system.c
$(GCC) $@ $^
system_asm.o: system_asm.S
$(ASM) $@ $^
clean:
$(MAKE) realmode clean
$(REMOVE) system
$(REMOVE) piggy.S
$(REMOVE) *.o
$(REMOVE) *.tmp
$(REMOVE) *.sym
$(REMOVE) *.map
$(REMOVE) *.gz
$(REMOVE) *.h
$(REMOVE) *.out
$(REMOVE) *.bin
$(REMOVE) *.sys
$(REMOVE) *.s
$(REMOVE) *.c~
$(SYNC)
indent:
$(MAKE) realmode indent
$(CHANGEPERM) *.c
$(CONVERT) *.c
$(INDENT) *.c
$(REMOVE) *.c~
$(SYNC)

View File

@ -9,9 +9,10 @@ NM=nm
OBJCOPY=objcopy -O binary -R .note -R .comment -S OBJCOPY=objcopy -O binary -R .note -R .comment -S
OBJDEBUG=objcopy --only-keep-debug OBJDEBUG=objcopy --only-keep-debug
$(eval VERSION=$(shell git describe --tags)) $(eval VERSION=$(shell git describe --tags))
SYNC=sync
all: setup.bin all: setup.bin
sync $(SYNC)
setup: setupc.o setup.o setup32.o setup: setupc.o setup.o setup32.o
$(LINK) -T setup.ld setupc.o setup.o setup32.o $(LINK) -T setup.ld setupc.o setup.o setup32.o
@ -40,11 +41,12 @@ clean:
$(REMOVE) *.sys $(REMOVE) *.sys
$(REMOVE) *.s $(REMOVE) *.s
$(REMOVE) *.c~ $(REMOVE) *.c~
sync $(SYNC)
indent: indent:
$(CHANGEPERM) *.c $(CHANGEPERM) *.c
$(CONVERT) *.c $(CONVERT) *.c
$(INDENT) *.c $(INDENT) *.c
$(REMOVE) *.c~ $(REMOVE) *.c~
sync $(SYNC)

View File

@ -6,9 +6,10 @@ INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bl
REMOVE=rm -f REMOVE=rm -f
CHANGELF=elfedit --output-osabi FenixOS CHANGELF=elfedit --output-osabi FenixOS
CHANGEPERM=chmod 644 CHANGEPERM=chmod 644
SYNC=sync
all: $(EXECS) all: $(EXECS)
sync $(SYNC)
togit: clean indent togit: clean indent
@ -17,12 +18,13 @@ togit: clean indent
clean: clean:
$(REMOVE) *.o $(REMOVE) *.o
$(REMOVE) *.c~ $(REMOVE) *.c~
find . -type f ! -name makefile -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \; find . -maxdepth 1 -type f ! -name makefile -perm /u=x -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \;
sync $(SYNC)
indent: indent:
$(CHANGEPERM) *.c $(CHANGEPERM) *.c
$(CONVERT) *.c $(CONVERT) *.c
$(INDENT) *.c $(INDENT) *.c
$(REMOVE) *.c~ $(REMOVE) *.c~
sync $(SYNC)