/*
* This file is part of the Corax operating system.
- * Copyright (C) 2016-2019 Matthias Kruk
+ * Copyright (C) 2016-2020 Matthias Kruk
*
* Corax is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define CONFIG_IO_MAXPROCFDS 16
#define CONFIG_ELF 0
+#define CONFIG_KBD 1
+#define CONFIG_VGA 0
+
/* klibc configuration */
#define CONFIG_SNPRINTF_FLAG_MINUS 0
#define CONFIG_SNPRINTF_FLAG_APOS 0 /* not implemented */
--- /dev/null
+/*
+ * This file is part of the Corax operating system.
+ * Copyright (C) 2016-2020 Matthias Kruk
+ *
+ * Corax is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Corax is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Corax. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __CORAX_INITFS_H
+
+struct initfs_entry {
+ const char * const ife_name;
+ const void * const ife_base;
+ const void * const ife_limit;
+};
+
+struct initfs {
+ struct initfs_entry *ifs_entries;
+ unsigned int ifs_num_entries;
+};
+
+#endif /* __CORAX_INITFS_H */
LDFLAGS = --oformat=elf32-i386 -b elf32-i386 -m elf_i386
CFLAGS = -m32 -Wall -nostdlib -nodefaultlibs -nostartfiles -ffreestanding -nostdinc \
-fno-builtin -fno-builtin-memcpy
-LIBGCC = /usr/lib/gcc/i686-linux-gnu/8/libgcc.a
+LIBGCC = /usr/lib/gcc-cross/i686-linux-gnu/8/libgcc.a
+INITFS = ../sys/initfs.a
PHONY = $(DEPS) clean
OUTPUT = corax
# FIXME: Remove dependency on libgcc
$(OUTPUT): $(DEPS)
- ld -o $@ -T linker.ld $(LDFLAGS) $(OBJECTS) $(LIBGCC)
+ ld -o $@ -T linker.ld $(LDFLAGS) $(OBJECTS) $(LIBGCC) $(INITFS)
clean: $(DEPS)
rm -f $(OUTPUT)
#include <config.h>
#include <corax/types.h>
#include <corax/heap.h>
+#include <corax/initfs.h>
#include <debug.h>
#include <arch.h>
#include <process.h>
extern int vga_main(int, char**);
extern int kbd_main(int, char**);
+extern struct initfs initfs;
+
void _print_mptbl(void *tbl)
{
u32_t *pmcp;
if(*pmcp == 0x504d4350 || *pmcp == 0x50434d50) {
entries = *(u16_t*)(pmcp + 1);
- dbg_printf("PMCP: 0x%08x, l: %hu, [0x%08x]\n", pmcp, entries, *pmcp);
+ dbg_printf("PMCP: 0x%08x, l: %hu, [0x%08x]\n",
+ pmcp, entries, *pmcp);
tbl += 0x2c;
while(entries) {
tbl += 8;
break;
case 3: /* IO Interrupt entry */
- dbg_printf("[INT] T: 0x%02hhx SRC: 0x%02hhx IRQ: 0x%02hhx DEST: 0x%02hhx DINT: 0x%02hhx\n", *((u8_t*)tbl + 1), *((u8_t*)tbl + 4), *((u8_t*)tbl + 5), *((u8_t*)tbl + 6), *((u8_t*)tbl + 7));
+ dbg_printf("[INT] T: 0x%02hhx SRC: 0x%02hhx "
+ "IRQ: 0x%02hhx DEST: 0x%02hhx "
+ "DINT: 0x%02hhx\n",
+ *((u8_t*)tbl + 1), *((u8_t*)tbl + 4),
+ *((u8_t*)tbl + 5), *((u8_t*)tbl + 6),
+ *((u8_t*)tbl + 7));
tbl += 8;
break;
case 4: /* Local Interrupt assignment entry */
int err;
/*
- * Instead of something like /sbin/init, this process will behave more like the process daemon
- * found in the MINIX3 operating system. It will spawn the daemons necessary for basic system
- * operation, and restart them in case they should die.
+ * Instead of something like /sbin/init, this process will behave more
+ * like the process daemon found in the MINIX3 operating system. It will
+ * spawn the daemons necessary for basic system operation, and restart
+ * them in case they should die.
*/
#if 0
pid = fork();
PANIC("Failed to initialize scheduler\n");
}
-/*
- for(ptr = (void*)0x9fc00; ptr < (void*)0x9fffc; ptr++) {
- if(*(u32_t*)ptr == 0x5f504d5f) {
- dbg_printf("MP Floating Pointer Structure @ 0x%08x\n", ptr);
- break;
- } else if(*(u32_t*)ptr == 0x5f4d505f) {
- dbg_printf("MP Floating Pointer Structure @ 0x%08x LE\n", ptr);
- break;
- }
- }
+ dbg_printf("initfs has %01u entries\n", initfs.ifs_num_entries);
- if(ptr >= (void*)0x9fffc) {
- for(ptr = (void*)0xf0000; ptr < (void*)0xffffc; ptr++) {
- if(*(u32_t*)ptr == 0x5f504d5f) {
- dbg_printf("MP Floating Pointer Structure @ 0x%08x\n", ptr);
- break;
- } else if(*(u32_t*)ptr == 0x5f4d505f) {
- dbg_printf("MP Floating Pointer Structure @ 0x%08x LE\n", ptr);
- break;
- }
- }
+ for(err = 0; err < initfs.ifs_num_entries; err++) {
+ dbg_printf("initfs[%01u] = { \"%s\", 0x%08x : 0x%08x }\n",
+ initfs.ifs_entries[err].ife_name,
+ initfs.ifs_entries[err].ife_base,
+ initfs.ifs_entries[err].ife_limit);
}
-*/
+
err = process_create(&proc, PID_ANY, 0, (void*)_idle);
if(err < 0) {
--- /dev/null
+DEPS = kbd
+PHONY = $(DEPS) clean
+OUTPUT = initfs.a
+INCLUDES = -I.. -I../include
+CFLAGS = -m32 -Wall -nostdlib -nodefaultlibs -nostartfiles -ffreestanding \
+ -nostdinc -fno-builtin -fno-builtin-memcpy $(INCLUDES)
+
+all: $(OUTPUT)
+
+$(OUTPUT): initfs.o
+ ar r $@ $^ *.ko
+
+updateinitfs:
+ gcc -o initfs.o $(CFLAGS) initfs.c *.ko
+
+$(DEPS):
+ $(MAKE) -C $@ $(MAKECMDGOALS)
+
+clean: $(DEPS)
+ rm -f $(OUTPUT)
+
+.PHONY: $(PHONY)
--- /dev/null
+#include <config.h>
+#include <corax/initfs.h>
+
+#if FEATURE(KBD)
+extern const char _binary_kbd_end[];
+extern const char _binary_kbd_start[];
+#endif /* FEATURE(KBD) */
+
+#if FEATURE(VGA)
+extern const char _binary_vga_end[];
+extern const char _binary_vga_start[];
+#endif /* FEATURE(VGA) */
+
+static struct initfs_entry _ifs_entries[] = {
+#if FEATURE(KBD)
+ {
+ .ife_name = "kbd",
+ .ife_base = &_binary_kbd_start,
+ .ife_limit = &_binary_kbd_end
+ },
+#endif
+#if FEATURE(VGA)
+ {
+ .ife_name = "vga",
+ .ife_base = &_binary_vga_start,
+ .ife_limit = &_binary_vga_end
+ },
+#endif
+};
+
+struct initfs initfs = {
+ .ifs_entries = _ifs_entries,
+ .ifs_num_entries = sizeof(_ifs_entries) / sizeof(_ifs_entries[0])
+};