hcyun@etri.re.kr writes:
I recently check out etherboot from the cvs to do boot from ide. At the first try, It could't found ide controller with saying "No adaptor found" After tracking down the codes I found the reason in scan_bus() function in pci.c
Interesting bug. The fix looks sane. Committed.
The problem was that it skips to probe my ide controller. My board is organized as follows. 00:02.3 <-- UBS controller 00:02.4 <-- empty 00:02.5 <-- IDE controller
When scan_bus probes all devfn, after reading PCI_VENDOR_ID from empty 00:02.4 it set hdr_type=0. therefore it skip to probe rest of functions including 00:02.5.
To avoid this situation I modified the code as follows to prevent to set hdr_type = 0. I'm not sure why original code set hdr_type = 0 when the slot return null vendor_id. But anyway I can boot from the disk by just removing this line.
static void scan_bus(int type, struct pci_device *dev) { . . buses=256; for (bus = first_bus; bus < buses; ++bus) { for (devfn = first_devfn; devfn < 0xff; ++devfn) { if (PCI_FUNC (devfn) == 0) pcibios_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type); else if (!(hdr_type & 0x80)) /* not a multi- function device */ continue;
pcibios_read_config_dword(bus, devfn,
PCI_VENDOR_ID, &l); /* some broken boards return 0 if a slot is empty: */ if (l == 0xffffffff || l == 0x00000000) { // hdr_type = 0; // <- I removed this line. hcyun. continue; } . .
Now I can boot from IDE. but I have a question. It seems that current etherboot ide support doesn't support partition or filesystem. So now I just installed kernel image without creating any partition (dd kernel.elf of=/dev/hda), but it is too wasteful. Is there any way to place both kernel and root filesystem on the same ide disk?
As long as the ELF header is within the first 8K of the disk it will work. So just make certain your first partition starts at sector 1, and is big enough to hold your boot elf image, and you can use the disk for multiple things.
Eric