summaryrefslogtreecommitdiff
path: root/bsp/x86/Makefile
blob: cdb4f4ca8c3c6e03d90e87f57bda496711618256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

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


clean:
	scons -c clean
	rm -fr build rtthread* out obj

floppy.img:
	wget https://github.com/bajdcc/tinix/raw/master/floppy.img

# https://en.wikibooks.org/wiki/QEMU/Devices/Network
run:
	qemu-system-i386 -fda floppy.img -boot a -m 64M -serial stdio -net nic,model=ne2k_pci