[SOLVED] Code migration issues...
Posted: Sat Jul 24, 2021 12:17 pm
Hi, guys. It's been a long time since I don't use this forum, and if this issue has already been solved in another thread, please point me to it and I'll delete this post, to not bloat the forum with duplicate issues.
Well, I'm having a bit of an issue here. I want to migrate my OS to use GRUB without floppy emulation (namely, kernel as ELF file) instead of the way I'm currently doing (which is using a floppy image).
The thing is, I tried to create a multiboot-compliant header (using The Little Book About OS Development's structure). It linked and compiled normally, but once I boot the resulting ISO image, there's an error.
Just in case, here's a readelf dump of the resulting kernel file.
The problem is that the loader_main routine is there, but I can't seem to run it correctly!
Any bit of help would be appreciated.
Well, I'm having a bit of an issue here. I want to migrate my OS to use GRUB without floppy emulation (namely, kernel as ELF file) instead of the way I'm currently doing (which is using a floppy image).
The thing is, I tried to create a multiboot-compliant header (using The Little Book About OS Development's structure). It linked and compiled normally, but once I boot the resulting ISO image, there's an error.
Just in case, here's a readelf dump of the resulting kernel file.
Code: Select all
Yuuki-kun@AI-CHAN: ~/Documents/SourceCode/yuuOS $ readelf -a kernel.elf
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Intel 80386
Version: 0x1
Entry point address: 0x10375e
Start of program headers: 52 (bytes into file)
Start of section headers: 20972 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 3
Size of section headers: 40 (bytes)
Number of section headers: 12
Section header string table index: 9
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00100000 001000 001ab8 00 AX 0 0 16
[ 2] .rodata PROGBITS 00102000 003000 000711 00 A 0 0 32
[ 3] .text: PROGBITS 00102714 003714 00000c 00 A 0 0 4
[ 4] .bss: PROGBITS 00102720 003720 001045 00 A 0 0 4
[ 5] .eh_frame PROGBITS 00103768 004768 000628 00 A 0 0 4
[ 6] .bss NOBITS 00104000 005000 000d30 00 WA 0 0 32
[ 7] .data PROGBITS 00105000 005000 000184 00 WA 0 0 32
[ 8] .comment PROGBITS 00000000 005184 000011 01 MS 0 0 1
[ 9] .shstrtab STRTAB 00000000 005195 000054 00 0 0 1
[10] .symtab SYMTAB 00000000 0053cc 0009e0 10 11 55 4
[11] .strtab STRTAB 00000000 005dac 000549 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
p (processor specific)
There are no section groups in this file.
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x001000 0x00100000 0x00100000 0x03d90 0x03d90 R E 0x1000
LOAD 0x005000 0x00104000 0x00104000 0x00000 0x00d30 RW 0x1000
LOAD 0x005000 0x00105000 0x00105000 0x00184 0x00184 RW 0x1000
Section to Segment mapping:
Segment Sections...
00 .text .rodata .text: .bss: .eh_frame
01 .bss
02 .data
There is no dynamic section in this file.
There are no relocations in this file.
The decoding of unwind sections for machine type Intel 80386 is not currently supported.
Symbol table '.symtab' contains 158 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00100000 0 SECTION LOCAL DEFAULT 1
2: 00102000 0 SECTION LOCAL DEFAULT 2
3: 00102714 0 SECTION LOCAL DEFAULT 3
4: 00102720 0 SECTION LOCAL DEFAULT 4
5: 00103768 0 SECTION LOCAL DEFAULT 5
6: 00104000 0 SECTION LOCAL DEFAULT 6
7: 00105000 0 SECTION LOCAL DEFAULT 7
8: 00000000 0 SECTION LOCAL DEFAULT 8
9: 00000000 0 FILE LOCAL DEFAULT ABS loader.c
10: 00000000 0 FILE LOCAL DEFAULT ABS cpu/interrupt.asm
11: 00100390 0 NOTYPE LOCAL DEFAULT 1 isr_common_stub
12: 001003b5 0 NOTYPE LOCAL DEFAULT 1 irq_common_stub
13: 00000000 0 FILE LOCAL DEFAULT ABS acpi.c
14: 00000000 0 FILE LOCAL DEFAULT ABS ahci.c
15: 00000000 0 FILE LOCAL DEFAULT ABS ata.c
16: 00100797 25 FUNC LOCAL DEFAULT 1 ATA_wait_BSY
17: 001007b0 31 FUNC LOCAL DEFAULT 1 ATA_wait_DRQ
18: 00000000 0 FILE LOCAL DEFAULT ABS keyboard.c
19: 00104c20 256 OBJECT LOCAL DEFAULT 6 key_buffer
20: 00104d20 4 OBJECT LOCAL DEFAULT 6 buffersize
21: 00104d24 4 OBJECT LOCAL DEFAULT 6 isCaps
22: 00104d28 4 OBJECT LOCAL DEFAULT 6 isShift
23: 001007cf 337 FUNC LOCAL DEFAULT 1 keyboard_callback
24: 00000000 0 FILE LOCAL DEFAULT ABS net.c
25: 00000000 0 FILE LOCAL DEFAULT ABS pci.c
26: 00000000 0 FILE LOCAL DEFAULT ABS textmode.c
27: 00000000 0 FILE LOCAL DEFAULT ABS idt.c
28: 00000000 0 FILE LOCAL DEFAULT ABS isr.c
29: 00000000 0 FILE LOCAL DEFAULT ABS ports.c
30: 00000000 0 FILE LOCAL DEFAULT ABS timer.c
31: 001014bb 18 FUNC LOCAL DEFAULT 1 timer_callback
32: 00000000 0 FILE LOCAL DEFAULT ABS utils.c
33: 00000000 0 FILE LOCAL DEFAULT ABS mem.c
34: 00000000 0 FILE LOCAL DEFAULT ABS stdio.c
35: 00000000 0 FILE LOCAL DEFAULT ABS string.c
36: 00000000 0 FILE LOCAL DEFAULT ABS boot/loader_entry.asm
37: 1badb002 0 NOTYPE LOCAL DEFAULT ABS MAGIC_NUMBER
38: 00000000 0 NOTYPE LOCAL DEFAULT ABS FLAGS
39: e4524ffe 0 NOTYPE LOCAL DEFAULT ABS CHECKSUM
40: 00001000 0 NOTYPE LOCAL DEFAULT ABS KERNEL_STACK_SIZE
41: 00102720 0 NOTYPE LOCAL DEFAULT 4 kernel_stack
42: 00103725 0 NOTYPE LOCAL DEFAULT 4 gdt_start
43: 0010372d 0 NOTYPE LOCAL DEFAULT 4 gdt_code
44: 00103735 0 NOTYPE LOCAL DEFAULT 4 gdt_data
45: 0010373d 0 NOTYPE LOCAL DEFAULT 4 gdt_end
46: 0010373d 0 NOTYPE LOCAL DEFAULT 4 gdt_descriptor
47: 00000008 0 NOTYPE LOCAL DEFAULT ABS CODE_SEG
48: 00000010 0 NOTYPE LOCAL DEFAULT ABS DATA_SEG
49: 000b8000 0 NOTYPE LOCAL DEFAULT ABS VIDEO_MEMORY
50: 0000000f 0 NOTYPE LOCAL DEFAULT ABS WHITE_ON_BLACK
51: 00103743 0 NOTYPE LOCAL DEFAULT 4 print_string_pm
52: 00103749 0 NOTYPE LOCAL DEFAULT 4 print_string_pm_loop
53: 0010375c 0 NOTYPE LOCAL DEFAULT 4 print_string_pm_done
54: 00000000 0 FILE LOCAL DEFAULT ABS
55: 00101421 29 FUNC GLOBAL DEFAULT 1 inb
56: 00101320 28 FUNC GLOBAL DEFAULT 1 register_interru[...]
57: 001017b8 35 FUNC GLOBAL DEFAULT 1 printf
58: 001003f6 0 NOTYPE GLOBAL DEFAULT 1 isr4
59: 001004c7 0 NOTYPE GLOBAL DEFAULT 1 isr27
60: 0010043f 0 NOTYPE GLOBAL DEFAULT 1 isr13
61: 001015e6 56 FUNC GLOBAL DEFAULT 1 cpubrand
62: 00100a47 447 FUNC GLOBAL DEFAULT 1 print_char
63: 0010196b 101 FUNC GLOBAL DEFAULT 1 reverse
64: 0010093c 186 FUNC GLOBAL DEFAULT 1 kprint_at
65: 00100571 0 NOTYPE GLOBAL DEFAULT 1 irq12
66: 00100495 0 NOTYPE GLOBAL DEFAULT 1 isr22
67: 0010044f 0 NOTYPE GLOBAL DEFAULT 1 isr15
68: 00102540 59 OBJECT GLOBAL DEFAULT 2 sc_ascii_caps
69: 0010055d 0 NOTYPE GLOBAL DEFAULT 1 irq10
70: 00100585 0 NOTYPE GLOBAL DEFAULT 1 irq14
71: 0010041d 0 NOTYPE GLOBAL DEFAULT 1 isr9
72: 00100549 0 NOTYPE GLOBAL DEFAULT 1 irq8
73: 001016f1 50 FUNC GLOBAL DEFAULT 1 memcpy
74: 0010049f 0 NOTYPE GLOBAL DEFAULT 1 isr23
75: 00100de0 32 FUNC GLOBAL DEFAULT 1 set_idt
76: 00100357 42 FUNC GLOBAL DEFAULT 1 quit_sys
77: 001004db 0 NOTYPE GLOBAL DEFAULT 1 isr29
78: 00101752 102 FUNC GLOBAL DEFAULT 1 malloc
79: 001004ef 0 NOTYPE GLOBAL DEFAULT 1 isr31
80: 00100c62 110 FUNC GLOBAL DEFAULT 1 set_cursor_offset
81: 001014cd 119 FUNC GLOBAL DEFAULT 1 init_timer
82: 0010048b 0 NOTYPE GLOBAL DEFAULT 1 isr21
83: 00100567 0 NOTYPE GLOBAL DEFAULT 1 irq11
84: 00105180 4 OBJECT GLOBAL DEFAULT 7 free_mem_addr
85: 001004d1 0 NOTYPE GLOBAL DEFAULT 1 isr28
86: 00102500 59 OBJECT GLOBAL DEFAULT 2 sc_ascii
87: 0010069e 249 FUNC GLOBAL DEFAULT 1 PIO_writesec
88: 00100415 0 NOTYPE GLOBAL DEFAULT 1 isr8
89: 0010052b 0 NOTYPE GLOBAL DEFAULT 1 irq5
90: 001014af 12 FUNC GLOBAL DEFAULT 1 outdw
91: 00100481 0 NOTYPE GLOBAL DEFAULT 1 isr20
92: 00100447 0 NOTYPE GLOBAL DEFAULT 1 isr14
93: 0010145c 31 FUNC GLOBAL DEFAULT 1 inw
94: 00100d36 27 FUNC GLOBAL DEFAULT 1 get_offset
95: 001003fd 0 NOTYPE GLOBAL DEFAULT 1 isr5
96: 00105100 128 OBJECT GLOBAL DEFAULT 7 exception_messages
97: 0010003f 628 FUNC GLOBAL DEFAULT 1 user_input
98: 00100535 0 NOTYPE GLOBAL DEFAULT 1 irq6
99: 00100503 0 NOTYPE GLOBAL DEFAULT 1 irq1
100: 00100599 261 FUNC GLOBAL DEFAULT 1 PIO_readsec
101: 00100000 63 FUNC GLOBAL DEFAULT 1 loader_main
102: 0010149b 20 FUNC GLOBAL DEFAULT 1 indw
103: 0010161e 211 FUNC GLOBAL DEFAULT 1 pickStr
104: 001003e1 0 NOTYPE GLOBAL DEFAULT 1 isr1
105: 00100553 0 NOTYPE GLOBAL DEFAULT 1 irq9
106: 00100e00 1221 FUNC GLOBAL DEFAULT 1 isr_install
107: 001004bd 0 NOTYPE GLOBAL DEFAULT 1 isr26
108: 0010042f 0 NOTYPE GLOBAL DEFAULT 1 isr11
109: 00101544 162 FUNC GLOBAL DEFAULT 1 vendor
110: 00105000 236 OBJECT GLOBAL DEFAULT 7 sc_name
111: 00101407 26 FUNC GLOBAL DEFAULT 1 irq_install
112: 001009f6 81 FUNC GLOBAL DEFAULT 1 kprint_backspace
113: 001017db 174 FUNC GLOBAL DEFAULT 1 int_to_ascii
114: 00102580 59 OBJECT GLOBAL DEFAULT 2 sc_ascii_shift
115: 00104d2c 4 OBJECT GLOBAL DEFAULT 6 tick
116: 0010143e 30 FUNC GLOBAL DEFAULT 1 outb
117: 0010057b 0 NOTYPE GLOBAL DEFAULT 1 irq13
118: 00100437 0 NOTYPE GLOBAL DEFAULT 1 isr12
119: 00101723 47 FUNC GLOBAL DEFAULT 1 memset
120: 001003da 0 NOTYPE GLOBAL DEFAULT 1 isr0
121: 0010050d 0 NOTYPE GLOBAL DEFAULT 1 irq2
122: 001012c5 91 FUNC GLOBAL DEFAULT 1 isr_handler
123: 001004a9 0 NOTYPE GLOBAL DEFAULT 1 isr24
124: 00100459 0 NOTYPE GLOBAL DEFAULT 1 isr16
125: 00101a53 101 FUNC GLOBAL DEFAULT 1 strcmp
126: 00104000 2048 OBJECT GLOBAL DEFAULT 6 idt
127: 001003ef 0 NOTYPE GLOBAL DEFAULT 1 isr3
128: 00104820 1024 OBJECT GLOBAL DEFAULT 6 interrupt_handlers
129: 00100404 0 NOTYPE GLOBAL DEFAULT 1 isr6
130: 0010375e 0 NOTYPE GLOBAL DEFAULT 4 loader
131: 0010053f 0 NOTYPE GLOBAL DEFAULT 1 irq7
132: 0010133c 203 FUNC GLOBAL DEFAULT 1 irq_handler
133: 001002b3 164 FUNC GLOBAL DEFAULT 1 about
134: 0010147b 32 FUNC GLOBAL DEFAULT 1 outw
135: 0010046d 0 NOTYPE GLOBAL DEFAULT 1 isr18
136: 00100c06 92 FUNC GLOBAL DEFAULT 1 get_cursor_offset
137: 001004f9 0 NOTYPE GLOBAL DEFAULT 1 irq0
138: 00100427 0 NOTYPE GLOBAL DEFAULT 1 isr10
139: 00100d95 75 FUNC GLOBAL DEFAULT 1 set_idt_gate
140: 001019f7 56 FUNC GLOBAL DEFAULT 1 append
141: 00100463 0 NOTYPE GLOBAL DEFAULT 1 isr17
142: 001003e8 0 NOTYPE GLOBAL DEFAULT 1 isr2
143: 00100d51 29 FUNC GLOBAL DEFAULT 1 get_offset_row
144: 00100477 0 NOTYPE GLOBAL DEFAULT 1 isr19
145: 00101889 226 FUNC GLOBAL DEFAULT 1 hex_to_ascii
146: 001004e5 0 NOTYPE GLOBAL DEFAULT 1 isr30
147: 00100d6e 39 FUNC GLOBAL DEFAULT 1 get_offset_col
148: 001019d0 39 FUNC GLOBAL DEFAULT 1 strlen
149: 00101a2f 36 FUNC GLOBAL DEFAULT 1 backspace
150: 0010058f 0 NOTYPE GLOBAL DEFAULT 1 irq15
151: 0010040b 0 NOTYPE GLOBAL DEFAULT 1 isr7
152: 00104800 6 OBJECT GLOBAL DEFAULT 6 idt_reg
153: 001004b3 0 NOTYPE GLOBAL DEFAULT 1 isr25
154: 00100cd0 102 FUNC GLOBAL DEFAULT 1 clear_screen
155: 00100920 28 FUNC GLOBAL DEFAULT 1 init_keyboard
156: 00100521 0 NOTYPE GLOBAL DEFAULT 1 irq4
157: 00100517 0 NOTYPE GLOBAL DEFAULT 1 irq3
No version information found in this file.
Any bit of help would be appreciated.