From: acevest Date: Tue, 26 Oct 2021 01:35:36 +0000 (+0800) Subject: fix compile X-Git-Tag: 0.3.1~7 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=98133c6a74729d0e194a1cd1ec6048f862758cf1;p=kernel.git fix compile --- diff --git a/Makefile b/Makefile index 39b76d6..8814119 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -g -c -fno-builtin +CFLAGS = -g -c -fno-builtin -m32 SYSTEMMAP = System.map KERNELBIN = KERNEL.BIN LINKSCRIPT = scripts/link.ld @@ -15,7 +15,7 @@ HEADER_FILES := $(foreach DIR, $(INC_DIRS), $(wildcard $(DIR)/*.h)) 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 index 848260c..b430492 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -1,6 +1,6 @@ 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 index ce412d1..64ef9df 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -14,7 +14,6 @@ #include #include #include -#include int sysc_stat(int fd, struct stat *stat) { #if 0 diff --git a/kernel/sched.c b/kernel/sched.c index fa337f1..64c7227 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -30,7 +30,7 @@ pid_t get_next_pid() return pid; } -inline void load_cr3(task_union *tsk) +void load_cr3(task_union *tsk) { LOAD_CR3(tsk->cr3); } @@ -87,18 +87,18 @@ inline task_union *get_next_tsk() 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 index 9ad26ec..bb99610 100644 --- a/lib/stat.c +++ b/lib/stat.c @@ -13,7 +13,7 @@ #include #include -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 index e214413..bb17b97 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -23,9 +23,9 @@ parted ${lodev} set 1 boot on sleep 1 -partx -a ${lodev} +#partx -a ${lodev} -sleep 1 +#sleep 1 ls -l ${lodev}* @@ -45,6 +45,8 @@ sleep 1 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" \