Add user/.
This commit is contained in:
parent
c40e007d8a
commit
f6bbebbee3
9
Makefile
9
Makefile
@ -27,15 +27,20 @@ debug: image.bin
|
||||
-ex "break _start" \
|
||||
-ex "continue"
|
||||
|
||||
fs.img: kernel.bin tools/mkfs
|
||||
fs.img: kernel.bin tools/mkfs user/false
|
||||
tools/mkfs $@ $<
|
||||
|
||||
LDFLAGS=-m elf_i386
|
||||
|
||||
user/%: user/%.o user/crt.o
|
||||
$(LD) $(LDFLAGS) -o $@ -Ttext 0x101000 $^
|
||||
|
||||
image.bin: mbr.bin fs.img
|
||||
cat $^ >$@
|
||||
|
||||
kernel.bin: kernel.o console.o drivers/vga.o drivers/keyboard.o \
|
||||
string.o drivers/ata.o cpu/vectors.o cpu/idt.o drivers/uart.o
|
||||
$(LD) -m elf_i386 -o $@ -Ttext 0x1000 $^
|
||||
$(LD) $(LDFLAGS) -o $@ -Ttext 0x1000 $^
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -m32 -ffreestanding -Wall -Werror -c -g $< -o $@
|
||||
|
||||
6
user/crt.c
Normal file
6
user/crt.c
Normal file
@ -0,0 +1,6 @@
|
||||
int main();
|
||||
|
||||
void _start() {
|
||||
int exit_status = main();
|
||||
asm("int $0x84": :"a"(exit_status));
|
||||
}
|
||||
3
user/false.c
Normal file
3
user/false.c
Normal file
@ -0,0 +1,3 @@
|
||||
int main() {
|
||||
return 1;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user