summaryrefslogtreecommitdiff
path: root/userspace/Makefile
blob: a26d5548484a2c72e7917cf3284647a18012ff58 (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
#i686-elf-gcc test.c -L/home/miguel/temp/fool-os-stuff/newlib-build-clean/i686-elf/newlib/ -I/home/miguel/temp/fool-os-stuff/newlib-2.1.0/newlib/libc/include/ -L/home/miguel/temp/fool-os-stuff/newlib-build-clean/i686-elf/libgloss/libnosys/

CC=i686-elf-gcc
LD=i686-elf-ld

CFLAGS=-I/home/miguel/temp/fool-os-stuff/newlib-2.1.0/newlib/libc/include 
LDFLAGS=-L/home/miguel/temp/fool-os-stuff/newlib-build-clean/i686-elf/newlib/ \
	-L/home/miguel/temp/fool-os-stuff/newlib-build-clean/i686-elf/libgloss/libnosys/ \
	-lnosys

ext2.img: userprog
	dd if=/dev/zero of=ext2.img bs=512 count=200
	sudo mkfs.ext2 -O none ext2.img  -F
	mkdir mnt
	sudo mount ext2.img mnt
	sudo chown miguel mnt
	mkdir mnt/miguel
	echo "hello one" > mnt/miguel/test1.txt
	echo "hello two" > mnt/test2.txt
	cp userprog mnt/shell
	sync
	sudo umount mnt
	rm mnt -rf

userprog: foolshell.o crt0.o
	${CC}  -T linker.ld ${LDFLAGS} $< -Wl,--oformat,binary  -o userprog

clean:
	-rm *.o *.out userprog ext2.img