Since i have written some amount of code, it started to get too messy to write in one file, so i decided to make a new directory for kernel IO code, but now the compiler wont compile it, and i have no idea why. Can someone please help me?
kernel.c
Code: Select all
#include "kernelio/kernelio.h"
void kernel_main(){
clearscreen();
kout("moonKERNEL v0.01");
return;
}
Code: Select all
typedef unsigned int u32int;
typedef int s32int;
typedef unsigned short u16int;
typedef short s16int;
typedef unsigned char u8int;
typedef char s8int;
unsigned int lin = 0;
unsigned int col = 0;
#define BITSET(var,pos) ((var) & (1<<(pos)))
char kout_colorvar = 0x04;
void kout(char *kouttext){
char *videoMem = (char*)0xb8000;
while (*kouttext != 0) {
videoMem[col] = *kouttext++;
videoMem[col+1] = kout_colorvar;
col = col + 2;
}
col = 80*2;
}
void kout_color(char kout_color){
kout_colorvar = kout_color;
}
void clearscreen(){
volatile char *videoMem = (volatile char*)0xb8000;
for (volatile int counterforclean = 0; counterforclean < (80*25*2); counterforclean++) {
*videoMem++ = 0x00;
}
col = 0;
lin = 0;
}
void outb(u16int port, u8int value){
asm("outb %1, %0" : : "dN" (port), "a" (value));
}
u16int inb(u16int port){
u8int ret;
asm volatile ( "inb %1, %0" : "=a"(ret) : "Nd"(port) );
return ret;
}
void kin(char *kintext){
}
Code: Select all
void kout(char *kouttext);
void kout_color(char kout_color);
void clearscreen();
void kin(char *kintext);
void outb(u16int port, u8int value);
u16int inb(u16int port);
Code: Select all
kernel:
nasm -f elf32 kernelld.asm -o k.o
gcc -m32 -c kernelio/kernelio.c
gcc -m32 -c kernel.c
gcc -m32 -o kernel_main.o kernel.o kernelio.o
ld -m elf_i386 -T kernel.ld -o kernel k.o kernel_main.o
clean:
rm -f kernel
Code: Select all
nasm -f elf32 kernelld.asm -o k.o
gcc -m32 -c kernelio/kernelio.c
gcc -m32 -c kernel.c
gcc -m32 -o kernel_main.o kernel.o kernelio.o
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/libgcc.a when searching for -lgcc
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../../lib/libgcc.a when searching for -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libgcc.a when searching for -lgcc
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../libgcc.a when searching for -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../../lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../../lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../../lib/libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
/usr/bin/ld: cannot find -lc
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/libgcc.a when searching for -lgcc
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../../lib/libgcc.a when searching for -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libgcc.a when searching for -lgcc
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../libgcc.a when searching for -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../../lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-solus-linux/5.2.0/../../../libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
makefile:2: recipe for target 'kernel' failed
make: *** [kernel] Error 1