hod24-ctf/FullStackNote/Makefile
2024-12-03 14:24:04 +01:00

17 lines
755 B
Makefile

all: sss
sss.elf: single.c script.ld
gcc -T script.ld -mno-sse -mno-sse2 -m32 -fstack-protector-explicit -nostdlib -ffreestanding -nodefaultlibs -fno-builtin -static -fno-pic -O0 -ggdb -o sss.elf single.c
sss: sss.elf
objcopy -O binary -j .kernel sss.elf kernel.bin
objcopy -O binary -j .bios -j .bios.reset_vector sss.elf bios.bin
objcopy -O binary -j .userspace -j .userspace.data sss.elf userspace.bin
touch sss
truncate -s $$((8*1024*1024)) sss
dd if=kernel.bin bs=1 of=sss seek=$$((0x800000-(0x100000000-0xfffff000))) conv=notrunc
dd if=bios.bin bs=1 of=sss seek=$$((0x800000-(0x100000000-0xffffff00))) conv=notrunc
dd if=userspace.bin bs=1 of=sss seek=$$((0x800000-(0x100000000-0xffffe000))) conv=notrunc
clean:
rm -f sss.o sss.elf sss