Add empty vfs program and fix tar parsing
This commit is contained in:
parent
ebdc36fade
commit
30e043955b
8
Makefile
8
Makefile
@ -20,17 +20,21 @@ debug: os.iso kernel.elf
|
|||||||
@$(EMU) -s $(QFLAGS) &
|
@$(EMU) -s $(QFLAGS) &
|
||||||
@$(GDB) -ex "target remote localhost:1234" -ex "symbol-file kernel/kernel.elf"
|
@$(GDB) -ex "target remote localhost:1234" -ex "symbol-file kernel/kernel.elf"
|
||||||
|
|
||||||
os.iso: kernel.elf initrd/* initrd/init
|
os.iso: kernel.elf initrd/* initrd/init initrd/vfs
|
||||||
@cp kernel/kernel.elf iso/boot
|
@cp kernel/kernel.elf iso/boot
|
||||||
@cd initrd; tar -f ../iso/boot/initrd.tar -c *
|
@cd initrd; tar -f ../iso/boot/initrd.tar -c *
|
||||||
@grub-mkrescue -o $@ iso > /dev/null 2>/dev/null
|
@grub-mkrescue -o $@ iso > /dev/null 2>/dev/null
|
||||||
|
|
||||||
.PHONY: kernel.elf initrd/init
|
.PHONY: kernel.elf initrd/init initrd/vfs
|
||||||
|
|
||||||
initrd/init:
|
initrd/init:
|
||||||
$(MAKE) -C init
|
$(MAKE) -C init
|
||||||
cp init/init initrd/init
|
cp init/init initrd/init
|
||||||
|
|
||||||
|
initrd/vfs:
|
||||||
|
$(MAKE) -C vfs
|
||||||
|
cp vfs/vfs initrd/vfs
|
||||||
|
|
||||||
kernel.elf:
|
kernel.elf:
|
||||||
@$(MAKE) -C kernel
|
@$(MAKE) -C kernel
|
||||||
@$(MAKE) -C libc
|
@$(MAKE) -C libc
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "../libc/string.h"
|
#include <string.h>
|
||||||
#include "vga.h"
|
#include "vga.h"
|
||||||
#include <grub/text_fb_info.h>
|
#include <grub/text_fb_info.h>
|
||||||
|
|
||||||
@ -40,10 +40,13 @@ int main(char* initrd, uint32_t initrd_sz) {
|
|||||||
if (hdr.filename[0]=='\0') break;
|
if (hdr.filename[0]=='\0') break;
|
||||||
uint32_t size=getsize(hdr.size);
|
uint32_t size=getsize(hdr.size);
|
||||||
pos+=512;
|
pos+=512;
|
||||||
if (strcmp(hdr.filename,"init")==0) {
|
if (strcmp(hdr.filename,"vfs")==0) {
|
||||||
vga_write_string("Init found");
|
vga_write_string("VFS found");
|
||||||
}
|
}
|
||||||
pos+=size;
|
pos+=size;
|
||||||
|
if (pos%512!=0) {
|
||||||
|
pos+=512-(pos%512);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
BIN
initrd/init
BIN
initrd/init
Binary file not shown.
BIN
initrd/vfs
Executable file
BIN
initrd/vfs
Executable file
Binary file not shown.
Binary file not shown.
@ -71,6 +71,9 @@ void kmain(struct multiboot_boot_header_tag* hdr) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pos+=size;
|
pos+=size;
|
||||||
|
if (pos%512!=0) {
|
||||||
|
pos+=512-(pos%512);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elf_header header;
|
elf_header header;
|
||||||
pos=datapos;
|
pos=datapos;
|
||||||
|
14
vfs/Makefile
Normal file
14
vfs/Makefile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
C_SOURCES = $(wildcard *.c)
|
||||||
|
OBJ = $(C_SOURCES:.c=.o ../kernel/start.o)
|
||||||
|
CFLAGS = -I../sysroot/usr/include -Wall -g -ffreestanding
|
||||||
|
CC = i386-elf-gcc
|
||||||
|
|
||||||
|
vfs: $(OBJ)
|
||||||
|
@i386-elf-ld -o $@ $^ ../libc/libc.a
|
||||||
|
@rm -rf *.o
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
@$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@rm -rf *.o prog.elf
|
3
vfs/main.c
Normal file
3
vfs/main.c
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
int main() {
|
||||||
|
for (;;);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user