2017-08-16 15:47:15 +08:00
|
|
|
|
2017-08-20 20:24:07 +08:00
|
|
|
CC = gcc -O0 -m32 -fno-builtin -fno-stack-protector -nostdinc -nostdlib
|
|
|
|
LD = ld -melf_i386 -nostdlib
|
|
|
|
|
|
|
|
all: rtthread rtsym exe dll floppy.img
|
|
|
|
@mkdir -p tmp
|
|
|
|
@sudo mount -t vfat floppy.img tmp -o loop
|
|
|
|
@sudo cp -fv rtthread.elf tmp/boot/oskernel
|
|
|
|
@sudo rm tmp/bin/* -fr
|
|
|
|
@sudo cp out/* tmp/bin/ -fv
|
|
|
|
@sudo umount tmp
|
|
|
|
|
|
|
|
rtthread:
|
|
|
|
@scons
|
|
|
|
|
|
|
|
rtsym:
|
|
|
|
@./src/extract.sh ./rtthread-ia32.map ./src/rt_thread_sym.h
|
|
|
|
|
|
|
|
obj:
|
|
|
|
mkdir -p obj
|
|
|
|
|
|
|
|
out:
|
|
|
|
mkdir -p out
|
|
|
|
|
|
|
|
dll: obj out
|
|
|
|
$(CC) -shared -s -fPIC -e main -Isrc src/hello.c -o out/hello.mo
|
|
|
|
|
|
|
|
disasm: obj out
|
|
|
|
$(CC) -shared -S -fPIC -Isrc src/hello.c -o obj/hello.s
|
|
|
|
cat obj/hello.s
|
|
|
|
objdump --disassemble out/hello.mo
|
|
|
|
|
|
|
|
exe: obj out
|
|
|
|
|
2017-08-16 15:47:15 +08:00
|
|
|
|
|
|
|
clean:
|
|
|
|
scons -c clean
|
2017-08-20 20:24:07 +08:00
|
|
|
rm -fr build rtthread* out obj
|
2017-08-16 15:47:15 +08:00
|
|
|
|
|
|
|
floppy.img:
|
|
|
|
wget https://github.com/bajdcc/tinix/raw/master/floppy.img
|
|
|
|
|
2017-08-20 20:24:07 +08:00
|
|
|
# https://en.wikibooks.org/wiki/QEMU/Devices/Network
|
2017-08-16 15:47:15 +08:00
|
|
|
run:
|
2017-08-20 20:24:07 +08:00
|
|
|
qemu-system-i386 -fda floppy.img -boot a -m 64M -serial stdio -net nic,model=ne2k_pci
|