Page 1 of 1

Kernel not boot

Posted: Thu Sep 30, 2010 3:55 am
by van7hu
Hi everyone,
It seems that my kernel is not boot at all
In grub command line interface I type
grub>kernel 200+20
[Multiboot-elf,<0x100000:0x112c:0x1000>,shtab=0x103140(bad),entry=0xc01000dc]
grub>boot
then nothing happens...
Bochs output:
1. Restore factory default configuration
2. Read options from...
3. Edit options
4. Save options to...
5. Restore the Bochs state from...
6. Begin simulation
7. Quit now

Please choose one: [6] 6
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] Bochs x86 Emulator 2.4.5
00000000000i[ ] Build from CVS snapshot, on April 25, 2010
00000000000i[ ] System configuration
00000000000i[ ] processors: 1 (cores=1, HT threads=1)
00000000000i[ ] A20 line support: yes
00000000000i[ ] CPU configuration
00000000000i[ ] level: 6
00000000000i[ ] SMP support: yes, quantum=5
00000000000i[ ] APIC support: yes
00000000000i[ ] FPU support: yes
00000000000i[ ] MMX support: yes
00000000000i[ ] 3dnow! support: no
00000000000i[ ] SEP support: yes
00000000000i[ ] SSE support: sse2
00000000000i[ ] XSAVE support: no
00000000000i[ ] AES support: no
00000000000i[ ] MOVBE support: no
00000000000i[ ] x86-64 support: yes
00000000000i[ ] 1G paging support: no
00000000000i[ ] MWAIT support: no
00000000000i[ ] VMX support: 1
00000000000i[ ] Optimization configuration
00000000000i[ ] RepeatSpeedups support: yes
00000000000i[ ] Trace cache support: yes
00000000000i[ ] Fast function calls: yes
00000000000i[ ] Devices configuration
00000000000i[ ] ACPI support: yes
00000000000i[ ] NE2000 support: no
00000000000i[ ] PCI support: yes, enabled=yes
00000000000i[ ] SB16 support: yes
00000000000i[ ] USB support: no
00000000000i[ ] VGA extension support: vbe
00000000000i[MEM0 ] allocated memory at 0xb52a5008. after alignment, vector=0xb52a6000
00000000000i[MEM0 ] 32.00MB
00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32
00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('/usr/local/share/bochs/BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/40448 ('/usr/local/share/bochs/VGABIOS-lgpl-latest')
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Thu Sep 30 16:16:42 2010 (time0=1285838202)
00000000000i[DMA ] channel 4 used by cascade
00000000000i[DMA ] channel 2 used by Floppy Drive
00000000000i[FDD ] fd0: 'kernel.img' ro=0, h=2,t=80,spt=18
00000000000i[PCI ] 440FX Host bridge present at device 0, function 0
00000000000i[PCI ] PIIX3 PCI-to-ISA bridge present at device 1, function 0
00000000000i[VGA ] interval=50000
00000000000i[MEM0 ] Register memory access handlers: 0x000a0000 - 0x000bffff
00000000000i[XGUI ] test_alloc_colors: 16 colors available out of 16 colors tried
00000000000i[XGUI ] font 8 wide x 16 high, display depth = 24
00000000000i[MEM0 ] Register memory access handlers: 0xe0000000 - 0xe0ffffff
00000000000i[VGA ] VBE Bochs Display Extension Enabled
00000000000i[ ] init_dev of 'unmapped' plugin device by virtual method
00000000000i[ ] init_dev of 'biosdev' plugin device by virtual method
00000000000i[ ] init_dev of 'speaker' plugin device by virtual method
00000000000i[SPEAK] Failed to open /dev/console: Resource temporarily unavailable
00000000000i[SPEAK] Deactivating beep on console
00000000000i[ ] init_dev of 'extfpuirq' plugin device by virtual method
00000000000i[ ] init_dev of 'gameport' plugin device by virtual method
00000000000i[ ] init_dev of 'iodebug' plugin device by virtual method
00000000000i[ ] init_dev of 'pci_ide' plugin device by virtual method
00000000000i[PCI ] PIIX3 PCI IDE controller present at device 1, function 1
00000000000i[ ] init_dev of 'acpi' plugin device by virtual method
00000000000i[PCI ] ACPI Controller present at device 1, function 3
00000000000i[ ] init_dev of 'ioapic' plugin device by virtual method
00000000000i[IOAP ] initializing I/O APIC
00000000000i[MEM0 ] Register memory access handlers: 0xfec00000 - 0xfec00fff
00000000000i[ ] init_dev of 'keyboard' plugin device by virtual method
00000000000i[KBD ] will paste characters every 1000 keyboard ticks
00000000000i[ ] init_dev of 'harddrv' plugin device by virtual method
00000000000i[HD ] Using boot sequence floppy, none, none
00000000000i[HD ] Floppy boot signature check is enabled
00000000000i[ ] init_dev of 'serial' plugin device by virtual method
00000000000i[SER ] com1 at 0x03f8 irq 4
00000000000i[ ] init_dev of 'parallel' plugin device by virtual method
00000000000i[PAR ] parallel port 1 at 0x0378 irq 7
00000000000i[ ] register state of 'unmapped' plugin device by virtual method
00000000000i[ ] register state of 'biosdev' plugin device by virtual method
00000000000i[ ] register state of 'speaker' plugin device by virtual method
00000000000i[ ] register state of 'extfpuirq' plugin device by virtual method
00000000000i[ ] register state of 'gameport' plugin device by virtual method
00000000000i[ ] register state of 'iodebug' plugin device by virtual method
00000000000i[ ] register state of 'pci_ide' plugin device by virtual method
00000000000i[ ] register state of 'acpi' plugin device by virtual method
00000000000i[ ] register state of 'ioapic' plugin device by virtual method
00000000000i[ ] register state of 'keyboard' plugin device by virtual method
00000000000i[ ] register state of 'harddrv' plugin device by virtual method
00000000000i[ ] register state of 'serial' plugin device by virtual method
00000000000i[ ] register state of 'parallel' plugin device by virtual method
00000000000i[SYS ] bx_pc_system_c::Reset(HARDWARE) called
00000000000i[CPU0 ] cpu hardware reset
00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0xfee00000
00000000000i[CPU0 ] CPU[0] is the bootstrap processor
00000000000i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00000000000i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002020 078bfbff
00000000000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00000000000i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00000000000i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00000000000i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000008]: 00003020 00000000 00000000 00000000
00000000000i[ ] reset of 'unmapped' plugin device by virtual method
00000000000i[ ] reset of 'biosdev' plugin device by virtual method
00000000000i[ ] reset of 'speaker' plugin device by virtual method
00000000000i[ ] reset of 'extfpuirq' plugin device by virtual method
00000000000i[ ] reset of 'gameport' plugin device by virtual method
00000000000i[ ] reset of 'iodebug' plugin device by virtual method
00000000000i[ ] reset of 'pci_ide' plugin device by virtual method
00000000000i[ ] reset of 'acpi' plugin device by virtual method
00000000000i[ ] reset of 'ioapic' plugin device by virtual method
00000000000i[ ] reset of 'keyboard' plugin device by virtual method
00000000000i[ ] reset of 'harddrv' plugin device by virtual method
00000000000i[ ] reset of 'serial' plugin device by virtual method
00000000000i[ ] reset of 'parallel' plugin device by virtual method
00000000000i[XGUI ] [x] Mouse off
00000000000i[ ] set SIGINT handler to bx_debug_ctrlc_handler
Next at t=0
(0) [0xfffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b ; ea5be000f0
<bochs:1> c
00000003305i[BIOS ] $Revision: 1.247 $ $Date: 2010/04/04 19:33:50 $
00000318057i[KBD ] reset-disable command received
00000444815i[VBIOS] VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $
00000444886i[VGA ] VBE known Display Interface b0c0
00000444918i[VGA ] VBE known Display Interface b0c5
00000447843i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $
00000600000i[XGUI ] charmap update. Font Height is 16
00000760532i[BIOS ] Starting rombios32
00000761029i[BIOS ] Shutdown flag 0
00000761710i[BIOS ] ram_size=0x02000000
00000762188i[BIOS ] ram_end=32MB
00000802748i[BIOS ] Found 1 cpu(s)
00000822017i[BIOS ] bios_table_addr: 0x000fbc18 end=0x000fcc00
00000822120i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00001149817i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00001477745i[P2I ] PCI IRQ routing: PIRQA# set to 0x0b
00001477766i[P2I ] PCI IRQ routing: PIRQB# set to 0x09
00001477787i[P2I ] PCI IRQ routing: PIRQC# set to 0x0b
00001477808i[P2I ] PCI IRQ routing: PIRQD# set to 0x09
00001477818i[P2I ] write: ELCR2 = 0x0a
00001478703i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
00001486661i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
00001489223i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
00001491624i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
00001491854i[PIDE ] new BM-DMA address: 0xc000
00001492558i[BIOS ] region 4: 0x0000c000
00001494868i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
00001495106i[ACPI ] new irq line = 11
00001495120i[ACPI ] new irq line = 9
00001495150i[ACPI ] new PM base address: 0xb000
00001495164i[ACPI ] new SM base address: 0xb100
00001495192i[PCI ] setting SMRAM control register to 0x4a
00001659286i[CPU0 ] Enter to System Management Mode
00001659286i[CPU0 ] enter_system_management_mode: temporary disable VMX while in SMM mode
00001659296i[CPU0 ] RSM: Resuming from System Management Mode
00001823316i[PCI ] setting SMRAM control register to 0x0a
00001832487i[BIOS ] MP table addr=0x000fbcf0 MPC table addr=0x000fbc20 size=0xd0
00001834546i[BIOS ] SMBIOS table addr=0x000fbd00
00001836934i[BIOS ] ACPI tables: RSDP addr=0x000fbe20 ACPI DATA addr=0x01ff0000 size=0x988
00001840172i[BIOS ] Firmware waking vector 0x1ff00cc
00001851285i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00001852129i[BIOS ] bios_table_cur_addr: 0x000fbe44
00014041546i[BIOS ] Booting from 0000:7c00
00023139359i[BIOS ] int13_harddisk: function 41, unmapped device for ELDL=80
00023144140i[BIOS ] int13_harddisk: function 08, unmapped device for ELDL=80
00023148791i[BIOS ] *** int 15h function AX=00c0, BX=0000 not yet supported!
00230000811i[FDD ] partial read() on floppy image returns 183/512
00230045766i[FDD ] read() on floppy image returns 0
00230090721i[FDD ] read() on floppy image returns 0
00230135676i[FDD ] read() on floppy image returns 0
00230180631i[FDD ] read() on floppy image returns 0
00230225586i[FDD ] read() on floppy image returns 0
00230270541i[FDD ] read() on floppy image returns 0
00230315496i[FDD ] read() on floppy image returns 0
00230360451i[FDD ] read() on floppy image returns 0
00230405406i[FDD ] read() on floppy image returns 0
00230450361i[FDD ] read() on floppy image returns 0
00230495316i[FDD ] read() on floppy image returns 0
00230540271i[FDD ] read() on floppy image returns 0
00230585226i[FDD ] read() on floppy image returns 0
00230630181i[FDD ] read() on floppy image returns 0
00230675136i[FDD ] read() on floppy image returns 0
00289091081e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0e)
00289091081e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00289091081i[CPU0 ] CPU is in protected mode (active)
00289091081i[CPU0 ] CS.d_b = 32 bit
00289091081i[CPU0 ] SS.d_b = 32 bit
00289091081i[CPU0 ] EFER = 0x00000000
00289091081i[CPU0 ] | RAX=0000000000000000 RBX=000000000002bd20
00289091081i[CPU0 ] | RCX=00000000e0000011 RDX=000000000002be00
00289091081i[CPU0 ] | RSP=0000000000067ee4 RBP=0000000000067f20
00289091081i[CPU0 ] | RSI=000000000002be78 RDI=0000000000000080
00289091081i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00289091081i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00289091081i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00289091081i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00289091081i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf AF pf CF
00289091081i[CPU0 ] | SEG selector base limit G D
00289091081i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00289091081i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 ffffffff 1 1
00289091081i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00289091081i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00289091081i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00289091081i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00289091081i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00289091081i[CPU0 ] | MSR_FS_BASE:0000000000000000
00289091081i[CPU0 ] | MSR_GS_BASE:0000000000000000
00289091081i[CPU0 ] | RIP=0000000007715922 (0000000007715922)
00289091081i[CPU0 ] | CR0=0xe0000011 CR2=0x0000000007715922
00289091081i[CPU0 ] | CR3=0x0010012c CR4=0x00000010
(0).[289091081] ??? (physical address not available)
00289091081e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00289091081i[SYS ] bx_pc_system_c::Reset(HARDWARE) called
00289091081i[CPU0 ] cpu hardware reset
00289091081i[APIC0] allocate APIC id=0 (MMIO enabled) to 0xfee00000
00289091081i[CPU0 ] CPU[0] is the bootstrap processor
00289091081i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00289091081i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002020 078bfbff
00289091081i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00289091081i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00289091081i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00289091081i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00289091081i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00289091081i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00289091081i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00289091081i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00289091081i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00289091081i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00289091081i[CPU0 ] CPUID[0x80000008]: 00003020 00000000 00000000 00000000
00289091081i[ ] reset of 'unmapped' plugin device by virtual method
00289091081i[ ] reset of 'biosdev' plugin device by virtual method
00289091081i[ ] reset of 'speaker' plugin device by virtual method
00289091081i[ ] reset of 'extfpuirq' plugin device by virtual method
00289091081i[ ] reset of 'gameport' plugin device by virtual method
00289091081i[ ] reset of 'iodebug' plugin device by virtual method
00289091081i[ ] reset of 'pci_ide' plugin device by virtual method
00289091081i[ ] reset of 'acpi' plugin device by virtual method
00289091081i[ ] reset of 'ioapic' plugin device by virtual method
00289091081i[ ] reset of 'keyboard' plugin device by virtual method
00289091081i[ ] reset of 'harddrv' plugin device by virtual method
00289091081i[ ] reset of 'serial' plugin device by virtual method
00289091081i[ ] reset of 'parallel' plugin device by virtual method
Next at t=289091082
(0) [0xfffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b ; ea5be000f0
<bochs:2>
Searching around forum,I found a similar post:http://forum.osdev.org/viewtopic.php?t=15932,but I don't know is that my problem ?

Re: Kernel not boot

Posted: Thu Sep 30, 2010 4:22 am
by NickJohnson
It seems that your kernel entry point is all the way up at 0xC01000DC, where GRUB is not going to be able to load your kernel. Could you post your linker script?

Re: Kernel not boot

Posted: Thu Sep 30, 2010 5:55 am
by van7hu
thank for your reply,
Here is my linker script file:
ENTRY(_loader)
OUTPUT_FORMAT(elf32-i386)
SECTIONS
{
. =0xc0100000 ;
.text : AT(ADDR(.text)-0xc0000000)
{
*(.text)
*(.rodata*)
}
.data : AT(ADDR(.data)-0xc0000000)
{
*(.data)
}
.bss : AT(ADDR(.bss)- 0xc0000000)
{
_sbss = .;
*(.bss)
*(COMMON)
}
}
My entry point is defined as follow:
....
section .text
align 4
MULTIBOOT_HEADER:
dd MAGIC
dd FLAGS
dd CHECKSUM
;
_loader:
I think it should be loaded just above 1M

Re: Kernel not boot

Posted: Thu Sep 30, 2010 6:47 am
by thepowersgang
You should also have the ENTRY line with a corrected address

Code: Select all

ENTRY(_loader - 0xC0000000)
Either that, or have the entrypoint in a .lowtext section that is linked to low memory

Re: Kernel not boot

Posted: Sun Oct 31, 2010 4:34 am
by van7hu
hi thepowersgang,
it took me a lot of time than I thought (almostly a month).
in the end I found out the way to change value of my entry point:
/* file : linker.ld */
...
.text : AT(ADDR(.text)-0xC0000000) {
*(.text)
_loader -= 0xC0000000 ;
*(.rodata*)
}
but,my kernel still does not boot :(
I think,now,my problem is in :
grub> kernel 200+20
[Multiboot-elf,<0x100000:0x74:0x0>, <0x101000:0x1000:0x4000> (bad),entry=0x10002c ]
Could you explain this for me ?,what is it ?, why it's marked as "bad" ?
sorry because someone has explained it for me,but unfortunately I have forgotten it.

Re: Kernel not boot

Posted: Sun Oct 31, 2010 5:36 am
by thepowersgang
Presumably the multiboot header is invalid somehow (bad checksum maybe?)

Re: Kernel not boot

Posted: Mon Nov 01, 2010 4:27 am
by JamesM
<0x101000:0x1000:0x4000> (bad)
Not certain, but from my intuition that would be <$TEXT,$DATA,$BSS>; the .text section is correct (although at 0x101000? not 0x100000?), but the .data and .bss sections are under 1MB. Hence it won't load.

This is just suspicion however as I don't know grub's output format exactly. Could you please do a

Code: Select all

readelf -S kernel
And post the result?

Thanks.

Re: Kernel not boot

Posted: Sun Nov 07, 2010 2:12 am
by van7hu
I have changed my file a lot since its original.
error:
00235987736i[CPU0 ] | RIP=00000000c0100034 (00000000c0100034)
00235987736i[CPU0 ] | CR0=0xe0000011 CR2=0x00000000c0100034
00235987736i[CPU0 ] | CR3=0x00101000 CR4=0x00000010
(0).[235987736] ??? (physical address not available)
00235987736e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
read -s kernel.bin:
an7hu@Moutain-Pirates:~/OSdev/new/hbarebone$ readelf -s kernel.bin

Symbol table '.symtab' contains 23 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: c0100000 0 SECTION LOCAL DEFAULT 1
2: c0101000 0 SECTION LOCAL DEFAULT 2
3: c0102000 0 SECTION LOCAL DEFAULT 3
4: 00000000 0 SECTION LOCAL DEFAULT 4
5: 00000000 0 FILE LOCAL DEFAULT ABS loader.s
6: 00000001 0 NOTYPE LOCAL DEFAULT ABS MODULEALIGN
7: 00000002 0 NOTYPE LOCAL DEFAULT ABS MEMINFO
8: 00000003 0 NOTYPE LOCAL DEFAULT ABS FLAGS
9: 1badb002 0 NOTYPE LOCAL DEFAULT ABS MAGIC
10: e4524ffb 0 NOTYPE LOCAL DEFAULT ABS CHECKSUM
11: c0000000 0 NOTYPE LOCAL DEFAULT ABS KERNEL_VIRTUAL_BASE
12: 00000300 0 NOTYPE LOCAL DEFAULT ABS KERNEL_PAGE_NUMBER
13: c0101000 0 NOTYPE LOCAL DEFAULT 2 BootPageDirectory
14: c0100000 0 NOTYPE LOCAL DEFAULT 1 MultiBootHeader
15: 00004000 0 NOTYPE LOCAL DEFAULT ABS STACKSIZE
16: c0100034 0 NOTYPE LOCAL DEFAULT 1 High
17: c0102000 0 NOTYPE LOCAL DEFAULT 3 stack
18: 00000000 0 FILE LOCAL DEFAULT ABS kernel.c
19: c010000c 0 NOTYPE GLOBAL DEFAULT 1 _loader
20: c0102000 0 NOTYPE GLOBAL DEFAULT 3 _sbss
21: c0106000 0 NOTYPE GLOBAL DEFAULT 3 _ebss
22: c0100054 28 FUNC GLOBAL DEFAULT 1 _main
I use a " jump [High] ",