build: Correction des makefiles et ajout du disque dur UEFI
This commit is contained in:
parent
4f7aae792e
commit
349451ba33
1621
debug/gdbinit
1621
debug/gdbinit
File diff suppressed because it is too large
Load Diff
Binary file not shown.
101
final/makefile
101
final/makefile
|
@ -1,48 +1,53 @@
|
||||||
all: harddisk.img.final floppy.img.final harddiskuefi.img.final
|
REMOVE=rm -f
|
||||||
|
INSTALL=sudo apt-get install
|
||||||
harddiskuefi.img.before:
|
COPY=cp
|
||||||
(xz -d -k harddiskuefi.img.xz)
|
DISKCOPY=dd
|
||||||
(dd if=harddiskuefi.img of=harddiskuefi.img.part1 skip=13672 bs=512)
|
COMPRESS=xz
|
||||||
(dd if=harddiskuefi.img of=harddiskuefi.img.before count=13672 bs=512;sync)
|
SYNC=sync
|
||||||
(mkdir ./mnt -p)
|
CREATEDIR=mkdir
|
||||||
|
CAT=cat
|
||||||
harddiskuefi.img.final: harddiskuefi.img.before
|
|
||||||
(mount.fuse-ext2 -o rw+ harddiskuefi.img.part1 ./mnt)
|
all: harddisk.img.final harddiskuefi.img.final
|
||||||
(cp ../system/system.sys ./mnt/boot/;sync)
|
|
||||||
(fusermount ./mnt -u)
|
harddiskuefi.img.before:
|
||||||
(cat harddiskuefi.img.before > harddiskuefi.img.final)
|
$(COMPRESS) -d -k harddiskuefi.img.xz
|
||||||
(cat harddiskuefi.img.part1 >> harddiskuefi.img.final;sync)
|
$(DISKCOPY) if=harddiskuefi.img of=harddiskuefi.img.part1 skip=13672 bs=512
|
||||||
|
$(DISKCOPY) if=harddiskuefi.img of=harddiskuefi.img.before count=13672 bs=512
|
||||||
harddisk.img.before:
|
$(SYNC)
|
||||||
(xz -d -k harddisk.img.xz)
|
$(CREATEDIR) ./mnt -p
|
||||||
(dd if=harddisk.img of=harddisk.img.part1 skip=63 bs=512)
|
|
||||||
(dd if=harddisk.img of=harddisk.img.before count=63 bs=512;sync)
|
harddiskuefi.img.final: harddiskuefi.img.before
|
||||||
(mkdir ./mnt -p)
|
mount.fuse-ext2 -o rw+ harddiskuefi.img.part1 ./mnt
|
||||||
|
$(COPY) ../system/system.sys ./mnt/boot/
|
||||||
harddisk.img.final: harddisk.img.before
|
$(SYNC)
|
||||||
(mount.fuse-ext2 -o rw+ harddisk.img.part1 ./mnt)
|
fusermount ./mnt -u
|
||||||
(cp ../system/system.sys ./mnt/boot/;sync)
|
cat harddiskuefi.img.before > harddiskuefi.img.final
|
||||||
(fusermount ./mnt -u)
|
cat harddiskuefi.img.part1 >> harddiskuefi.img.final
|
||||||
(cat harddisk.img.before > harddisk.img.final)
|
$(SYNC)
|
||||||
(cat harddisk.img.part1 >> harddisk.img.final;sync)
|
|
||||||
|
harddisk.img.before:
|
||||||
floppy.img.final:
|
$(COMPRESS) -d -k harddisk.img.xz
|
||||||
(dd if=/dev/zero of=floppy.img.final count=2880 bs=512)
|
$(DISKCOPY) if=harddisk.img of=harddisk.img.part1 skip=63 bs=512
|
||||||
(mkfs.msdos -F 12 -n "COS2000" floppy.img.final)
|
$(DISKCOPY) if=harddisk.img of=harddisk.img.before count=63 bs=512
|
||||||
(mkdir ./mnt -p)
|
$(SYNC)
|
||||||
(fusefat floppy.img.final ./mnt -o rw+)
|
$(CREATEDIR) ./mnt -p
|
||||||
(cp ../boot/loader.sys ./mnt/)
|
|
||||||
(cp ../system/system.sys ./mnt/;sync)
|
harddisk.img.final: harddisk.img.before
|
||||||
(fusermount ./mnt -u)
|
mount.fuse-ext2 -o rw+ harddisk.img.part1 ./mnt
|
||||||
(dd if=../boot/boot12.bin of=floppy.img.final seek=0 count=1 conv=notrunc;sync)
|
$(COPY) ../system/system.sys ./mnt/boot/
|
||||||
|
$(SYNC)
|
||||||
littleclean:
|
fusermount ./mnt -u
|
||||||
rm -f *.final
|
cat harddisk.img.before > harddisk.img.final
|
||||||
|
cat harddisk.img.part1 >> harddisk.img.final
|
||||||
togit: clean
|
$(SYNC)
|
||||||
|
|
||||||
clean:
|
littleclean:
|
||||||
rm -f *.before
|
$(REMOVE) *.final
|
||||||
rm -f *.part1
|
|
||||||
rm -f *.img
|
togit: clean
|
||||||
rm -f *.final
|
|
||||||
|
clean:
|
||||||
|
$(REMOVE) *.before
|
||||||
|
$(REMOVE) *.part1
|
||||||
|
$(REMOVE) *.img
|
||||||
|
$(REMOVE) *.final
|
||||||
|
|
|
@ -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
|
||||||
|
|
120
lib/makefile
120
lib/makefile
|
@ -1,59 +1,61 @@
|
||||||
CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -F elf_i386 -fno-pie -no-pie -I ../include -c
|
CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -F elf_i386 -fno-pie -no-pie -I ../include -c
|
||||||
ASM=gcc -nostdinc -ffreestanding -fno-builtin -m32 -c -fno-pie -no-pie
|
ASM=gcc -nostdinc -ffreestanding -fno-builtin -m32 -c -fno-pie -no-pie
|
||||||
LINK=ld -m elf_i386 -r -o
|
LINK=ld -m elf_i386 -r -o
|
||||||
SRCS= $(wildcard *.c)
|
SRCS= $(wildcard *.c)
|
||||||
OBJS= $(SRCS:.c=.o)
|
OBJS= $(SRCS:.c=.o)
|
||||||
SRCASM= $(wildcard *.S)
|
SRCASM= $(wildcard *.S)
|
||||||
OBJASM= $(SRCASM:.S=.o)
|
OBJASM= $(SRCASM:.S=.o)
|
||||||
CONVERT=dos2unix
|
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
|
|
||||||
sync
|
all: libs.o
|
||||||
|
$(SYNC)
|
||||||
togit: clean indent
|
|
||||||
|
togit: clean indent
|
||||||
libs.o:$(OBJS) $(OBJASM)
|
|
||||||
$(LINK) libs.o $(OBJS) $(OBJASM)
|
libs.o:$(OBJS) $(OBJASM)
|
||||||
|
$(LINK) libs.o $(OBJS) $(OBJASM)
|
||||||
.o: .S
|
|
||||||
$(ASM) $^
|
.o: .S
|
||||||
|
$(ASM) $^
|
||||||
handlers.o:handlers.c
|
|
||||||
$(CC) -mgeneral-regs-only $^
|
handlers.o:handlers.c
|
||||||
|
$(CC) -mgeneral-regs-only $^
|
||||||
keyboard.o:keyboard.c
|
|
||||||
$(CC) -mgeneral-regs-only $^
|
keyboard.o:keyboard.c
|
||||||
|
$(CC) -mgeneral-regs-only $^
|
||||||
mouse.o:mouse.c
|
|
||||||
$(CC) -mgeneral-regs-only $^
|
mouse.o:mouse.c
|
||||||
|
$(CC) -mgeneral-regs-only $^
|
||||||
syscall.o:syscall.c
|
|
||||||
$(CC) -fomit-frame-pointer $^
|
syscall.o:syscall.c
|
||||||
.o: .c
|
$(CC) -fomit-frame-pointer $^
|
||||||
$(CC) $^
|
.o: .c
|
||||||
|
$(CC) $^
|
||||||
clean:
|
|
||||||
$(REMOVE) *.o
|
clean:
|
||||||
$(REMOVE) *.c~
|
$(REMOVE) *.o
|
||||||
$(REMOVE) */*.c~
|
$(REMOVE) *.c~
|
||||||
$(REMOVE) ../include/*.h~
|
$(REMOVE) */*.c~
|
||||||
$(REMOVE) ./TEST/*.c
|
$(REMOVE) ../include/*.h~
|
||||||
sync
|
$(REMOVE) ./TEST/*.c
|
||||||
|
$(SYNC)
|
||||||
indent:
|
|
||||||
$(CHANGEPERM) *.c
|
indent:
|
||||||
$(CONVERT) *.c
|
$(CHANGEPERM) *.c
|
||||||
$(INDENT) *.c
|
$(CONVERT) *.c
|
||||||
$(REMOVE) *.c~
|
$(INDENT) *.c
|
||||||
$(CHANGEPERM) ./*/*.c
|
$(REMOVE) *.c~
|
||||||
$(CONVERT) ./*/*.c
|
$(CHANGEPERM) ./*/*.c
|
||||||
$(INDENT) ./*/*.c
|
$(CONVERT) ./*/*.c
|
||||||
$(REMOVE) */*.c~
|
$(INDENT) ./*/*.c
|
||||||
$(CHANGEPERM) ../include/*.h
|
$(REMOVE) */*.c~
|
||||||
$(CONVERT) ../include/*.h
|
$(CHANGEPERM) ../include/*.h
|
||||||
$(INDENT) ../include/*.h
|
$(CONVERT) ../include/*.h
|
||||||
$(REMOVE) ../include/*.h~
|
$(INDENT) ../include/*.h
|
||||||
sync
|
$(REMOVE) ../include/*.h~
|
||||||
|
$(SYNC)
|
||||||
|
|
||||||
|
|
334
makefile
334
makefile
|
@ -1,151 +1,183 @@
|
||||||
DEBUG=exec gnome-terminal --geometry=120x55+1+1 -x ./debug/debug.sh
|
##### Variables
|
||||||
REMOVE=rm -f
|
GODEBUG=exec gnome-terminal --geometry=120x55+1+1 -x ./debug/debug.sh
|
||||||
INSTALL=sudo apt-get install
|
REMOVE=rm -f
|
||||||
COPY=cp
|
INSTALL=sudo apt-get install
|
||||||
EMULATOR=bochs -f
|
COPY=cp
|
||||||
GIT=git status
|
OLDEMUX86=bochs -f
|
||||||
MAKECALL=python makesyscall.py
|
GIT=git status
|
||||||
|
MAKECALL=python makesyscall.py
|
||||||
all: tools programs bits32 bits64 harddisk uefi
|
MAKE=make -C
|
||||||
sync
|
SYNC=sync
|
||||||
|
KILL=killall
|
||||||
bits32: ARCH=bits32
|
TAR=tar cf - Source\ C | gzip -f - > backup.tar.gz
|
||||||
bits32: lib/libs.o system/system.sys
|
HEXDUMP=hexdump -C ./final/harddisk.img.final|head -c10000
|
||||||
sync
|
TMUXKILL=tmux kill-session -t
|
||||||
|
TRUE=|| true
|
||||||
bits64: ARCH=bits64
|
SPICE=spicy --uri=spice://127.0.0.1?port=5900
|
||||||
bits64: lib/libs.o system/system.sys
|
SOURCE=xxd -i
|
||||||
sync
|
EMUX86=qemu-system-i386
|
||||||
|
EMUX64=qemu-system-x86_64
|
||||||
tools: tools/build
|
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
|
||||||
tools/build:
|
DEBUG=-S -monitor telnet:127.0.0.1:6666,server,nowait
|
||||||
make -C tools
|
WAIT2S=sleep 2
|
||||||
|
|
||||||
syscall: clean remakeapi all
|
##### Construction
|
||||||
|
|
||||||
remakeapi:
|
all: tools programs system32 system64 harddisk harddiskuefi
|
||||||
$(MAKECALL)
|
$(SYNC)
|
||||||
|
|
||||||
programs: programs/test lib/TEST/test.c lib/TEST/test2.c
|
system32: ARCH=bits32
|
||||||
|
system32: lib/libs.o system/system.sys
|
||||||
lib/TEST/test.c:
|
$(SYNC)
|
||||||
xxd -i programs/test lib/TEST/test.c
|
|
||||||
|
system64: ARCH=bits64
|
||||||
lib/TEST/test2.c:
|
system64: lib/libs.o system/system.sys
|
||||||
xxd -i programs/test2 lib/TEST/test2.c
|
$(SYNC)
|
||||||
|
|
||||||
programs/test:
|
tools: tools/build
|
||||||
make -C programs
|
|
||||||
|
tools/build:
|
||||||
harddisk: final/harddisk.img.final
|
$(MAKE) tools
|
||||||
|
|
||||||
uefi: final/harddiskuefi.img.final
|
syscall: clean remakeapi all
|
||||||
|
|
||||||
install:
|
remakeapi:
|
||||||
$(INSTALL) gcc qemu fusefat fuseext2 gdb ovmf bsdmainutils tar bsdmainutils indent binutils bochs bochs-x bochsbios dos2unix gnome-terminal
|
$(MAKECALL)
|
||||||
|
|
||||||
togit:
|
programs: programs/test lib/TEST/test.c lib/TEST/test2.c
|
||||||
make -C system togit
|
|
||||||
make -C lib togit
|
lib/TEST/test.c:
|
||||||
make -C final togit
|
$(SOURCE) programs/test lib/TEST/test.c
|
||||||
make -C programs togit
|
|
||||||
make -C tools togit
|
lib/TEST/test2.c:
|
||||||
$(GIT)
|
$(SOURCE) programs/test2 lib/TEST/test2.c
|
||||||
sync
|
|
||||||
|
programs/test:
|
||||||
clean:
|
$(MAKE) programs
|
||||||
$(RM) -f .gdb_history
|
|
||||||
make -C system clean
|
harddisk: final/harddisk.img.final
|
||||||
make -C lib clean
|
|
||||||
make -C final clean
|
harddiskuefi: final/harddiskuefi.img.final
|
||||||
make -C programs clean
|
|
||||||
make -C tools clean
|
install:
|
||||||
sync
|
$(INSTALL) gcc qemu fusefat fuseext2 gdb ovmf bsdmainutils tar bsdmainutils indent binutils bochs bochs-x bochsbios dos2unix gnome-terminal spice-client-gtk python2
|
||||||
|
|
||||||
littleclean:
|
togit:
|
||||||
make -C system clean
|
$(MAKE) system togit
|
||||||
make -C lib clean
|
$(MAKE) lib togit
|
||||||
make -C final littleclean
|
$(MAKE) final togit
|
||||||
make -C programs clean
|
$(MAKE) programs togit
|
||||||
sync
|
$(MAKE) tools togit
|
||||||
|
$(GIT)
|
||||||
indent:
|
$(SYNC)
|
||||||
make -C system indent
|
|
||||||
make -C lib indent
|
clean:
|
||||||
make -C programs indent
|
$(REMOVE) .gdb_history
|
||||||
make -C tools indent
|
$(MAKE) system clean
|
||||||
sync
|
$(MAKE) lib clean
|
||||||
|
$(MAKE) final clean
|
||||||
backup: clean
|
$(MAKE) programs clean
|
||||||
cd ..
|
$(MAKE) tools clean
|
||||||
tar cf - Source\ C | gzip -f - > backup.tar.gz
|
$(SYNC)
|
||||||
|
|
||||||
test: tools programs bits32 harddisk qemu
|
littleclean:
|
||||||
|
$(MAKE) system clean
|
||||||
test64: tools programs bits64 uefi qemu64
|
$(MAKE) lib clean
|
||||||
|
$(MAKE) final littleclean
|
||||||
retest: littleclean test
|
$(MAKE) programs clean
|
||||||
|
$(SYNC)
|
||||||
retest64: littleclean test64
|
|
||||||
|
indent:
|
||||||
testbochs: tools programs bits32 harddisk bochs-debug
|
$(MAKE) system indent
|
||||||
|
$(MAKE) lib indent
|
||||||
view:
|
$(MAKE) programs indent
|
||||||
hexdump -C ./final/harddisk.img.final|head -c10000
|
$(MAKE) tools indent
|
||||||
|
$(SYNC)
|
||||||
debug: debug-system
|
|
||||||
|
backup: clean
|
||||||
redebug: littleclean debug-system
|
cd ..
|
||||||
|
$(TAR)
|
||||||
debug64: debug-system64
|
|
||||||
|
test: test32
|
||||||
redebug64: littleclean debug-system64
|
|
||||||
|
retest: retest32
|
||||||
kernel: debug-kernel
|
|
||||||
|
test32: tools programs system32 harddisk qemu32
|
||||||
debug-boot: tools programs bits32 harddisk qemu-debug
|
|
||||||
sleep 2
|
test64: tools programs system64 harddiskuefi qemu64
|
||||||
$(DEBUG) ./debug/boot.txt
|
|
||||||
|
retest32: littleclean test32
|
||||||
debug-system: tools programs bits32 harddisk qemu-debug
|
|
||||||
sleep 2
|
retest64: littleclean test64
|
||||||
$(DEBUG) ./debug/system.txt
|
|
||||||
|
testbochs: tools programs system32 harddisk bochs-debug
|
||||||
debug-system64: tools programs bits64 uefi qemu-debug64
|
|
||||||
sleep 2
|
view:
|
||||||
$(DEBUG) ./debug/system.txt
|
$(HEXDUMP)
|
||||||
|
|
||||||
bochs-debug: killer
|
##### Debuguage
|
||||||
$(EMULATOR) ./debug/config.bochs
|
|
||||||
|
debug: debug-system32
|
||||||
killer:
|
|
||||||
killall bochs-debug || true
|
redebug32: littleclean debug-system32
|
||||||
killall qemu-system-x86_64 || true
|
|
||||||
killall qemu-system-i386 || true
|
debug64: debug-system64
|
||||||
killall gnome-terminal-server || true
|
|
||||||
tmux kill-session -t debug || true
|
redebug64: littleclean debug-system64
|
||||||
|
|
||||||
qemu-debug: killer
|
kernel: debug-kernel
|
||||||
qemu-system-i386 -monitor telnet:127.0.0.1:6666,server,nowait -m 1G -drive format=raw,file=./final/harddisk.img.final -s -S &
|
|
||||||
|
debug-boot: tools programs system32 harddisk qemu-debug32
|
||||||
qemu-debug64: killer
|
$(WAIT2S)
|
||||||
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 &
|
$(GODEBUG) ./debug/boot.txt
|
||||||
|
|
||||||
qemu: killer
|
debug-system32: tools programs system32 harddisk qemu-debug32
|
||||||
qemu-system-i386 -m 1G -drive format=raw,file=./final/harddisk.img.final --enable-kvm -cpu host -s &
|
$(WAIT2S)
|
||||||
|
$(GODEBUG) ./debug/system.txt
|
||||||
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 &
|
debug-system64: tools programs system32 harddiskuefi qemu-debug64
|
||||||
|
$(WAIT2S)
|
||||||
system/system.sys:
|
$(GODEBUG) ./debug/system.txt
|
||||||
make -C system
|
|
||||||
|
bochs-debug: killer
|
||||||
final/harddisk.img.final:
|
$(OLDEMUX86) ./debug/config.bochs
|
||||||
make -C final harddisk.img.final
|
|
||||||
|
killer:
|
||||||
final/harddiskuefi.img.final:
|
$(KILL) bochs-debug $(TRUE)
|
||||||
make -C final harddiskuefi.img.final
|
$(KILL) qemu-system-x86_64 $(TRUE)
|
||||||
|
$(KILL) qemu-system-i386 $(TRUE)
|
||||||
lib/libs.o:
|
$(KILL) gnome-terminal-server $(TRUE)
|
||||||
make -C lib
|
$(TMUXKILL) debug $(TRUE)
|
||||||
|
|
||||||
|
##### Emulation
|
||||||
|
|
||||||
|
qemu-debug32: killer
|
||||||
|
$(EMUX86) $(LEGACY) $(DEBUG) &
|
||||||
|
$(SPICE) &
|
||||||
|
|
||||||
|
qemu-debug64: killer
|
||||||
|
$(EMUX64) $(UEFI) $(DEBUG) &
|
||||||
|
$(SPICE) &
|
||||||
|
|
||||||
|
qemu32: killer
|
||||||
|
$(EMUX86) $(LEGACY) &
|
||||||
|
$(WAIT2S)
|
||||||
|
$(SPICE)
|
||||||
|
|
||||||
|
qemu64: killer
|
||||||
|
$(EMUX64) $(UEFI) &
|
||||||
|
$(WAIT2S)
|
||||||
|
$(SPICE)
|
||||||
|
|
||||||
|
system/system.sys:
|
||||||
|
$(MAKE) system
|
||||||
|
|
||||||
|
final/harddisk.img.final:
|
||||||
|
$(MAKE) final harddisk.img.final
|
||||||
|
|
||||||
|
final/harddiskuefi.img.final:
|
||||||
|
$(MAKE) final harddiskuefi.img.final
|
||||||
|
|
||||||
|
lib/libs.o:
|
||||||
|
$(MAKE) lib
|
||||||
|
|
|
@ -1,38 +1,41 @@
|
||||||
CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -I ./include -fno-pie -no-pie -c -o
|
CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -I ./include -fno-pie -no-pie -c -o
|
||||||
LINK=ld -m elf_i386 -T linker.lds -n -o
|
LINK=ld -m elf_i386 -T linker.lds -n -o
|
||||||
SRCS= $(wildcard *.c)
|
SRCS= $(wildcard *.c)
|
||||||
EXECS= $(SRCS:.c=)
|
EXECS= $(SRCS:.c=)
|
||||||
CONVERT=dos2unix
|
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
|
||||||
CHANGELF=elfedit --output-osabi FenixOS
|
CHANGELF=elfedit --output-osabi FenixOS
|
||||||
CHANGEPERM=chmod 644
|
CHANGEPERM=chmod 644
|
||||||
|
MAKE=make -C
|
||||||
all: lib/libs.a $(EXECS)
|
SYNC=sync
|
||||||
sync
|
|
||||||
|
all: lib/libs.a $(EXECS)
|
||||||
togit: clean indent
|
$(SYNC)
|
||||||
|
|
||||||
lib/libs.a:
|
togit: clean indent
|
||||||
make -C lib
|
|
||||||
|
lib/libs.a:
|
||||||
%: %.c
|
$(MAKE) lib
|
||||||
$(CC) $@.o $<
|
|
||||||
$(LINK) $@ $@.o lib/libs.a
|
%: %.c
|
||||||
$(CHANGEPERM) $@
|
$(CC) $@.o $<
|
||||||
$(CHANGELF) $@
|
$(LINK) $@ $@.o lib/libs.a
|
||||||
|
$(CHANGEPERM) $@
|
||||||
clean:
|
$(CHANGELF) $@
|
||||||
make -C lib clean
|
|
||||||
$(REMOVE) *.o
|
clean:
|
||||||
$(REMOVE) *.c~
|
$(MAKE) lib clean
|
||||||
find . -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \;
|
$(REMOVE) *.o
|
||||||
sync
|
$(REMOVE) *.c~
|
||||||
|
find . -maxdepth 1 -type f ! -perm /u=x -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \;
|
||||||
indent:
|
$(SYNC)
|
||||||
make -C lib indent
|
|
||||||
$(CHANGEPERM) *.c
|
indent:
|
||||||
$(CONVERT) *.c
|
$(MAKE) lib indent
|
||||||
$(INDENT) *.c
|
$(CHANGEPERM) *.c
|
||||||
$(REMOVE) *.c~
|
$(CONVERT) *.c
|
||||||
sync
|
$(INDENT) *.c
|
||||||
|
$(REMOVE) *.c~
|
||||||
|
$(SYNC)
|
||||||
|
|
||||||
|
|
169
system/makefile
169
system/makefile
|
@ -1,83 +1,86 @@
|
||||||
GCC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -I ../include -m32 -fno-pie -no-pie -c -o
|
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
|
ASM=gcc -nostdinc -ffreestanding -fno-builtin -m32 -c -fno-pie -no-pie -I ../include -D__ASSEMBLY__ -c -o
|
||||||
LINK=ld -m elf_i386 -n
|
LINK=ld -m elf_i386 -n
|
||||||
CONVERT=dos2unix
|
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
|
||||||
NM=nm
|
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
|
||||||
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'
|
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'
|
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
|
COMP=gzip -9 -f
|
||||||
BUILD=../tools/build
|
BUILD=../tools/build
|
||||||
MKPIGGY=../tools/mkpiggy
|
MKPIGGY=../tools/mkpiggy
|
||||||
|
MAKE=make -C
|
||||||
all: system.sys
|
SYNC=sync
|
||||||
|
|
||||||
system.sys: piggy.o voffset.h zoffset.h realmode/setup.bin
|
all: system.sys
|
||||||
$(BUILD) realmode/setup.bin system.bin zoffset.h system.sys
|
|
||||||
sync
|
system.sys: piggy.o voffset.h zoffset.h realmode/setup.bin
|
||||||
|
$(BUILD) realmode/setup.bin system.bin zoffset.h system.sys
|
||||||
allpiggy.o: piggy.o decompress.o header.o
|
$(SYNC)
|
||||||
$(LINK) -T allpiggy piggy.o decompress.o header.o
|
|
||||||
|
allpiggy.o: piggy.o decompress.o header.o
|
||||||
voffset.h: system
|
$(LINK) -T allpiggy piggy.o decompress.o header.o
|
||||||
$(NM) system|$(VOFFSET)>voffset.h
|
|
||||||
|
voffset.h: system
|
||||||
zoffset.h: piggy.o
|
$(NM) system|$(VOFFSET)>voffset.h
|
||||||
$(NM) piggy.o|$(ZOFFSET)>zoffset.h
|
|
||||||
|
zoffset.h: piggy.o
|
||||||
togit: clean indent
|
$(NM) piggy.o|$(ZOFFSET)>zoffset.h
|
||||||
|
|
||||||
piggy.o: piggy.S
|
togit: clean indent
|
||||||
$(ASM) $@ $^
|
|
||||||
|
piggy.o: piggy.S
|
||||||
system: system.o system_asm.o ../lib/libs.o
|
$(ASM) $@ $^
|
||||||
$(LINK) -T system.ld system.o system_asm.o ../lib/libs.o
|
|
||||||
$(OBJDEBUG) system system.sym
|
system: system.o system_asm.o ../lib/libs.o
|
||||||
$(NM) system > system.map
|
$(LINK) -T system.ld system.o system_asm.o ../lib/libs.o
|
||||||
|
$(OBJDEBUG) system system.sym
|
||||||
system.bin: system
|
$(NM) system > system.map
|
||||||
$(OBJCOPY) $^ $@
|
|
||||||
|
system.bin: system
|
||||||
system.bin.gz: system.bin
|
$(OBJCOPY) $^ $@
|
||||||
cat $^|$(COMP) > $@
|
|
||||||
|
system.bin.gz: system.bin
|
||||||
piggy.S: system.bin.gz
|
cat $^|$(COMP) > $@
|
||||||
$(MKPIGGY) $^ > $@
|
|
||||||
|
piggy.S: system.bin.gz
|
||||||
realmode/setup.bin:
|
$(MKPIGGY) $^ > $@
|
||||||
make -C realmode
|
|
||||||
|
realmode/setup.bin:
|
||||||
system.o: system.c
|
$(MAKE) realmode
|
||||||
$(GCC) $@ $^
|
|
||||||
|
system.o: system.c
|
||||||
system_asm.o: system_asm.S
|
$(GCC) $@ $^
|
||||||
$(ASM) $@ $^
|
|
||||||
|
system_asm.o: system_asm.S
|
||||||
clean:
|
$(ASM) $@ $^
|
||||||
make -C realmode clean
|
|
||||||
$(REMOVE) system
|
clean:
|
||||||
$(REMOVE) piggy.S
|
$(MAKE) realmode clean
|
||||||
$(REMOVE) *.o
|
$(REMOVE) system
|
||||||
$(REMOVE) *.tmp
|
$(REMOVE) piggy.S
|
||||||
$(REMOVE) *.sym
|
$(REMOVE) *.o
|
||||||
$(REMOVE) *.map
|
$(REMOVE) *.tmp
|
||||||
$(REMOVE) *.gz
|
$(REMOVE) *.sym
|
||||||
$(REMOVE) *.h
|
$(REMOVE) *.map
|
||||||
$(REMOVE) *.out
|
$(REMOVE) *.gz
|
||||||
$(REMOVE) *.bin
|
$(REMOVE) *.h
|
||||||
$(REMOVE) *.sys
|
$(REMOVE) *.out
|
||||||
$(REMOVE) *.s
|
$(REMOVE) *.bin
|
||||||
$(REMOVE) *.c~
|
$(REMOVE) *.sys
|
||||||
sync
|
$(REMOVE) *.s
|
||||||
|
$(REMOVE) *.c~
|
||||||
indent:
|
$(SYNC)
|
||||||
make -C realmode indent
|
|
||||||
$(CHANGEPERM) *.c
|
indent:
|
||||||
$(CONVERT) *.c
|
$(MAKE) realmode indent
|
||||||
$(INDENT) *.c
|
$(CHANGEPERM) *.c
|
||||||
$(REMOVE) *.c~
|
$(CONVERT) *.c
|
||||||
sync
|
$(INDENT) *.c
|
||||||
|
$(REMOVE) *.c~
|
||||||
|
$(SYNC)
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
CC=gcc -DCONFIG_X86_32 -I . -o
|
CC=gcc -DCONFIG_X86_32 -I . -o
|
||||||
SRCS= $(wildcard *.c)
|
SRCS= $(wildcard *.c)
|
||||||
EXECS= $(SRCS:.c=)
|
EXECS= $(SRCS:.c=)
|
||||||
CONVERT=dos2unix
|
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
|
||||||
CHANGELF=elfedit --output-osabi FenixOS
|
CHANGELF=elfedit --output-osabi FenixOS
|
||||||
CHANGEPERM=chmod 644
|
CHANGEPERM=chmod 644
|
||||||
|
|
||||||
all: $(EXECS)
|
all: $(EXECS)
|
||||||
sync
|
sync
|
||||||
|
|
||||||
togit: clean indent
|
togit: clean indent
|
||||||
|
|
||||||
%: %.c
|
%: %.c
|
||||||
$(CC) $@ $<
|
$(CC) $@ $<
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue