nanobyte-dev / nanobyte_os Goto Github PK
View Code? Open in Web Editor NEWOS tutorial from Nanobyte YouTube channel.
License: The Unlicense
OS tutorial from Nanobyte YouTube channel.
License: The Unlicense
I tried to do scons toolchain
but it's giving me this error:
./scripts/setup_toolchain.sh: line 34: pushd: ../.toolchains: No such file or directory
Help me!
Hello @chibicitiberiu ,
I'm your subscriber since 2021. I need your help on my Gnu GRUB(Gnu GRand Unified Bootloader) based operating system. I have some issues with undefined reference. Some error logs have collected:
/usr/local/sixtybit/lib/gcc/x86_64-elf/11.1.0/include/stddef.h:209:23: note: previous declaration of 'size_t' with type 'size_t' {aka 'long unsigned int'}
209 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
In file included from src/impl/kernel/drivers/string.c:2:
src/impl/kernel/drivers/stdint.h:18: warning: "NULL" redefined
18 | #define NULL ((void*)0)
|
In file included from src/impl/kernel/drivers/printf.h:37,
from src/impl/kernel/drivers/types.h:25,
from src/impl/kernel/drivers/string.h:4,
from src/impl/kernel/drivers/string.c:1:
/usr/local/sixtybit/lib/gcc/x86_64-elf/11.1.0/include/stddef.h:395: note: this is the location of the previous definition
395 | #define NULL ((void *)0)
|
src/impl/kernel/drivers/string.c: In function 'memcmp':
src/impl/kernel/drivers/string.c:83:20: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
83 | unsigned char *x = strng1;
| ^~~~~~
src/impl/kernel/drivers/string.c:84:20: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
84 | unsigned char *y = strng2;
| ^~~~~~
make: *** [Makefile:23: build/kernel/drivers/string.o] Error 1
afif@DESKTOP-VM3GA2V:/mnt/c/Users/AFIF/OneDrive/Documents/OS/Orzen-bird/mainboy/osdev-guide/testing$ make
mkdir -p build/kernel/drivers/
x86_64-elf-gcc -c -ffreestanding src/impl/kernel/drivers/string.c -o build/kernel/drivers/string.o
src/impl/kernel/drivers/string.c: In function 'memcmp':
src/impl/kernel/drivers/string.c:83:20: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
83 | unsigned char *x = strng1;
| ^~~~~~
src/impl/kernel/drivers/string.c:84:20: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
84 | unsigned char *y = strng2;
| ^~~~~~
mkdir -p build/kernel/drivers/
x86_64-elf-gcc -c -ffreestanding src/impl/kernel/drivers/tty.c -o build/kernel/drivers/tty.o
mkdir -p build/kernel/drivers/
x86_64-elf-gcc -c -ffreestanding src/impl/kernel/drivers/vga.c -o build/kernel/drivers/vga.o
mkdir -p build/kernel/
x86_64-elf-gcc -c -ffreestanding src/impl/kernel/main.c -o build/kernel/main.o
mkdir -p build/kernel/maintools/
x86_64-elf-gcc -c -ffreestanding src/impl/kernel/maintools/print.c -o build/kernel/maintools/print.o
mkdir -p build/kernel/maintools/
x86_64-elf-gcc -c -ffreestanding src/impl/kernel/maintools/stdio.c -o build/kernel/maintools/stdio.o
mkdir -p build/kernel/maintools/
x86_64-elf-gcc -c -ffreestanding src/impl/kernel/maintools/x86.c -o build/kernel/maintools/x86.o
mkdir -p build/x86_64/boot/
nasm -f elf64 src/impl/x86_64/boot/header.asm -o build/x86_64/boot/header.o
mkdir -p build/x86_64/boot/
nasm -f elf64 src/impl/x86_64/boot/main.asm -o build/x86_64/boot/main.o
mkdir -p build/x86_64/boot/
nasm -f elf64 src/impl/x86_64/boot/main64.asm -o build/x86_64/boot/main64.o
mkdir -p dist/x86_64
x86_64-elf-ld -n -o dist/x86_64/kernel.bin -T targets/x86_64/linker.ld build/kernel/drivers/asm_ports.o build/kernel/drivers/ata.o build/kernel/drivers/disk.o build/kernel/drivers/fat32.o build/kernel/drivers/kb.o build/kernel/drivers/printf.o build/kernel/drivers/string.o build/kernel/drivers/tty.o build/kernel/drivers/vga.o build/kernel/main.o build/kernel/maintools/print.o build/kernel/maintools/stdio.o build/kernel/maintools/x86.o build/kernel/maintools/print.o build/kernel/maintools/stdio.o build/kernel/maintools/x86.o build/x86_64/boot/header.o build/x86_64/boot/main.o build/x86_64/boot/main64.o build/kernel/drivers/asm_ports.o build/kernel/drivers/ata.o build/kernel/drivers/disk.o build/kernel/drivers/fat32.o build/kernel/drivers/kb.o build/kernel/drivers/printf.o build/kernel/drivers/string.o build/kernel/drivers/tty.o build/kernel/drivers/vga.o
x86_64-elf-ld: build/kernel/drivers/kb.o:(.bss+0x0): multiple definition of `GRUB_PACKED'; build/kernel/drivers/fat32.o:(.bss+0x0): first defined
here
x86_64-elf-ld: build/kernel/drivers/vga.o:(.bss+0x0): multiple definition of `GRUB_PACKED'; build/kernel/drivers/fat32.o:(.bss+0x0): first defined here
x86_64-elf-ld: build/kernel/main.o:(.bss+0x0): multiple definition of `GRUB_PACKED'; build/kernel/drivers/fat32.o:(.bss+0x0): first defined here
x86_64-elf-ld: build/kernel/main.o:(.bss+0x20): multiple definition of `fat'; build/kernel/drivers/fat32.o:(.bss+0x20): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o:(.data+0x8): multiple definition of `color'; build/kernel/drivers/tty.o:(.data+0x0): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o:(.data+0x0): multiple definition of `buffer'; build/kernel/maintools/print.o:(.data+0x0): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o:(.bss+0x0): multiple definition of `col'; build/kernel/maintools/print.o:(.bss+0x0): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o:(.bss+0x8): multiple definition of `row'; build/kernel/maintools/print.o:(.bss+0x8): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o:(.data+0x8): multiple definition of `color'; build/kernel/drivers/tty.o:(.data+0x0): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o: in function `clear_row':
print.c:(.text+0x0): multiple definition of `clear_row'; build/kernel/maintools/print.o:print.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o: in function `print_clear':
print.c:(.text+0x5c): multiple definition of `print_clear'; build/kernel/maintools/print.o:print.c:(.text+0x5c): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o: in function `print_newline':
print.c:(.text+0x8e): multiple definition of `print_newline'; build/kernel/maintools/print.o:print.c:(.text+0x8e): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o: in function `print_char':
print.c:(.text+0x168): multiple definition of `print_char'; build/kernel/maintools/print.o:print.c:(.text+0x168): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o: in function `print_str':
print.c:(.text+0x1ed): multiple definition of `print_str'; build/kernel/maintools/print.o:print.c:(.text+0x1ed): first defined here
x86_64-elf-ld: build/kernel/maintools/print.o: in function `print_set_color':
print.c:(.text+0x22d): multiple definition of `print_set_color'; build/kernel/maintools/print.o:print.c:(.text+0x22d): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o:(.rodata+0x0): multiple definition of `SCREEN_WIDTH'; build/kernel/maintools/stdio.o:(.rodata+0x0):
first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o:(.rodata+0x4): multiple definition of `SCREEN_HEIGHT'; build/kernel/maintools/stdio.o:(.rodata+0x4): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o:(.rodata+0x8): multiple definition of `DEFAULT_COLOR'; build/kernel/maintools/stdio.o:(.rodata+0x8): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o:(.data+0x0): multiple definition of `g_ScreenBuffer'; build/kernel/maintools/stdio.o:(.data+0x0): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o:(.bss+0x0): multiple definition of `g_ScreenX'; build/kernel/maintools/stdio.o:(.bss+0x0): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o:(.bss+0x4): multiple definition of `g_ScreenY'; build/kernel/maintools/stdio.o:(.bss+0x4): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `putchr':
stdio.c:(.text+0x0): multiple definition of `putchr'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `putcolor':
stdio.c:(.text+0x36): multiple definition of `putcolor'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x36): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `getchr':
stdio.c:(.text+0x6f): multiple definition of `getchr'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x6f): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `getcolor':
stdio.c:(.text+0x9c): multiple definition of `getcolor'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x9c): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `setcursor':
stdio.c:(.text+0xcc): multiple definition of `setcursor'; build/kernel/maintools/stdio.o:stdio.c:(.text+0xcc): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `clrscr':
stdio.c:(.text+0x135): multiple definition of `clrscr'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x135): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `scrollback':
stdio.c:(.text+0x1c6): multiple definition of `scrollback'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x1c6): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `putc':
stdio.c:(.text+0x2c3): multiple definition of `putc'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x2c3): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `puts':
stdio.c:(.text+0x3cd): multiple definition of `puts'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x3cd): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o:(.rodata+0x10): multiple definition of `g_HexChars'; build/kernel/maintools/stdio.o:(.rodata+0x10):
first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `printf_unsigned':
stdio.c:(.text+0x400): multiple definition of `printf_unsigned'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x400): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `printf_signed':
stdio.c:(.text+0x48a): multiple definition of `printf_signed'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x48a): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `printf':
stdio.c:(.text+0x4d7): multiple definition of `printf'; build/kernel/maintools/stdio.o:stdio.c:(.text+0x4d7): first defined here
x86_64-elf-ld: build/kernel/maintools/stdio.o: in function `print_buffer':
stdio.c:(.text+0xac4): multiple definition of `print_buffer'; build/kernel/maintools/stdio.o:stdio.c:(.text+0xac4): first defined here
x86_64-elf-ld: build/kernel/maintools/x86.o: in function `x86_outb':
x86.c:(.text+0x0): multiple definition of `x86_outb'; build/kernel/maintools/x86.o:x86.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/maintools/x86.o: in function `x86_inb':
x86.c:(.text+0x1d): multiple definition of `x86_inb'; build/kernel/maintools/x86.o:x86.c:(.text+0x1d): first defined here
x86_64-elf-ld: build/kernel/drivers/asm_ports.o: in function `port_byte_in':
asm_ports.c:(.text+0x0): multiple definition of `port_byte_in'; build/kernel/drivers/asm_ports.o:asm_ports.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/asm_ports.o: in function `port_byte_out':
asm_ports.c:(.text+0x1a): multiple definition of `port_byte_out'; build/kernel/drivers/asm_ports.o:asm_ports.c:(.text+0x1a): first defined here
x86_64-elf-ld: build/kernel/drivers/asm_ports.o: in function `port_word_in':
asm_ports.c:(.text+0x37): multiple definition of `port_word_in'; build/kernel/drivers/asm_ports.o:asm_ports.c:(.text+0x37): first defined here
x86_64-elf-ld: build/kernel/drivers/asm_ports.o: in function `port_word_out':
asm_ports.c:(.text+0x53): multiple definition of `port_word_out'; build/kernel/drivers/asm_ports.o:asm_ports.c:(.text+0x53): first defined here
x86_64-elf-ld: build/kernel/drivers/asm_ports.o: in function `port_long_out':
asm_ports.c:(.text+0x70): multiple definition of `port_long_out'; build/kernel/drivers/asm_ports.o:asm_ports.c:(.text+0x70): first defined here
x86_64-elf-ld: build/kernel/drivers/asm_ports.o: in function `port_long_in':
asm_ports.c:(.text+0x84): multiple definition of `port_long_in'; build/kernel/drivers/asm_ports.o:asm_ports.c:(.text+0x84): first defined here
x86_64-elf-ld: build/kernel/drivers/ata.o: in function `read_sectors_ATA_PIO':
ata.c:(.text+0x0): multiple definition of `read_sectors_ATA_PIO'; build/kernel/drivers/ata.o:ata.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/ata.o: in function `write_sectors_ATA_PIO':
ata.c:(.text+0x109): multiple definition of `write_sectors_ATA_PIO'; build/kernel/drivers/ata.o:ata.c:(.text+0x109): first defined here
x86_64-elf-ld: build/kernel/drivers/disk.o: in function `getDiskBytes':
disk.c:(.text+0x0): multiple definition of `getDiskBytes'; build/kernel/drivers/disk.o:disk.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o:(.bss+0x0): multiple definition of `GRUB_PACKED'; build/kernel/drivers/fat32.o:(.bss+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o:(.bss+0x20): multiple definition of `fat'; build/kernel/drivers/fat32.o:(.bss+0x20): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `initiateFat32':
fat32.c:(.text+0x0): multiple definition of `initiateFat32'; build/kernel/drivers/fat32.o:fat32.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `highLowCombiner':
fat32.c:(.text+0x344): multiple definition of `highLowCombiner'; build/kernel/drivers/fat32.o:fat32.c:(.text+0x344): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `getFatEntry':
fat32.c:(.text+0x3a5): multiple definition of `getFatEntry'; build/kernel/drivers/fat32.o:fat32.c:(.text+0x3a5): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `compFilename':
fat32.c:(.text+0x453): multiple definition of `compFilename'; build/kernel/drivers/fat32.o:fat32.c:(.text+0x453): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `followConventionalDirectoryLoop':
fat32.c:(.text+0x485): multiple definition of `followConventionalDirectoryLoop'; build/kernel/drivers/fat32.o:fat32.c:(.text+0x485): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `formatToShort8_3Format':
fat32.c:(.text+0x5b5): multiple definition of `formatToShort8_3Format'; build/kernel/drivers/fat32.o:fat32.c:(.text+0x5b5): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `showCluster':
fat32.c:(.text+0x70e): multiple definition of `showCluster'; build/kernel/drivers/fat32.o:fat32.c:(.text+0x70e): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `showFileByCluster':
fat32.c:(.text+0x923): multiple definition of `showFileByCluster'; build/kernel/drivers/fat32.o:fat32.c:(.text+0x923): first defined here
x86_64-elf-ld: build/kernel/drivers/kb.o:(.bss+0x0): multiple definition of `GRUB_PACKED'; build/kernel/drivers/fat32.o:(.bss+0x0): first defined
here
x86_64-elf-ld: build/kernel/drivers/kb.o:(.data+0x0): multiple definition of `characterTable'; build/kernel/drivers/kb.o:(.data+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/kb.o:(.data+0xa0): multiple definition of `shiftedCharacterTable'; build/kernel/drivers/kb.o:(.data+0xa0): first defined here
x86_64-elf-ld: build/kernel/drivers/kb.o: in function `readStr':
kb.c:(.text+0x0): multiple definition of `readStr'; build/kernel/drivers/kb.o:kb.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/printf.o: in function `_putchar':
printf.c:(.text+0x0): multiple definition of `_putchar'; build/kernel/drivers/printf.o:printf.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/printf.o: in function `printf_':
printf.c:(.text+0x1fa4): multiple definition of `printf_'; build/kernel/drivers/printf.o:printf.c:(.text+0x1fa4): first defined here
x86_64-elf-ld: build/kernel/drivers/printf.o: in function `sprintf_':
printf.c:(.text+0x2067): multiple definition of `sprintf_'; build/kernel/drivers/printf.o:printf.c:(.text+0x2067): first defined here
x86_64-elf-ld: build/kernel/drivers/printf.o: in function `snprintf_':
printf.c:(.text+0x212a): multiple definition of `snprintf_'; build/kernel/drivers/printf.o:printf.c:(.text+0x212a): first defined here
x86_64-elf-ld: build/kernel/drivers/printf.o: in function `vprintf_':
printf.c:(.text+0x21ea): multiple definition of `vprintf_'; build/kernel/drivers/printf.o:printf.c:(.text+0x21ea): first defined here
x86_64-elf-ld: build/kernel/drivers/printf.o: in function `vsnprintf_':
printf.c:(.text+0x2222): multiple definition of `vsnprintf_'; build/kernel/drivers/printf.o:printf.c:(.text+0x2222): first defined here
x86_64-elf-ld: build/kernel/drivers/printf.o: in function `fctprintf':
printf.c:(.text+0x225c): multiple definition of `fctprintf'; build/kernel/drivers/printf.o:printf.c:(.text+0x225c): first defined here
x86_64-elf-ld: build/kernel/drivers/string.o: in function `strchr':
string.c:(.text+0x0): multiple definition of `strchr'; build/kernel/drivers/string.o:string.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/string.o: in function `strcpy':
string.c:(.text+0x44): multiple definition of `strcpy'; build/kernel/drivers/string.o:string.c:(.text+0x44): first defined here
x86_64-elf-ld: build/kernel/drivers/string.o: in function `strlen':
string.c:(.text+0xa9): multiple definition of `strlen'; build/kernel/drivers/string.o:string.c:(.text+0xa9): first defined here
x86_64-elf-ld: build/kernel/drivers/string.o: in function `memcpy':
string.c:(.text+0xd3): multiple definition of `memcpy'; build/kernel/drivers/string.o:string.c:(.text+0xd3): first defined here
x86_64-elf-ld: build/kernel/drivers/string.o: in function `memset':
string.c:(.text+0x12e): multiple definition of `memset'; build/kernel/drivers/string.o:string.c:(.text+0x12e): first defined here
x86_64-elf-ld: build/kernel/drivers/string.o: in function `memcmp':
string.c:(.text+0x16d): multiple definition of `memcmp'; build/kernel/drivers/string.o:string.c:(.text+0x16d): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o:(.bss+0x0): multiple definition of `cursorX'; build/kernel/drivers/tty.o:(.bss+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o:(.bss+0x4): multiple definition of `cursorY'; build/kernel/drivers/tty.o:(.bss+0x4): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o:(.rodata+0x0): multiple definition of `sw'; build/kernel/drivers/tty.o:(.rodata+0x0): first defined herex86_64-elf-ld: build/kernel/drivers/tty.o:(.rodata+0x1): multiple definition of `sh'; build/kernel/drivers/tty.o:(.rodata+0x1): first defined herex86_64-elf-ld: build/kernel/drivers/tty.o:(.rodata+0x2): multiple definition of `sd'; build/kernel/drivers/tty.o:(.rodata+0x2): first defined herex86_64-elf-ld: build/kernel/drivers/tty.o:(.data+0x0): multiple definition of `color'; build/kernel/drivers/tty.o:(.data+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o:(.bss+0x8): multiple definition of `toQEMU'; build/kernel/drivers/tty.o:(.bss+0x8): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o: in function `clearLine':
tty.c:(.text+0x0): multiple definition of `clearLine'; build/kernel/drivers/tty.o:tty.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o: in function `updateCursor':
tty.c:(.text+0xa1): multiple definition of `updateCursor'; build/kernel/drivers/tty.o:tty.c:(.text+0xa1): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o: in function `clearScreen':
tty.c:(.text+0x10d): multiple definition of `clearScreen'; build/kernel/drivers/tty.o:tty.c:(.text+0x10d): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o: in function `scrollUp':
tty.c:(.text+0x149): multiple definition of `scrollUp'; build/kernel/drivers/tty.o:tty.c:(.text+0x149): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o: in function `newLineCheck':
tty.c:(.text+0x23f): multiple definition of `newLineCheck'; build/kernel/drivers/tty.o:tty.c:(.text+0x23f): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o: in function `printfch':
tty.c:(.text+0x265): multiple definition of `printfch'; build/kernel/drivers/tty.o:tty.c:(.text+0x265): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o: in function `set_screen_color':
tty.c:(.text+0x3de): multiple definition of `set_screen_color'; build/kernel/drivers/tty.o:tty.c:(.text+0x3de): first defined here
x86_64-elf-ld: build/kernel/drivers/tty.o: in function `set_screen_color_from_color_code':
tty.c:(.text+0x3fa): multiple definition of `set_screen_color_from_color_code'; build/kernel/drivers/tty.o:tty.c:(.text+0x3fa): first defined herex86_64-elf-ld: build/kernel/drivers/tty.o: in function `printf_colored':
tty.c:(.text+0x40d): multiple definition of `printf_colored'; build/kernel/drivers/tty.o:tty.c:(.text+0x40d): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o:(.bss+0x0): multiple definition of `GRUB_PACKED'; build/kernel/drivers/fat32.o:(.bss+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o:(.bss+0x20): multiple definition of `width'; build/kernel/drivers/vga.o:(.bss+0x20): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o:(.bss+0x24): multiple definition of `height'; build/kernel/drivers/vga.o:(.bss+0x24): first defined herex86_64-elf-ld: build/kernel/drivers/vga.o:(.bss+0x28): multiple definition of `textcolor'; build/kernel/drivers/vga.o:(.bss+0x28): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o:(.data+0x0): multiple definition of `bg_color'; build/kernel/drivers/vga.o:(.data+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o: in function `drawRect':
vga.c:(.text+0x0): multiple definition of `drawRect'; build/kernel/drivers/vga.o:vga.c:(.text+0x0): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o: in function `changeTextColor':
vga.c:(.text+0xec): multiple definition of `changeTextColor'; build/kernel/drivers/vga.o:vga.c:(.text+0xec): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o: in function `changeBg':
vga.c:(.text+0x117): multiple definition of `changeBg'; build/kernel/drivers/vga.o:vga.c:(.text+0x117): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o: in function `drawText':
vga.c:(.text+0x142): multiple definition of `drawText'; build/kernel/drivers/vga.o:vga.c:(.text+0x142): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o: in function `drawPixel':
vga.c:(.text+0x401): multiple definition of `drawPixel'; build/kernel/drivers/vga.o:vga.c:(.text+0x401): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o: in function `drawLine':
vga.c:(.text+0x48a): multiple definition of `drawLine'; build/kernel/drivers/vga.o:vga.c:(.text+0x48a): first defined here
x86_64-elf-ld: build/kernel/drivers/vga.o: in function `changeColor':
vga.c:(.text+0x5d6): multiple definition of `changeColor'; build/kernel/drivers/vga.o:vga.c:(.text+0x5d6): first defined here
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `getFatEntry':
fat32.c:(.text+0x3e5): undefined reference to `malloc'
x86_64-elf-ld: fat32.c:(.text+0x44a): undefined reference to `free'
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `followConventionalDirectoryLoop':
fat32.c:(.text+0x4ae): undefined reference to `strlength'
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `formatToShort8_3Format':
fat32.c:(.text+0x5ef): undefined reference to `strlength'
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `showCluster':
fat32.c:(.text+0x74e): undefined reference to `malloc'
x86_64-elf-ld: fat32.c:(.text+0x916): undefined reference to `free'
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `showFileByCluster':
fat32.c:(.text+0x94d): undefined reference to `malloc'
x86_64-elf-ld: fat32.c:(.text+0x9ce): undefined reference to `free'
x86_64-elf-ld: build/kernel/drivers/kb.o: in function `readStr':
kb.c:(.text+0x2d): undefined reference to `inportb'
x86_64-elf-ld: kb.c:(.text+0x45): undefined reference to `inportb'
x86_64-elf-ld: build/kernel/drivers/tty.o: in function `updateCursor':
tty.c:(.text+0xd0): undefined reference to `outportb'
x86_64-elf-ld: tty.c:(.text+0xe5): undefined reference to `outportb'
x86_64-elf-ld: tty.c:(.text+0xf4): undefined reference to `outportb'
x86_64-elf-ld: tty.c:(.text+0x106): undefined reference to `outportb'
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `getFatEntry':
fat32.c:(.text+0x3e5): undefined reference to `malloc'
x86_64-elf-ld: fat32.c:(.text+0x44a): undefined reference to `free'
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `followConventionalDirectoryLoop':
fat32.c:(.text+0x4ae): undefined reference to `strlength'
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `formatToShort8_3Format':
fat32.c:(.text+0x5ef): undefined reference to `strlength'
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `showCluster':
fat32.c:(.text+0x74e): undefined reference to `malloc'
x86_64-elf-ld: fat32.c:(.text+0x916): undefined reference to `free'
x86_64-elf-ld: build/kernel/drivers/fat32.o: in function `showFileByCluster':
fat32.c:(.text+0x94d): undefined reference to `malloc'
x86_64-elf-ld: fat32.c:(.text+0x9ce): undefined reference to `free'
x86_64-elf-ld: build/kernel/drivers/kb.o: in function `readStr':// these were the logs I was able to collect
And one thing , to make an initrd image , run
sudo mkinitramfs -o targets/x86_64/iso/boot/grub/initrd.img
when running scons I get
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: `build/i686_debug/kernel/kernel-stripped.elf' is up to date.
Assembling [src/bootloader/stage2/x86.asm]
Assembling [src/bootloader/stage2/crtn.asm]
Linking [build/i686_debug/stage2/stage2.bin]
Creating disk image...
> creating partition table...
Kernel not configured for semaphores (System V IPC). Not using udev synchronisation code.
> formatting file using fat32...
scons: *** [build/i686_debug/image.img] ErrorReturnCode_1 :
RAN: /usr/sbin/mkfs.fat build/i686_debug/image.img -F 32 -n NBOS -R 2 --offset=2048
STDOUT:
mkfs.fat 4.1 (2017-01-24)
Unknown option: ?
STDERR:
/usr/sbin/mkfs.fat: unrecognized option '--offset=2048'
Usage: mkfs.fat [-a][-A][-c][-C][-v][-I][-l bad-block-file][-b backup-boot-sector]
[-m boot-msg-file][-n volume-name][-i volume-id]
[-s sectors-per-cluster][-S logical-sector-size][-f number-of-FATs]
[-h hidden-sectors][-F fat-size][-r root-dir-entries][-R reserved-sectors]
[-M FAT-media-byte][-D drive_number]
[--invariant]
[--help]
/dev/name [blocks]
Traceback (most recent call last):
File "/usr/lib/scons/SCons/Action.py", line 1209, in execute
result = self.execfunction(target=target, source=rsources, env=env)
File "/mnt/c/Users/Ben/Downloads/nanobyte_os-master/nanobyte_os-master/image/SConscript", line 235, in build_image
build_disk(image, stage1, stage2, kernel, files, env)
File "/mnt/c/Users/Ben/Downloads/nanobyte_os-master/nanobyte_os-master/image/SConscript", line 176, in build_disk
create_filesystem(image, file_system, offset=partition_offset)
File "/mnt/c/Users/Ben/Downloads/nanobyte_os-master/nanobyte_os-master/image/SConscript", line 39, in create_filesystem
mkfs_fat(target,
File "/home/badgeminer2/.local/lib/python3.8/site-packages/sh.py", line 1524, in __call__
return RunningCommand(cmd, call_args, stdin, stdout, stderr)
File "/home/badgeminer2/.local/lib/python3.8/site-packages/sh.py", line 788, in __init__
self.wait()
File "/home/badgeminer2/.local/lib/python3.8/site-packages/sh.py", line 845, in wait
self.handle_command_exit_code(exit_code)
File "/home/badgeminer2/.local/lib/python3.8/site-packages/sh.py", line 869, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
RAN: /usr/sbin/mkfs.fat build/i686_debug/image.img -F 32 -n NBOS -R 2 --offset=2048
STDOUT:
mkfs.fat 4.1 (2017-01-24)
Unknown option: ?
STDERR:
/usr/sbin/mkfs.fat: unrecognized option '--offset=2048'
Usage: mkfs.fat [-a][-A][-c][-C][-v][-I][-l bad-block-file][-b backup-boot-sector]
[-m boot-msg-file][-n volume-name][-i volume-id]
[-s sectors-per-cluster][-S logical-sector-size][-f number-of-FATs]
[-h hidden-sectors][-F fat-size][-r root-dir-entries][-R reserved-sectors]
[-M FAT-media-byte][-D drive_number]
[--invariant]
[--help]
/dev/name [blocks]
scons: building terminated because of errors.
When trying to run make -s (I'm currently in WSL Ubuntu), it give me this error:
x86.asm:117: error: invalid combination of opcode and operands
x86.asm:126: error: invalid combination of opcode and operands
x86.asm:133: error: invalid combination of opcode and operands
x86.asm:140: error: invalid combination of opcode and operands
make[1]: *** [Makefile:28: /home/.../programming/os/build/stage2/asm/x86.obj] Error 1
make: *** [Makefile:38: /home/.../programming/os/build/stage2.bin] Error 2
I'm running on the WSL version of Ubuntu with all the required dependencies and uses the toolchain from scons toolchain
. When I do a scons run
there are issues when linking.
$ scons run
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
Assembling [src/bootloader/stage1/boot.asm]
Linking [build/i686_debug/stage1_fat32/stage1.bin]
Assembling [src/bootloader/stage2/crti.asm]
Compiling [src/bootloader/stage2/main.cpp]
Compiling [src/bootloader/stage2/cpp/NewDelete.cpp]
Compiling [src/bootloader/stage2/mem/Stage2Allocator.cpp]
Compiling [src/bootloader/stage2/arch/i686/BIOSDisk.cpp]
Assembling [src/bootloader/stage2/entry.asm]
Assembling [src/bootloader/stage2/arch/i686/Disk.asm]
Compiling [src/libs/core/Assert.cpp]
Compiling [src/libs/core/Debug.cpp]
Compiling [src/libs/core/Memory.cpp]
Compiling [src/libs/core/String.cpp]
Compiling [src/libs/core/cpp/CppSupport.cpp]
Compiling [src/libs/core/dev/RangeBlockDevice.cpp]
Compiling [src/libs/core/dev/TextDevice.cpp]
Compiling [src/libs/core/fs/FATFileSystem.cpp]
Compiling [src/libs/core/fs/FileSystem.cpp]
Compiling [src/libs/core/arch/i686/E9Device.cpp]
Compiling [src/libs/core/arch/i686/VGATextDevice.cpp]
Compiling [src/libs/core/fs/fat/FATFile.cpp]
Compiling [src/libs/core/fs/fat/FATFileEntry.cpp]
Assembling [src/libs/core/MemoryAsm.asm]
Assembling [src/libs/core/arch/i686/IO.asm]
Archiving [build/i686_debug/libs/core/libcore.o]
Ranlib [build/i686_debug/libs/core/libcore.o]
Assembling [src/bootloader/stage2/crtn.asm]
Linking [build/i686_debug/stage2/stage2.elf]
build/i686_debug/stage2/main.o:(.rodata._ZTV15CharacterDevice[vtable for CharacterDevice]+0x10): undefined reference to `__cxa_pure_virtual'
build/i686_debug/stage2/main.o:(.rodata._ZTV15CharacterDevice[vtable for CharacterDevice]+0x14): undefined reference to `__cxa_pure_virtual'
build/i686_debug/stage2/mem/Stage2Allocator.o:(.rodata._ZTV9Allocator[vtable for Allocator]+0x8): undefined reference to `__cxa_pure_virtual'
build/i686_debug/stage2/mem/Stage2Allocator.o:(.rodata._ZTV9Allocator[vtable for Allocator]+0xc): undefined reference to `__cxa_pure_virtual'
build/i686_debug/stage2/arch/i686/BIOSDisk.o:(.rodata._ZTV11BlockDevice[vtable for BlockDevice]+0x10): undefined reference to `__cxa_pure_virtual'
build/i686_debug/stage2/arch/i686/BIOSDisk.o:(.rodata._ZTV11BlockDevice[vtable for BlockDevice]+0x14): more undefined references to `__cxa_pure_virtual' follow
collect2: error: ld returned 1 exit status
scons: *** [build/i686_debug/stage2/stage2.elf] Error 1
scons: building terminated because of errors.$ scons run
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
Assembling [src/bootloader/stage1/boot.asm]
Linking [build/i686_debug/stage1_fat32/stage1.bin]
Assembling [src/bootloader/stage2/crti.asm]
Compiling [src/bootloader/stage2/main.cpp]
Compiling [src/bootloader/stage2/cpp/NewDelete.cpp]
Compiling [src/bootloader/stage2/mem/Stage2Allocator.cpp]
Compiling [src/bootloader/stage2/arch/i686/BIOSDisk.cpp]
Assembling [src/bootloader/stage2/entry.asm]
Assembling [src/bootloader/stage2/arch/i686/Disk.asm]
Compiling [src/libs/core/Assert.cpp]
Compiling [src/libs/core/Debug.cpp]
Compiling [src/libs/core/Memory.cpp]
Compiling [src/libs/core/String.cpp]
Compiling [src/libs/core/cpp/CppSupport.cpp]
Compiling [src/libs/core/dev/RangeBlockDevice.cpp]
Compiling [src/libs/core/dev/TextDevice.cpp]
Compiling [src/libs/core/fs/FATFileSystem.cpp]
Compiling [src/libs/core/fs/FileSystem.cpp]
Compiling [src/libs/core/arch/i686/E9Device.cpp]
Compiling [src/libs/core/arch/i686/VGATextDevice.cpp]
Compiling [src/libs/core/fs/fat/FATFile.cpp]
Compiling [src/libs/core/fs/fat/FATFileEntry.cpp]
Assembling [src/libs/core/MemoryAsm.asm]
Assembling [src/libs/core/arch/i686/IO.asm]
Archiving [build/i686_debug/libs/core/libcore.o]
Ranlib [build/i686_debug/libs/core/libcore.o]
Assembling [src/bootloader/stage2/crtn.asm]
Linking [build/i686_debug/stage2/stage2.elf]
build/i686_debug/stage2/main.o:(.rodata._ZTV15CharacterDevice[vtable for CharacterDevice]+0x10): undefined reference to `__cxa_pure_virtual'
build/i686_debug/stage2/main.o:(.rodata._ZTV15CharacterDevice[vtable for CharacterDevice]+0x14): undefined reference to `__cxa_pure_virtual'
build/i686_debug/stage2/mem/Stage2Allocator.o:(.rodata._ZTV9Allocator[vtable for Allocator]+0x8): undefined reference to `__cxa_pure_virtual'
build/i686_debug/stage2/mem/Stage2Allocator.o:(.rodata._ZTV9Allocator[vtable for Allocator]+0xc): undefined reference to `__cxa_pure_virtual'
build/i686_debug/stage2/arch/i686/BIOSDisk.o:(.rodata._ZTV11BlockDevice[vtable for BlockDevice]+0x10): undefined reference to `__cxa_pure_virtual'
build/i686_debug/stage2/arch/i686/BIOSDisk.o:(.rodata._ZTV11BlockDevice[vtable for BlockDevice]+0x14): more undefined references to `__cxa_pure_virtual' follow
collect2: error: ld returned 1 exit status
scons: *** [build/i686_debug/stage2/stage2.elf] Error 1
scons: building terminated because of errors.
``
Request for adding graphics , mouse, keyboard support
When i follow the steps in the description, i try to run "scons toolchain", but i get this instead..
scons: Reading SConscript files ...
scons: *** Multiple ways to build the same target were specified for: arch/i686/gdt.o (from ['/mnt/c/Users/[...]/Documents/OS/src/kernel/arch/i686/gdt.c'] and from ['/mnt/c/Users/[...]/Documents/OS/src/kernel/arch/i686/gdt.asm'])
File "/mnt/c/Users/[...]/Documents/OS/src/kernel/SConscript", line 25, in
scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... Linking [build/i686_debug/stage1_fat32/stage1.bin] /usr/bin/ld: i386 architecture of input file
build/i686_debug/stage1_fat32/boot.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status
scons: *** [build/i686_debug/stage1_fat32/stage1.bin] Error 1
scons: building terminated because of errors.
mkdir -p build
nasm src/bootloader/boot.asm -f bin -o build/bootloader.bin
nasm src/kernel/main.asm -f bin -o build/kernel.bin
src/kernel/main.asm:57: warning: label alone on a line without a colon might be in error [-w+label-orphan]
dd if=/dev/zero of=build/main_floppy.img bs=512 count=2880
2880+0 records in
2880+0 records out
1474560 bytes (1.5 MB, 1.4 MiB) copied, 0.344191 s, 4.3 MB/s
mkfs.fat -F 12 -n "NBOS" build/main_floppy.img
mkfs.fat 4.2 (2021-01-31)
dd if=build/bootloader.bin of=build/main_floppy.img conv=notrunc
1+0 records in
1+0 records out
512 bytes copied, 0.0012618 s, 406 kB/s
mcopy -i build/main_floppy.img build/kernel.bin "::kernel.bin"
/bin/sh: 1: mcopy: Permission denied
make: *** [Makefile:17: build/main_floppy.img] Error 127
What file would I use to make the OS boot?
From part2/debug.sh
Simply running "bochs" on Windows, the "option=gui-debug" will be said to be not found
When I run scons run
it gives me an error from libguestfs.
Ubuntu LTS 22
in src/main.asm I think there is a : missing on line 57
happens with make
i am on part 3
Makefile:
ASM=nasm
CC=gcc
SRC_DIR=src
TOOLS_DIR=tools
BUILD_DIR=build
.PHONY: all floppy_image kernel bootloader clean always tools_fat
all: floppy_image tools_fat
#
# Floppy image
#
floppy_image: $(BUILD_DIR)/main_floppy.img
$(BUILD_DIR)/main_floppy.img: bootloader kernel
dd if=/dev/zero of=$(BUILD_DIR)/main_floppy.img bs=512 count=2880
mkfs.fat -F 12 -n "NBOS" $(BUILD_DIR)/main_floppy.img
dd if=$(BUILD_DIR)/bootloader.bin of=$(BUILD_DIR)/main_floppy.img conv=notrunc
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/kernel.bin "::kernel.bin"
mcopy -i $(BUILD_DIR)/main_floppy.img test.txt "::test.txt"
#
# Bootloader
#
bootloader: $(BUILD_DIR)/bootloader.bin
$(BUILD_DIR)/bootloader.bin: always
$(ASM) $(SRC_DIR)/bootloader/boot.asm -f bin -o $(BUILD_DIR)/bootloader.bin
#
# Kernel
#
kernel: $(BUILD_DIR)/kernel.bin
$(BUILD_DIR)/kernel.bin: always
$(ASM) $(SRC_DIR)/kernel/main.asm -f bin -o $(BUILD_DIR)/kernel.bin
#
# Tools
#
tools_fat: $(BUILD_DIR)/tools/fat
$(BUILD_DIR)/tools/fat: always $(TOOLS_DIR)/fat/fat.c
mkdir -p $(BUILD_DIR)/tools
$(CC) -g -o $(BUILD_DIR)/tools/fat $(TOOLS_DIR)/fat/fat.c
#
# Always
#
always:
mkdir -p $(BUILD_DIR)
#
# Clean
#
clean:
rm -rf $(BUILD_DIR)/*
Line 57 in ba9def4
Change to .halt:
shadowblitz16@Node202-Debian:~/Downloads/nanobyte_os-b8688b1e70fd91dbb1c0162f42c3b672071b4e82$ scons toolchain
...
checking where to find the target windres... just compiled
checking where to find the target windmc... just compiled
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile
make: *** binutils-build-2.37: No such file or directory. Stop.
scons: *** [toolchain] Error 2
scons: building terminated because of errors.
dear nanobyte,
You have to implement the keyboard, mouse , and scrolling support . You have to implement these on Ep10 files .
No matter what I try, I get the same error when trying to compile on Windows
WSL(Ubuntu) with NASM:
nasm os.asm -f bin -o os.bin
os.asm:1: error: parser: instruction expected
org 0x7C00
bits 16
main:
hlt
.halt:
jmp .halt
times 510-($-$$) db 0
dw 0AA55h
Since nanobyte is using Linux, and I use MacOS, I can't get the Makefile to work. The most common error I am facing is related to command not found, like mkfs.fat isn't real in MacOS.
In file /src/kernel/arch/i686/i8259.c
Line 136:
return ((uint16_t)i686_inb(PIC2_COMMAND_PORT)) | (((uint16_t)i686_inb(PIC2_COMMAND_PORT)) << 8);
I am not sure, but doesn't it have to be:
return ((uint16_t)i686_inb(PIC1_COMMAND_PORT)) | (((uint16_t)i686_inb(PIC2_COMMAND_PORT)) << 8);
The same issue on line 143.
The latest version of this repository, when trying to compile, returns a "multiple definition" error because PIC_ICW1, PIC_ICW4 and PIC_CMD already exist in pic.c, the fix is to rename the one in i8256.c or pic.c.
Hi! First, you are the best OS making tutor! But QEMU is not booting up for me.
Command: qemu-system-i386 -fda orangeos-img.img
Output:
Unable to init server: Could not connect: Connection refused
WARNING: Image format was not specified for 'orangeos-img.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
gtk initialization failed
File Structure:
OrangeOs
|
--->/src
|
---> boot.asm
--->/dist
|
---> orangeos-img.img
---> boot.bin
--->Makefile
Is it related to me not having a Linux server?
Hi again.
I'm getting a new error, but now its with bochs.
I have sdl on my system and i have tried with the official bochs package and the aur package bochs-sdl but it does not work.
I get this:
Bochs x86 Emulator 2.7
Built from SVN snapshot on August 1, 2021
Timestamp: Sun Aug 1 10:07:00 CEST 2021
00000000000i[ ] BXSHARE not set. using compile time default '/usr/share/bochs'
00000000000i[ ] reading configuration from bochs_config
00000000000p[ ] >>PANIC<< bochs_config:7: display library 'sdl2' not available
00000000000e[SIM ] notify called, but no bxevent_callback function is registered
00000000000e[SIM ] notify called, but no bxevent_callback function is registered
Bochs is exiting with the following message:
[ ] bochs_config:7: display library 'sdl2' not available
00000000000i[SIM ] quit_sim called with exit code 1
and i have no clue of why it cant find sdl2.
i needed to take out all the = signs in the error message so the markdown doesn't f*ck up the message.
this is the config file:
megs: 128
romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xfffe0000
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
floppya: 1_44=build/main_floppy.img, status=inserted
boot: floppy
mouse: enabled=0
display_library: sdl2, options="gui_debug"
I tried to run scons toolchain
on a WSL2 Ubuntu environment. I have installed all the dependencies.
But I get this
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
./scripts/setup_toolchain.sh ../.toolchains
sh: 1: ./scripts/setup_toolchain.sh: not found
scons: *** [toolchain] Error 127
scons: building terminated because of errors.
It's saying the setup_toolchain script does not exist. But it does.
Also, this is not a duplicate of #16.
Request for graphics tutorial of making os
I rebuilt .img .iso
and it turned out that the OS version from the first part does not support UEFI. What should I do?
When running sudo apt install qemu-system-x86, it returns an error stating "Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?". I tried as the error suggested, but neither worked. apt-get update complains that the jammy-security and jammy-updates InRelease repo isn't valid for another 1 day and 22 hours, and --fix-missing complains that "ordering was unable to handle the media swap". I kinda need to get this working because right now I'm currently stuck with virtual box, which is producing some really weird and vague errors. I'm running the Windows Subsystem for Linux on a Windows 11 Home host machine. Any help would be appreciated, thanks.
First of all, I'm using Part10 instead of Part11 because I'm not that fond of using SCons as a build system and I want to stick with Make.
I've double-checked all of my code, and it's the same as the source code on the repo.
But whenever I boot with QEMU, It prints out this:
Hello World From Kernel!
Unhandled Exception: Segment Not Present
EAX=0 EBX=2500 ECX=0 EDX=100b2d ESI=7e19 EDI=245c
ESP=10005e EBP=ffa4 EIP=1000ba EFLAGS=202 CS=8 DS=10 SS=100000
Interrupt=b Error=402
KERNEL PANIC!
Please let me know if I'm doing anything wrong or if I should provide something.
I kept getting
shadowblitz16@Node202-Debian:~/Documents/source/OS/Nano$ scons toolchain
scons: Reading SConscript files ...
TypeError: 'NoneType' object cannot be interpreted as an integer:
File "/home/shadowblitz16/Documents/source/OS/Nano/SConstruct", line 139:
SConscript('src/bootloader/stage2/SConscript', variant_dir=variantDir + '/stage2', duplicate=0)
File "/home/shadowblitz16/.local/lib/python3.9/site-packages/SCons/Script/SConscript.py", line 660:
return method(*args, **kw)
File "/home/shadowblitz16/.local/lib/python3.9/site-packages/SCons/Script/SConscript.py", line 597:
return _SConscript(self.fs, *files, **subst_kw)
File "/home/shadowblitz16/.local/lib/python3.9/site-packages/SCons/Script/SConscript.py", line 285:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/home/shadowblitz16/Documents/source/OS/Nano/src/bootloader/stage2/SConscript", line 26:
obj_crti = objects.pop(FindIndex(objects, lambda item: IsFileName(item, 'crti.o')))
File "/usr/lib/python3.9/collections/__init__.py", line 1229:
return self.data.pop(i)
everywhere because
def FindIndex(the_list, predicate):
for i in range(len(the_list)):
if predicate(the_list[i]):
return i
return None
should be...
def FindIndex(the_list, predicate):
for i in range(len(the_list)):
if predicate(the_list[i]):
return i
return -1
in build_scripts/utility.py
this is so confusing.
It works fine on a VM, but when i try to flash the image to a usb stick with dd and boot on physical hardware i get
Loading...
KERNEL.BIN file not found!
and when i mount the usb stick i find both test.txt and kernel.bin on there so i dont understand why it dont find the file.
Creating disk image...
> creating partition table...
> formatting file using fat32...
> installing stage1...
> installing stage2...
> mounting image to build/i686_debug/tmp_mount_1674479016...
> cleaning up...
scons: *** [build/i686_debug/image.img] ErrorReturnCode_1 :
RAN: /usr/bin/guestmount build/i686_debug/tmp_mount_1674479016 --add=build/i686_debug/image.img --mount=/dev/sda1
STDOUT:
STDERR:
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x559d5aed8500, program = guestmount
libguestfs: trace: set_recovery_proc false
libguestfs: trace: set_recovery_proc = 0
libguestfs: trace: add_drive "build/i686_debug/image.img"
libguestfs: trace: add_drive = 0
libguestfs: trace: launch
libguestfs: trace: max_disks
libguestfs: trace: max_disks = 255
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: version
libguestfs: trace: version = <struct guestfs_version = major: 1, minor: 46, release: 2, extra: , >
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "direct"
libguestfs: launch: program=guestmount
libguestfs: launch: version=1.... (3478 more, please see e.stderr)
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/SCons/Action.py", line 1280, in execute
result = self.execfunction(target=target, source=rsources, env=env)
File "/home/sytze/nanobyte_os/image/SConscript", line 235, in build_image
build_disk(image, stage1, stage2, kernel, files, env)
File "/home/sytze/nanobyte_os/image/SConscript", line 193, in build_disk
mount_fs(image, tempdir)
File "/home/sytze/nanobyte_os/image/SConscript", line 152, in mount_fs
sh.guestmount(mount_dir, add=image, mount='/dev/sda1')
File "/usr/local/lib/python3.10/dist-packages/sh.py", line 1524, in __call__
return RunningCommand(cmd, call_args, stdin, stdout, stderr)
File "/usr/local/lib/python3.10/dist-packages/sh.py", line 788, in __init__
self.wait()
File "/usr/local/lib/python3.10/dist-packages/sh.py", line 845, in wait
self.handle_command_exit_code(exit_code)
File "/usr/local/lib/python3.10/dist-packages/sh.py", line 869, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
RAN: /usr/bin/guestmount build/i686_debug/tmp_mount_1674479016 --add=build/i686_debug/image.img --mount=/dev/sda1
STDOUT:
STDERR:
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x559d5aed8500, program = guestmount
libguestfs: trace: set_recovery_proc false
libguestfs: trace: set_recovery_proc = 0
libguestfs: trace: add_drive "build/i686_debug/image.img"
libguestfs: trace: add_drive = 0
libguestfs: trace: launch
libguestfs: trace: max_disks
libguestfs: trace: max_disks = 255
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: version
libguestfs: trace: version = <struct guestfs_version = major: 1, minor: 46, release: 2, extra: , >
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "direct"
libguestfs: launch: program=guestmount
libguestfs: launch: version=1.... (3478 more, please see e.stderr)
scons: building terminated because of errors.
windows cannot mount the image and wsl2 gives this error
I duplicated the boot.asm code and it halts in the middle of the puts routine.
Using the qemu command from the video in a terminal with the addition of the -nographic switch.
Added a couple of earlier puts calls to see if that works, see output, they do.
It's the call to puts msg_hello that grinds to a halt...
Any help please?
Below first a part of the code, that the output of my test.
===================== CODE
main:
; setup data segments
mov ax,0 ; can't write to ds/es directly
mov ds, ax
mov es, ax
; setup stack segment
mov ss, ax
mov sp, 0xC700 ; stack grows downwards from where we are loaded in memory
; print message
mov si, msg_read_starts
call puts
; read something from floppy disk
; BIOS should set DL to drive number
mov [ebr_drive_number], dl
mov ax, 1 ; LBA = 1, second sector from disk
mov cl, 1 ; 1 sector to read
mov bx, 0x7E00 ; data should be after the bootloader
call disk_read
; print message
mov si, msg_read_okay
call puts
; print message
mov si, msg_hello
call puts
cli ; disable interrupts, this way CPU can't get out of 'halt' state
hlt
===================== TEST OUTPUT
SeaBIOS (version 1.16.2-debian-1.16.2-1)
iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+06FCF160+06F0F160 CA00
Booting from Hard Disk...
Boot failed: could not read the boot disk
Booting from Floppy...
Read from disk started
Read from disk finished okay
gawOS 0.1 startin
I am on part 3 of your tutorial.
32:48 in the video you compile but my thing does not compile.
i get this error:
src/bootloader/boot.asm:363: error: TIMES value -13 is negative
make: *** [Makefile:30: build/bootloader.bin] Error 1
here is my boot.asm file:
org 0x7C00
bits 16
%define ENDL 0x0D, 0x0A
;;
;; FAT12 header
;;
jmp short start
nop
bdb_oem: db 'MSWIN4.1' ; 8 bytes
bdb_bytes_per_sector: dw 512
bdb_sectors_per_cluster: db 1
bdb_reserved_sectors: dw 1
bdb_fat_count: db 2
bdb_dir_entries_count: dw 0E0h
bdb_total_sectors: dw 2880 ; 2880 * 512 = 1.44MB
bdb_media_descriptor_type: db 0F0h ; F0 = 3.5" floppy disk
bdb_sectors_per_fat: dw 9 ; 9 sectors/fat
bdb_sectors_per_track: dw 18
bdb_heads: dw 2
bdb_hidden_sectors: dd 0
bdb_large_sector_count: dd 0
; extended boot record
ebr_drive_number: db 0 ; 0x00 floppy, 0x80 hdd, useless
db 0 ; reserved
ebr_signature: db 29h
ebr_volume_id: db 12h, 34h, 56h, 78h ; serial number, value doesn't matter
ebr_volume_label: db 'NANOBYTE OS' ; 11 bytes, padded with spaces
ebr_system_id: db 'FAT12 ' ; 8 bytes
;;
;; Code goes here
;;
start:
; setup data segments
mov ax, 0 ; can't write to ds/es directly
mov ds, ax
mov es, ax
; setup stack
mov ss, ax
mov sp, 0x7C00 ; stack grows downwards from where we are loaded in memory
; some BIOSes might start us at 07C0:0000 instead of 0000:7C00, make sure we are in the
; expected location
push es
push word .after
retf
.after:
; read something from floppy disk
; BIOS should set dl to drive number
mov [ebr_drive_number], dl
; show loading message
mov si, msg_loading
call puts
; read drive parameter (sectors per track and head count),
; insted of relying on data on formatted disk
push es
mov ah, 08h
int 13h
jc floppy_error
pop es
and cl, 0x3F ; remove top 2 bits
xor ch, ch
mov [bdb_sectors_per_track], cx ; sector count
inc dh
mov [bdb_heads], dh ; head count
; compute LBA of root firectory = reserved + fats * sectors_per_fat
mov ax, [bdb_sectors_per_fat] ; LBA of root = reserved + fats * fat_size
mov bl, [bdb_fat_count]
xor bh, bh
mul bx ; ax = (fats * sectors_per_fat)
add ax, [bdb_reserved_sectors] ; ax = LBA of root directory
push ax
; compute size of root directory = (32 * number_of_entries) / bytes_per_sector
mov ax, [bdb_sectors_per_fat]
shl ax, 5 ; ax *= 32
xor dx, dx ; dx = 0
div word [bdb_bytes_per_sector] ; number of sectors we need to read
test dx, dx ; if dx != 0, add 1
jz .root_dir_after
inc ax ; division remainder != 0, add 1
; this means we have a sector only partially filled with entries
.root_dir_after:
; read root directory
mov cl, al ; number of sectors to read = size of root directory
pop ax ; ax = LBA of root firectory
mov dl, [ebr_drive_number] ; dl = drive number (we saved it previously)
mov bx, buffer ; es:bx = buffer
call disk_read
; search for kernel.bin
xor bx, bx
mov di, buffer
.search_kernel:
mov si, file_kernel_bin
mov cx, 11 ; compare up to 11 characters
push di
repe cmpsb
pop di
je .found_kernel
add di, 32
inc bx
cmp bx, [bdb_dir_entries_count]
jl .search_kernel
; kernel not found
jmp kernel_not_found_error
.found_kernel:
; di should have the address to the entry
mov ax, [di + 26] ; first logical cluster field (offset 26)
mov [kernel_cluster], ax
; load FAT
mov ax, [bdb_reserved_sectors]
mov bx, buffer
mov cl, [bdb_sectors_per_fat]
mov dl, [ebr_drive_number]
call disk_read
; read kernel and proccess FAT chain
mov bx, KERNEL_LOAD_SEGMENT
mov es, bx
mov bx, KERNEL_LOAD_OFFSET
.load_kernel_loop:
; Read next cluster
mov ax, [kernel_cluster]
; not nice :( hardcoded value
add ax, 31 ; first cluster = (kernel_cluster - 2) * sectors_per_cluster + start_sector
; start sector = reserved + fats + root directory size = 1 +18 + 134 = 33
mov cl, 1
mov dl, [ebr_drive_number]
call disk_read
add bx, [bdb_bytes_per_sector]
; compute location of next cluster
mov ax, [kernel_cluster]
mov cx, 3
mul cx
mov cx, 2
div cx ; ax = index of entry in FAT, dx = cluster mod 2
mov si, buffer
add si, ax
mov ax, [ds:si] ; read entry from FAT table at index ax
or dx, dx
jz .even
.odd:
shr ax, 4
jmp .next_cluster_after
.even:
and ax, 0x0FFF
.next_cluster_after:
cmp ax, 0x0FF8 ; end of chain
jae .read_finish
mov [kernel_cluster], ax
jmp .load_kernel_loop
.read_finish:
; jump to our kernel
mov dl, [ebr_drive_number] ; boot device in dl
mov ax, KERNEL_LOAD_SEGMENT ; set segment registers
mov ds, ax
mov es, ax
JMP KERNEL_LOAD_SEGMENT:KERNEL_LOAD_OFFSET
jmp wait_key_and_reboot ; should never happen
cli
hlt
;;
;; Error handlers
;;
floppy_error:
mov si, msg_read_failed
call puts
jmp wait_key_and_reboot
kernel_not_found_error:
mov si, msg_kernel_not_found
call puts
jmp wait_key_and_reboot
wait_key_and_reboot:
mov ah, 0
int 16h ; wait for keypress
jmp 0FFFFh:0 ; jump to beginning of BIOS, should reboot
.halt:
cli ; disable interrupts, this way CPU can't get out od "halt" state
hlt
;;
;; Prints a string to the screen.
;; Params:
;; - ds:si points to string
;;
puts:
; save registers we will modify
push si
push ax
push bx
.loop:
lodsb ; loads nextcharacter in al
or al, al ; verify if next character is null?
jz .done
mov ah, 0x0E
mov bh, 0
int 0x10
jmp .loop
.done:
pop ax
pop si
ret
;;
;; Disk routines
;;
;;
;; Converts an LBA address to a CHS address
;; Parameters:
;; - ax: LBA address
;; Returns:
;; - cx (bits 0-5): sector number
;; - cx (bits 6-15): cylinder
;; - dh: head
;;
lba_to_chs:
push ax
push dx
xor dx, dx ; dx = 0
div word [bdb_sectors_per_track] ; ax = LBA / SectorsPerTrack
; dx = LBA % SectorsPerTrack
inc dx ; dx = (LBA % SectorsPerTrack + 1) = sector
mov cx, dx ; cx = sector
xor dx, dx ; dx = 0
div word [bdb_heads] ; ax = (LBA / SectorsPerTrack) / Heads = cylinder
; dx = (LBA / SectorsPerTrack) % Heads = head
mov dh, dl ; dh =head
mov ch, al ; ch = cylinde (lower 8 bits)
shl ah, 6
or cl, ah ; put upper 2 bits of cylinder in cl
pop ax
mov dl, al ; restore DL
pop ax
ret
;;
;; Reads sectors from a disk
;; Parameters:
;; - ax: LBA address
;; - cl: number of sectors to read (up to 128)
;; - dl: drive number
;; - es:bx: memory address where to store read data
;;
disk_read:
push ax ; save registers we will modify
push bx
push cx
push dx
push di
push cx ; temporarily save CL (number of sectors to read)
call lba_to_chs ; compute CHS
pop ax ; AL = number of sectors to read
mov ah, 02h
mov di, 3 ; retry count
.retry:
pusha ; save all registers, we don't, know what bios modifies
stc ; set carry flag, some BIOS'es don't set it
int 13h ;carry flag cleared = success
jnc .done
; failed
popa
call disk_reset
dec di
test di, di
jnz .retry
.fail:
; all attempts are exhausted
jmp floppy_error
.done:
popa
pop ax ; restore registers modified
pop bx
pop cx
pop dx
pop di
ret
;;
;; Resets disk controller
;; Parameters:
;; dl: drive number
disk_reset:
pusha
mov ah, 0
stc
int 13h
jc floppy_error
popa
ret
file_kernel_bin: db 'KERNEL BIN'
msg_loading: db 'Loading...',ENDL, 0
msg_kernel_not_found: db 'Kernel could not be found...', ENDL, 0
msg_read_failed: db 'The read of disk did not succeed...', ENDL, 0
kernel_cluster: dw 0
KERNEL_LOAD_SEGMENT equ 0x2000
KERNEL_LOAD_OFFSET equ 0
times 510-($-$$) db 0
dw 0AA55h
buffer:
here is the line it complains about:
times 510-($-$$) db 0
Hi im near 8:50 in your first video in the tutorial series and i am getting this error when i try running make:
Makefile:7: *** missing separator. Stop.
Here is my Makefile:
ASM=nasm
SRC_DIR=src
BUILD_DIR=build
$(BUILD_DIR)/main_floppy.img: $(BUILD_DIR)/main.bin
cp $(BUILD_DIR)/main.bin $(BUILD_DIR)/main_floppy.img
truncate -s 1440k $(BUILD_DIR)/main_floppy.img
$(BUILD_DIR)/main.bin: $(SRC_DIR)/main.asm
$(ASM) $(SRC_DIR)/main.asm -f bin -o $(BUILD_DIR)/main.bin
Here is the output of the nice command tree:
. |-- Makefile |-- build
-- src
-- main.asm
my os is Arch linux.
heres a neofetch of the system:
OS: Arch Linux x86_64
Kernel: 5.18.16-arch1-1
Uptime: 33 mins
Packages: 1218 (pacman)
Shell: zsh 5.9
Resolution: 2560x1440
WM: herbstluftwm
Theme: Adwaita [GTK2], Dracula-alt-style [GTK3]
Icons: Adwaita [GTK2], dracula-icons-main [GTK3]
CPU: Intel i5-9400F (6) @ 4.100GHz
GPU: NVIDIA GeForce GTX 1660 Ti
Memory: 1879MiB / 15915MiB
`
the version of make is 4.3
afif@DESKTOP-TTPU2G3:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs$ make
make[1]: Entering directory '/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/bootloader/stage1'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/bootloader/stage1'
make[1]: Entering directory '/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/bootloader/stage2'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/bootloader/stage2'
make[1]: Entering directory '/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel'
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/mouse.obj: in function `inportb':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:9: multiple definition of `inportb'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:9: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/mouse.obj: in function `outportb':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:15: multiple definition of `outportb'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:15: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/mouse.obj: in function `IRQ_set_mask':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:27: multiple definition of `IRQ_set_mask'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:27: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/mouse.obj: in function `IRQ_clear_mask':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:42: multiple definition of `IRQ_clear_mask'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:42: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/mouse.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/isr.h:46: multiple definition of `interrupt_handlers'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/./arch/i686/isr.h:46: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/mouse.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/mouse.h:9: multiple definition of `mouse_cycle'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/mouse.h:9: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/mouse.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/mouse.h:10: multiple definition of `mouse_byte'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/mouse.h:10: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/mouse.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/mouse.h:12: multiple definition of `mouse_x'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/mouse.h:12: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/mouse.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/mouse.h:13: multiple definition of `mouse_y'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/mouse.h:13: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/sys.obj: in function `inportb':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/sys.c:7: multiple definition of `inportb'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:9: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/sys.obj: in function `outportb':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/sys.c:14: multiple definition of `outportb'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:15: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/hal/hal.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/./arch/i686/isr.h:46: multiple definition of `interrupt_handlers'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/./arch/i686/isr.h:46: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/arch/i686/i8259.obj: in function `inportb':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:9: multiple definition of `inportb'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:9: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/arch/i686/i8259.obj: in function `outportb':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:15: multiple definition of `outportb'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:15: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/arch/i686/i8259.obj: in function `IRQ_set_mask':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:27: multiple definition of `IRQ_set_mask'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:27: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/arch/i686/i8259.obj: in function `IRQ_clear_mask':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:42: multiple definition of `IRQ_clear_mask'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:42: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/arch/i686/irq.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/isr.h:46: multiple definition of `interrupt_handlers'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/./arch/i686/isr.h:46: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/arch/i686/irq.obj: in function `inportb':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:9: multiple definition of `inportb'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:9: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/arch/i686/irq.obj: in function `outportb':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:15: multiple definition of `outportb'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/sys.h:15: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/arch/i686/irq.obj: in function `IRQ_set_mask':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:27: multiple definition of `IRQ_set_mask'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:27: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/arch/i686/irq.obj: in function `IRQ_clear_mask':
/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:42: multiple definition of `IRQ_clear_mask'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/pic.h:42: first defined here
/usr/local/i386elfgcc/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/arch/i686/isr.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/arch/i686/isr.h:46: multiple definition of `interrupt_handlers'; /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel/c/main.obj:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel/./arch/i686/isr.h:46: first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:40: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel.bin] Error 1
make[1]: Leaving directory '/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/src/kernel'
make: *** [Makefile:46: /mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs/build/kernel.bin] Error 2
afif@DESKTOP-TTPU2G3:/mnt/c/Users/User/Desktop/orzen-dos/buildenv/somelogs$
Not an issue I guess. but eh. took ages to hack together.
in the end I just installed some stuff
https://catalog.s.download.windowsupdate.com/c/msdownload/update/software/updt/2022/11/windows10.0-kb5020030-x64_ec78cc08e60e0b81f0bb520bd328720979d75065.msu (wsl2 support since I lacked it)
sudo dpkg -i linux-modules-5.15.0-79-generic_5.15.0-79.86_amd64.deb and vmlinuz-5.15.0-79-generic
and did some dos2unix fixes. think that was about it. If that helps anyone else insane enough to try that
I wrote everything and created all files on arch linux.
I got an error when runing make:
dima@arch:~/os $ make
nasm src/main.asm -f bin -o build/main.bin
make: nasm: No such file or directory
make: *** [Makefile:11: build/main.bin] Error 127
dima@arch:~/os $ ls
Makefile src
dima@arch:~/os $
I have all the files in the right directories, all the same.
Thank you for helping.
I'm getting the error "main.c(8): Error! E1118: FATAL No such file or directory" and main.c(8) is the last line. It's empty!
It's the spot where it's Hello World from C (this is from the 4th episode)
During the "make toolchain" part of initial setup, Tar hangs after extracting binutils and gcc. In the case of binutils, it succeeds after a while and continues with the setup, but this does not happen when extracting gcc.
I am running Visual Studio Code in Windows 11 Home using a wsl ubuntu terminal.
Earlier on in the tutorial, I attempted to run the kernel using the template code to show how it reacts to interrupts. However, this code would cause virtualbox's guru to trigger, and infinitely restart qemu. After implementing the error handling for the kernel, i ran the same code again. The error is an Unhandled exception 2 Non-maskable Interrupt. Why is this happening when in the tutorial it worked fine? I'm using Ubuntu running on the Windows subsystem for Linux, running in a Windows 11 Home laptop.
I can't copy all of it because the whole thing is bigger then the terminal buffer but basically I am getting these kind of errors...
/usr/bin/mkdir: cannot create directory ‘/share’: Permission denied
make[5]: *** [Makefile:1053: install-info-am] Error 1
/bin/bash ./libtool --mode=install /usr/bin/install -c gprof '/bin'
libtool: install: /usr/bin/install -c gprof /bin/gprof
/usr/bin/install: cannot remove '/bin/gprof': Permission denied
make[5]: *** [Makefile:541: install-binPROGRAMS] Error 1
make[5]: Leaving directory '/home/shadowblitz16/Documents/source/OS/Nano/build_deps/binutils-build-2.37/gprof'
make[4]: *** [Makefile:951: install-am] Error 2
make[4]: Leaving directory '/home/shadowblitz16/Documents/source/OS/Nano/build_deps/binutils-build-2.37/gprof'
make[3]: *** [Makefile:837: install-recursive] Error 1
make[3]: Leaving directory '/home/shadowblitz16/Documents/source/OS/Nano/build_deps/binutils-build-2.37/gprof'
make[2]: *** [Makefile:945: install] Error 2
make[2]: Leaving directory '/home/shadowblitz16/Documents/source/OS/Nano/build_deps/binutils-build-2.37/gprof'
make[1]: *** [Makefile:6304: install-gprof] Error 2
make[1]: Leaving directory '/home/shadowblitz16/Documents/source/OS/Nano/build_deps/binutils-build-2.37'
make: *** [Makefile:2339: install] Error 2
make: Leaving directory '/home/shadowblitz16/Documents/source/OS/Nano/build_deps/binutils-build-2.37'
scons: *** [toolchain] Error 2
scons: building terminated because of errors.
File src/kernel/Makefile
.
build_scripts
instead of build_tools
.$@
doesn't pass target file names, so the script only tells about incorrect input arguments.How can be fixed:
TARGET_ASMFLAGS += -f elf
TARGET_CFLAGS += -ffreestanding -nostdlib -I.
TARGET_LIBS += -lgcc
TARGET_LINKFLAGS += -T linker.ld -nostdlib
HEADERS_C = $(wildcard *.h) \
$(wildcard */*.h) \
$(wildcard */*/*.h) \
$(wildcard */*/*/*.h)
SOURCES_C = $(wildcard *.c) \
$(wildcard */*.c) \
$(wildcard */*/*.c) \
$(wildcard */*/*/*.c) \
OBJECTS_C = $(patsubst %.c, $(BUILD_DIR)/kernel/c/%.obj, $(SOURCES_C))
HEADERS_ASM = $(wildcard *.inc) \
$(wildcard */*.inc) \
$(wildcard */*/*.inc) \
$(wildcard */*/*/*.inc) \
SOURCES_ASM = $(wildcard *.asm) \
$(wildcard */*.asm) \
$(wildcard */*/*.asm) \
$(wildcard */*/*/*.asm)
OBJECTS_ASM = $(patsubst %.asm, $(BUILD_DIR)/kernel/asm/%.obj, $(SOURCES_ASM))
GENERATED_FILES = arch/i686/isrs_gen.c arch/i686/isrs_gen.inc
.PHONY: all kernel clean always
all: kernel
kernel: generate $(BUILD_DIR)/kernel.bin
$(BUILD_DIR)/kernel.bin: $(OBJECTS_ASM) $(OBJECTS_C)
@$(TARGET_LD) $(TARGET_LINKFLAGS) -Wl,-Map=$(BUILD_DIR)/kernel.map -o $@ $^ $(TARGET_LIBS)
@echo "--> Created: kernel.bin"
$(BUILD_DIR)/kernel/c/%.obj: %.c $(HEADERS_C)
@mkdir -p $(@D)
@$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ $<
@echo "--> Compiled: " $<
$(BUILD_DIR)/kernel/asm/%.obj: %.asm $(HEADERS_ASM)
@mkdir -p $(@D)
@$(TARGET_ASM) $(TARGET_ASMFLAGS) -o $@ $<
@echo "--> Compiled: " $<
generate:
@$(SOURCE_DIR)/build_scripts/generate_isrs.sh $(GENERATED_FILES)
clean:
rm -f $(BUILD_DIR)/kernel.bin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.