I seem to have gotten myself stuck. I can load an elf image out of ROM but can't jump to it. I _can't_ load an elf image off of the drive at all.
The output of a boot using BOOT_ROM=1 and having the natsemi.elf at 0xc000 is attached. If I try BOOT_IDE=1 the only difference is that it doesn't find an elf candidate (it never tries to access the HDD). The end goal is to load the kernel off of CompactFlash on IDE0 master. I (think I) know how to place the kernel on the HDD and adjust the IDE_OFFSET in the config but I'm not even getting that far. >From the attached serial output you can see that it finds the natsemi.elf and that it is declared valid. If I examine code at 0x400000 it seems to be correct, meaning that it did copy the code over there. The processor never gets up there though. From tracing through the image it seems that the adjustment for Linuxbios' image in high memory is all messed up. After editing loglevel.h to allow "spew" level printks, the following is visible (I could see it throught the bochs debugger, but this just verifies that I'm not totally crazy. :-) Loaded segments verified segments closed down stream Jumping to boot code at 0x400000 entry = 0x00400000 lb_start = 0x00004000 lb_size = 0x0004e2d0 adjust = 0x3fbadd30 buffer = 0x3fb63a60 elf_boot_notes = 0x0000bc40 adjusted_boot_notes = 0x3fbb9970 now adjust and buffer are both waaaaaaaaaaaaaay beyond normal memory space... Is this normal or did I just fail to initialize something correctly? the objdump output for the natsemi.elf is also attached. From what I can tell it's nothing unusual. Regards, Andrew
LinuxBIOS-1.0.0 Sun Nov 24 14:12:38 EST 2002 starting... Ram1 OOps, can't write to PAM registers properly After 0x0000000 nop... Before 0x4000000 nop... After 0x4000000 nop... After 0x54... After 0x00... Before 0x4000000 nop... After 0x4000000 nop... After 0x4000000 nop... Before 0x4000000 nop... After 0x4000000 nop... After 0x0000000 nop... Before 0x4000000 nop... After 0x4000000 nop... After 0x54... After 0x00... Before 0x4000000 nop... After 0x4000000 nop... After 0x4000000 nop... First DRAM setup done Ram2 Ram3 Ram Enable 1 Ram Enable 2 Ram Enable 3 Ram Enable 4 Ram Enable 5 Ram4 Ram5 Ram6 Copying LinuxBIOS to ram. Jumping to LinuxBIOS. LinuxBIOS-1.0.0 Sun Nov 24 14:12:38 EST 2002 booting... Finding PCI configuration type. Scanning PCI bus...PCI: pci_scan_bus for bus 0 PCI: pci_scan_bus returning with max=00 done Allocating PCI resources... ASSIGN RESOURCES, bus 0 ASSIGNED RESOURCES, bus 0 done. Enabling PCI resourcess...done. Initializing PCI devices... PCI devices initialized totalram: 1020M Initializing CPU #0 Enabling cache...done. Max cpuid index : 1 Vendor ID : GenuineIntel Processor Type : 0x00 Processor Family : 0x05 Processor Model : 0x01 Processor Mask : 0x00 Processor Stepping : 0x03 Feature flags : 0x00800111 done. CPU #0 Initialized intel_mainboard_fixup() Testing SMI SMI disabled Enabling extended BIOS access...done. Checking IRQ routing tables.../home/andrew/linuxbios/freebios/src/arch/i386/lib/pirq_routing.c: 24:check_pirq_routing_table() - irq_routing_table located at: 0x00009720 /home/andrew/linuxbios/freebios/src/arch/i386/lib/pirq_routing.c: 31:check_pirq_routing_table() - checksum is: 0x63 but should be: 0xa6 /home/andrew/linuxbios/freebios/src/arch/i386/lib/pirq_routing.c: 49:check_pirq_routing_table() - checksum error in irq routing table done. Copying IRQ routing tables to 0xf0000...done. Wrote linuxbios table at: 00000500 - 00000644 checksum f2ff Welcome to elfboot, the open sourced starter. January 2002, Eric Biederman. Version 1.2 37:init_bytes() - zkernel_start:0x000c0000 zkernel_mask:0x0000ffff Found ELF candiate at offset 0 New segment addr 0x400000 size 0xb560 offset 0x60 filesize 0x7209 (cleaned up) New segment addr 0x400000 size 0xb560 offset 0x60 filesize 0x7209 Loading Segment: addr: 0x0000000000400000 memsz: 0x000000000000b560 filesz: 0x0000000000007209 Clearing Segment: addr: 0x0000000000407209 memsz: 0x0000000000004357 Jumping to boot code at 0x400000 registers just before 'cld' instruction: eax 0x3fbb9970 1069259120 ecx 0x80 128 edx 0x4d650 317008 ebx 0x3fb65360 1068913504 esp 0x115a4 0x115a4 ebp 0x115ac 0x115ac esi 0x400000 4194304 edi 0x115d8 71128 eip 0x8748 0x8748 eflags 0x7 7 cs 0x10 16 ss 0x18 24 ds 0x18 24 es 0x18 24 fs 0x18 24 gs 0x18 24 registers just before 'rep movsl' eax 0x3fbae9b0 1069214128 ecx 0x13594 79252 edx 0x4d650 317008 ebx 0x3fb65360 1068913504 esp 0x11580 0x11580 ebp 0x115ac 0x115ac esi 0x4000 16384 edi 0x3fbb29b0 1069230512 eip 0x877c 0x877c eflags 0x2 2 cs 0x10 16 ss 0x18 24 ds 0x18 24 es 0x18 24 fs 0x18 24 gs 0x18 24 registers after 'rep movsl' eax 0x3fbae9b0 1069214128 ecx 0x0 0 edx 0x4d650 317008 ebx 0x3fb65360 1068913504 esp 0x11580 0x11580 ebp 0x115ac 0x115ac esi 0x51650 333392 edi 0x3fc00000 1069547520 eip 0x877e 0x877e eflags 0x2 2 cs 0x10 16 ss 0x18 24 ds 0x18 24 es 0x18 24 fs 0x18 24 gs 0x18 24
../natsemi.elf: file format elf32-i386 ../natsemi.elf architecture: i386, flags 0x00000002: EXEC_P start address 0x00400000 Program Header: LOAD off 0x00000060 vaddr 0x00400000 paddr 0x00400000 align 2**5 filesz 0x00007209 memsz 0x0000b560 flags rwx Sections: Idx Name Size VMA LMA File off Algn 0 .text 00006109 00400000 00400000 00000060 2**2 CONTENTS, ALLOC, LOAD, CODE 1 .rodata 00000fbe 00406120 00406120 00006180 2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA 2 .data 00000129 004070e0 004070e0 00007140 2**5 CONTENTS, ALLOC, LOAD, DATA 3 .bss 00004340 00407220 00407220 00007280 2**5 ALLOC 4 .comment 000000d0 00000000 00000000 00007280 2**0 CONTENTS, READONLY
target orasis-v1 mainboard dauphin/orasis-v1 option HAVE_PIRQ_TABLE=1 option SERIAL_CONSOLE=1 option INBUF_COPY=1 option DEFAULT_CONSOLE_LOGLEVEL=15 #option SERIAL_POST=1 option DEBUG=1 option USE_GENERIC_ROM=1 option ROM_SIZE=262144 option NO_KEYBOARD=0 keyboard pc80 option USE_ELF_BOOT=1 #option BOOT_IDE=1 #option BOOT_FLOPPY=1 #option BOOT_TFTP=1 option BOOT_ROM=1 #option IDE_OFFSET=0x7e00 option IDE_OFFSET=0x0 option IDE_DELAY=1 dir src/pc80/ide # Path to your kernel (vmlinux) linux /home/andrew/linuxbios/linux # Kernel command line parameters commandline root=/dev/hda2 console=ttyS0,9600 single option RAMTEST=0 payload ../natsemi.elf option PAYLOAD_SIZE=196608