Repos / kernel.git / commitdiff
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 57a47b1)
raw | patch | inline | side by side (parent: 57a47b1)
| author | zhaoyanbai <zhaoyanbai@126.com> | |
| Tue, 26 Oct 2021 01:35:36 +0000 (09:35 +0800) | ||
| committer | zhaoyanbai <zhaoyanbai@126.com> | |
| Wed, 3 Nov 2021 02:45:42 +0000 (10:45 +0800) |
| Makefile | patch | blob | history | |
| bin/Makefile | patch | blob | history | |
| fs/stat.c | patch | blob | history | |
| kernel/sched.c | patch | blob | history | |
| lib/stat.c | patch | blob | history | |
| scripts/init.sh | patch | blob | history |
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
CC = gcc
-CFLAGS = -g -c -fno-builtin
+CFLAGS = -g -c -fno-builtin -m32
SYSTEMMAP = System.map
KERNELBIN = KERNEL.BIN
LINKSCRIPT = scripts/link.ld
OBJS := $(patsubst %,%.o,$(SOURCE_FILES))
${KERNELBIN}: ${OBJS}
- ld -M -T$(LINKSCRIPT) $(OBJS) -o $@ > $(SYSTEMMAP)
+ ld -m elf_i386 -M -T$(LINKSCRIPT) $(OBJS) -o $@ > $(SYSTEMMAP)
rm kernel/setup.c.o
%.S.o: %.S ${HEADER_FILES}
diff --git a/bin/Makefile b/bin/Makefile
--- a/bin/Makefile
+++ b/bin/Makefile
CC = gcc
LDFLAG = -e _start
-CFLAGS = -c -I../include -fno-builtin
+CFLAGS = -m32 -c -I../include -fno-builtin
LIBC_DIRS = ../lib
LIBC_SRCS := $(foreach DIR, $(LIBC_DIRS), $(wildcard $(DIR)/*.[cS]))
LIBC_OBJS := $(patsubst %,%.o,$(LIBC_SRCS))
diff --git a/fs/stat.c b/fs/stat.c
--- a/fs/stat.c
+++ b/fs/stat.c
#include <errno.h>
#include <fs.h>
#include <sched.h>
-#include <memory.h>
int sysc_stat(int fd, struct stat *stat)
{
#if 0
diff --git a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c
+++ b/kernel/sched.c
return pid;
}
-inline void load_cr3(task_union *tsk)
+void load_cr3(task_union *tsk)
{
LOAD_CR3(tsk->cr3);
}
return 0;
}
-inline void set_esp0(task_union * tsk)
+void set_esp0(task_union * tsk)
{
tss.esp0 = tsk->esp0;
}
-inline void switch_to()
+void switch_to()
{
LOAD_CR3(current->cr3);
set_esp0(current);
}
-inline void context_switch(task_union * prev, task_union * next)
+void context_switch(task_union * prev, task_union * next)
{
unsigned long eax, ebx, ecx, edx, esi, edi;
asm volatile(
diff --git a/lib/stat.c b/lib/stat.c
--- a/lib/stat.c
+++ b/lib/stat.c
#include <syscall.h>
#include <stat.h>
-inline int _stat(int fd, struct stat *stat)
+int _stat(int fd, struct stat *stat)
{
return syscall2(SYSC_STAT, fd, stat);
}
diff --git a/scripts/init.sh b/scripts/init.sh
--- a/scripts/init.sh
+++ b/scripts/init.sh
sleep 1
-partx -a ${lodev}
+#partx -a ${lodev}
-sleep 1
+#sleep 1
ls -l ${lodev}*
echo "(hd0) ${lodev}" > ${TMP}/device.map
+mkdir -p ${MNT}/boot/grub2/
+
grub2-install --target=i386-pc \
--grub-mkdevicemap=${TMP}/device.map \
--modules="biosdisk part_msdos ext2 configfile normal multiboot" \