Skip to contentSkip to conversation

Unable to boot a raw kernel image :??

DISCUSSION DervishD 7 participants 27 messages Nov 29, 2002 – Mar 11, 2003

lore
Share & tools
lore

DervishD

author
#0 lore raw

Hi all :))

A time ago I was able to generate bootable Linux CD's just by
dd'ing a floppy containing a raw kernel image:

dd if=/dev/fd0 of=eltorito

After that, mkisofsing, toasting and booting. But now, depending
on the machine, I have 'invalid compressed format' errors, or even ye olde register dump when the image was damaged :(

Booting directly from the floppy works, but booting with that
same image from a CD does not :(( I now I can use LILO, or better yet, Syslinux or isolinux, but I'm just curious why I cannot boot raw image-based CD's anymore.

Anyone knows what's happenning here?
Raúl

#1 lore raw
Quoted 9 lines · DervishD

Hi all :))

A time ago I was able to generate bootable Linux CD's just by
dd'ing a floppy containing a raw kernel image:

dd if=/dev/fd0 of=eltorito

After that, mkisofsing, toasting and booting. But now, depending
on the machine, ^^^^^^^^^

^^^^^^^^^^^^^^
Boot CD support is BIOS-dependent AFAIK. Maybe on those machines BIOS floppy emulation from CD is broken?
OTOH if you can boot, say, 2.2 but not 2.4, that's a counterproof for my theory.

Quoted 7 lines

I have 'invalid compressed format' errors, or even ye olde register dump when the image was damaged :(

Booting directly from the floppy works, but booting with that
same image from a CD does not :(( I now I can use LILO, or better yet, Syslinux or isolinux, but I'm just curious why I cannot boot raw image-based CD's anymore.

--
vda

author
#2 lore raw

Hi Denis :)

Quoted 5 lines
Quoted 2 lines

After that, mkisofsing, toasting and booting. But now, depending
on the machine, ^^^^^^^^^

^^^^^^^^^^^^^^
Boot CD support is BIOS-dependent AFAIK. Maybe on those machines BIOS floppy emulation from CD is broken?

Not at all. I can boot using isolinux (or syslinux), for example.
The failure happens in all machines I've tested, but depending on the machine, the particular fail is one or another: some of them generate 'invalid compressed format', others just hang, etc...

But booting the same kernel using isolinux works :( That is, it
is not a mkisofs issue, nor a cdrecord issue, etc...

Thanks for your answer, Denis :)
Raúl

#3 lore raw
In reply to DervishD
Quoted 12 lines · DervishD

Hi all :))

A time ago I was able to generate bootable Linux CD's just by
dd'ing a floppy containing a raw kernel image:

dd if=/dev/fd0 of=eltorito

After that, mkisofsing, toasting and booting. But now, depending
on the machine, I have 'invalid compressed format' errors, or even ye olde register dump when the image was damaged :(

Quoted 6 lines

Booting directly from the floppy works, but booting with that
same image from a CD does not :(( I now I can use LILO, or better yet, Syslinux or isolinux, but I'm just curious why I cannot boot raw image-based CD's anymore.

Anyone knows what's happenning here?

I had this problem a while ago. It turned out to be a (widespread) BIOS bug triggered be the disk-size probe of the kernel's boot loader.

The crude fix which worked for me: disable the probing for 2.88MB disks by changing the first byte of the disksizes table at the end of bootsect.S from 36 to 18.

The long explanation: The BIOS allows bigger-than-track-size reads in El-Torito mode which confuses the probe routine which then assumes a 2.88MB disk when the BIOS is actually emulating a 1.44MB disk. In LBA mode that would be no problem but in CHS mode (which is used by the loader) it does not work.

Ciao, ET.

author
#4 lore raw

Hi Edgar :)

Quoted 6 lines
Quoted 1 line

Anyone knows what's happenning here?

The long explanation: The BIOS allows bigger-than-track-size reads in El-Torito mode which confuses the probe routine which then assumes a 2.88MB disk when the BIOS is actually emulating a 1.44MB disk. In LBA mode that would be no problem but in CHS mode (which is used by the loader) it does not work.

I've tried too with a home-made boot loader which works in LBA
mode (I use it in my system and works OK) using a no-emulation boot CD, but then the kernel is not even loaded :(

Thanks for the explanation :)) Why this did work on older kernels
but not on 2.4.x :????

Anyway, I think I will use a patched version of Isolinux. Less
complications and more power than a raw disk image :(

Raúl

#5 lore raw
In reply to Edgar Toernig
Followup to:  <[email protected]>
By author:    Edgar Toernig <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 4 lines

I had this problem a while ago. It turned out to be a (widespread) BIOS bug triggered be the disk-size probe of the kernel's boot loader.

It's not a bug, really. The fact of the matter is that the disk geometry probe in bootsect.S pretty much only works for legacy floppies... no IDE floppies, no USB floppies, no virtual floppies.

That, and the 1 MB limitation, is the reason it either needs to get nuked or get some massive surgery. I am currently trying to get Linus to accept a patch to put it out of its misery.

-hpa

Signature · 3 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64
#6 lore raw
Quoted 8 lines · H. Peter Anvin
Followup to:  <[email protected]>
By author:    Edgar Toernig <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 4 lines

I had this problem a while ago. It turned out to be a (widespread) BIOS bug triggered be the disk-size probe of the kernel's boot loader.

Quoted 7 lines

It's not a bug, really. The fact of the matter is that the disk geometry probe in bootsect.S pretty much only works for legacy floppies... no IDE floppies, no USB floppies, no virtual floppies.

That, and the 1 MB limitation, is the reason it either needs to get nuked or get some massive surgery. I am currently trying to get Linus to accept a patch to put it out of its misery.

FWIW, I still use bzdisk images frequently, and the 1MB limit really is a serious problem for 2.5 kernels, and 2.4 kernels build with gcc-3. I'm currently using a patched kernel where `make bzdisk' invokes a user-specified script, which in my case goes roughly like:

===snip===
BOOTIMAGE=$1
LIBDIR=/home/mikpe/pkgs/linux-x86/make-zdisk/lib
FDIMAGE=/tmp/fdimage.$$
MTOOLSRC=/tmp/mtools.conf.$$

cat > $MTOOLSRC << EOF
drive v:
file="$FDIMAGE" cylinders=80 heads=2 sectors=18 filter
EOF

dd if=/dev/zero bs=72k count=20 of=$FDIMAGE MTOOLSRC=$MTOOLSRC mformat v:
MTOOLSRC=$MTOOLSRC mcopy $LIBDIR/ldlinux.sys v:
MTOOLSRC=$MTOOLSRC mcopy $BOOTIMAGE v:linux
dd bs=512 count=1 conv=notrunc if=$LIBDIR/bootsect.img of=$FDIMAGE

dd bs=72k if=$FDIMAGE of=/dev/fd0
===snip===

The latest mtools are supposed to have direct support for image files, which should eliminate the MTOOLSRC kludge.

All I'm really missing is a version of syslinux that understands enough of MS-DOS FS layout to populate the FS and update the boot block without having to mount the damn thing. That would eliminate the ldlinux.sys and bootsect.img files, which I extracted from a syslinux-prepared floppy.

You can kill bootsect.S right now, IF you allow a user-specified script to control how the boot floppy is prepared. Something like:

zdisk: $(BOOTIMAGE)

	make-zdisk.sh $(BOOTIMAGE)

should be enough.

/Mikael

#7 lore raw
Quoted 6 lines · Mikael Pettersson

FWIW, I still use bzdisk images frequently, and the 1MB limit really is a serious problem for 2.5 kernels, and 2.4 kernels build with gcc-3. I'm currently using a patched kernel where `make bzdisk' invokes a user-specified script, which in my case goes roughly like:

If you get my nobootsect patch:

ftp://ftp.kernel.org/pub/linux/kernel/people/hpa/nobootsect-2.5.63-bk7-1.diff

... you will find something similar, but a bit more fleshed out.

This is the patch I'm trying to get Linus to accept.

-hpa

#8 lore raw
Quoted 8 lines · H. Peter Anvin
Quoted 6 lines · Mikael Pettersson

FWIW, I still use bzdisk images frequently, and the 1MB limit really is a serious problem for 2.5 kernels, and 2.4 kernels build with gcc-3. I'm currently using a patched kernel where `make bzdisk' invokes a user-specified script, which in my case goes roughly like:

Quoted 7 lines

If you get my nobootsect patch:

ftp://ftp.kernel.org/pub/linux/kernel/people/hpa/nobootsect-2.5.63-bk7-1.diff

... you will find something similar, but a bit more fleshed out.

This is the patch I'm trying to get Linus to accept.

That's similar to what you posted to LKML a while ago, and it has the limitations of requiring mountable /dev/fd0, which needs a magic entry in /etc/fstab ("user" privs, not "owner"), and MS-DOS FS support in the kernel used for the build.

Those are the limitations I want to avoid. Do put this in a script in the kernel, but please allow the user to override it via $PATH.

/Mikael

#9 lore raw
Quoted 8 lines · Mikael Pettersson
Quoted 2 lines

This is the patch I'm trying to get Linus to accept.

That's similar to what you posted to LKML a while ago, and it has the limitations of requiring mountable /dev/fd0, which needs a magic entry in /etc/fstab ("user" privs, not "owner"), and MS-DOS FS support in the kernel used for the build.

No, it doesn't (if you have SYSLINUX 2.02 or higher.)

-hpa

#10 lore raw
Quoted 11 lines · H. Peter Anvin
Quoted 8 lines · Mikael Pettersson
Quoted 2 lines

This is the patch I'm trying to get Linus to accept.

That's similar to what you posted to LKML a while ago, and it has the limitations of requiring mountable /dev/fd0, which needs a magic entry in /etc/fstab ("user" privs, not "owner"), and MS-DOS FS support in the kernel used for the build.

No, it doesn't (if you have SYSLINUX 2.02 or higher.)

Cool. The one in RedHat 8 must be pretty old then. I'll grab the latest and give it a try.

/Mikael

#11 lore raw
In reply to H. Peter Anvin
Quoted 11 lines · H. Peter Anvin
Quoted 8 lines · Mikael Pettersson
Quoted 2 lines

This is the patch I'm trying to get Linus to accept.

That's similar to what you posted to LKML a while ago, and it has the limitations of requiring mountable /dev/fd0, which needs a magic entry in /etc/fstab ("user" privs, not "owner"), and MS-DOS FS support in the kernel used for the build.

No, it doesn't (if you have SYSLINUX 2.02 or higher.)

Indeed. The SYSLINUX 2.02 + mtools combination works like a charm for 'make bzdisk'. I'm happy with your nobootsect patch.

/Mikael

#12 lore raw
Followup to:  <[email protected]>
By author:    Mikael Pettersson <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 4 lines

Indeed. The SYSLINUX 2.02 + mtools combination works like a charm for 'make bzdisk'. I'm happy with your nobootsect patch.

Well, Linus keeps dropping it on the floor, so I don't know if we'll see a working "make bzdisk" in the kernel any time soon :(

-hpa

Signature · 3 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64
author
#13 lore raw

Hi HPA :)

Quoted 4 lines
Quoted 2 lines

Indeed. The SYSLINUX 2.02 + mtools combination works like a charm for 'make bzdisk'. I'm happy with your nobootsect patch.

Well, Linus keeps dropping it on the floor, so I don't know if we'll see a working "make bzdisk" in the kernel any time soon :(

Do you know why?

Raúl

#14 lore raw
Quoted 12 lines · DervishD

Hi HPA :)

Quoted 5 lines
Quoted 2 lines

Indeed. The SYSLINUX 2.02 + mtools combination works like a charm for 'make bzdisk'. I'm happy with your nobootsect patch.

Well, Linus keeps dropping it on the floor, so I don't know if we'll see a working "make bzdisk" in the kernel any time soon :(

Do you know why?

No, especially not as it turns out I was wrong -- the patch is currently in the snapshots.

-hpa

author
#15 lore raw

Hi HPA :)

H. Peter Anvin dixit:

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

Well, Linus keeps dropping it on the floor, so I don't know if we'll see a working "make bzdisk" in the kernel any time soon :(

Do you know why?

No, especially not as it turns out I was wrong -- the patch is currently in the snapshots.

    ;))) Nice, then. I'm waiting for 2.6 :)) (or 3.0, maybe... BUT I

DON'T WANT TO START A TROLL about kernel versioning XDD).

Raúl

author
#16 lore raw
In reply to H. Peter Anvin

Hi Peter :)

H. Peter Anvin dixit:

Quoted 3 lines

That, and the 1 MB limitation, is the reason it either needs to get nuked or get some massive surgery. I am currently trying to get Linus to accept a patch to put it out of its misery.

Please, try to convince Marcello and Alan, too. The 2.4 branch
will be a happier branch (well, assuming that the Linux kernel has feelings, of course) without the raw kernel image booting. Anyway, it doesn't seem to work for El Torito emulated floppies... I will be the first who cry for this ancient code, but I think now it doesn't make sense. Anyone uses floppies yet? Here in Spain a floppy is more expensive than a 80 min. CD...

Raúl

#17 lore raw
Quoted 11 lines
Quoted 3 lines

That, and the 1 MB limitation, is the reason it either needs to get nuked or get some massive surgery. I am currently trying to get Linus to accept a patch to put it out of its misery.

Please, try to convince Marcello and Alan, too. The 2.4 branch
will be a happier branch (well, assuming that the Linux kernel has feelings, of course) without the raw kernel image booting. Anyway, it doesn't seem to work for El Torito emulated floppies... I will be the first who cry for this ancient code, but I think now it doesn't make sense. Anyone uses floppies yet? Here in Spain a floppy is more expensive than a 80 min. CD...

Doesn't the in kernel bootloader have uses other than booting from floppy? What if you want to boot from a custom network boot prom?

John.

#18 lore raw
Quoted 4 lines · John Bradford

Doesn't the in kernel bootloader have uses other than booting from floppy? What if you want to boot from a custom network boot prom?

Then you probably need Etherboot. The in-kernel boot loader (bootsect.S) will not help you.

-hpa

#19 lore raw
Quoted 6 lines
Quoted 3 lines

Doesn't the in kernel bootloader have uses other than booting from floppy? What if you want to boot from a custom network boot prom?

Then you probably need Etherboot. The in-kernel boot loader (bootsect.S) will not help you.

Sorry, I was thinking about something completely different :-).

John.

author
#20 lore raw
In reply to John Bradford

Hi John :)

John Bradford dixit:

Quoted 4 lines
Quoted 2 lines

sense. Anyone uses floppies yet? Here in Spain a floppy is more expensive than a 80 min. CD...

Doesn't the in kernel bootloader have uses other than booting from floppy? What if you want to boot from a custom network boot prom?

I'm not aware of such uses :??? AFAIK, the in kernel bootloader
just exists for booting from raw floppies :?? Maybe HPA knows more about this.

Raúl

#21 lore raw
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

sense. Anyone uses floppies yet? Here in Spain a floppy is more expensive than a 80 min. CD...

Doesn't the in kernel bootloader have uses other than booting from floppy? What if you want to boot from a custom network boot prom?

I'm not aware of such uses :??? AFAIK, the in kernel bootloader
just exists for booting from raw floppies :?? Maybe HPA knows more about this.

No, it is only used for floppies, for some reason I was thinking of something completely unrelated, ignore my previous post.

John.

#22 lore raw
In reply to DervishD
Quoted 8 lines · DervishD

Hi Peter :)

H. Peter Anvin dixit:

Quoted 3 lines

That, and the 1 MB limitation, is the reason it either needs to get nuked or get some massive surgery. I am currently trying to get Linus to accept a patch to put it out of its misery.

Quoted 8 lines

Please, try to convince Marcello and Alan, too. The 2.4 branch
will be a happier branch (well, assuming that the Linux kernel has feelings, of course) without the raw kernel image booting. Anyway, it doesn't seem to work for El Torito emulated floppies... I will be the first who cry for this ancient code, but I think now it doesn't make sense. Anyone uses floppies yet? Here in Spain a floppy is more expensive than a 80 min. CD...

It doesn't work for anything but old legacy floppies. I have already sent the code to Alan for 2.5-ac and to Andi for x86-64 (where it has already been integrated); if anyone wants to try to persuade Marcelo to integrate it, be my guest, the current patch is at:

ftp://ftp.kernel.org/pub/linux/kernel/people/hpa/nobootsect-2.5.63-bk7-1.diff

It's already enough work to keep this patch up to date and trying to get Linus to take it.

-hpa

author
#23 lore raw

Hi Peter :)

H. Peter Anvin dixit:

Quoted 5 lines
Quoted 2 lines

Please, try to convince Marcello and Alan, too. The 2.4 branch
will be a happier branch (well, assuming that the Linux kernel has

sent the code to Alan for 2.5-ac and to Andi for x86-64 (where it has already been integrated); if anyone wants to try to persuade Marcelo to integrate it, be my guest

If you want, I can prepare a patch for the 2.4 series, but if I
have had problems for a three-line diff to be included, think about yours... If you think that Marcello will be inclined to accept this patch I'll prepare it in your name.

Quoted 2 lines

It's already enough work to keep this patch up to date and trying to get Linus to take it.

I suppose. But I think it won't do any harm :?? so it should be
accepted. The only think it does is to eliminate some bloat from the kernel...

Raúl

#24 lore raw
Followup to:  <20030305170452.GD19439@DervishD>
By author:    DervishD <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 6 lines

Hi Peter :)

H. Peter Anvin dixit:

Quoted 2 lines
Quoted 2 lines

Please, try to convince Marcello and Alan, too. The 2.4 branch
will be a happier branch (well, assuming that the Linux kernel has

Quoted 9 lines
Quoted 3 lines

sent the code to Alan for 2.5-ac and to Andi for x86-64 (where it has already been integrated); if anyone wants to try to persuade Marcelo to integrate it, be my guest

If you want, I can prepare a patch for the 2.4 series, but if I
have had problems for a three-line diff to be included, think about yours... If you think that Marcello will be inclined to accept this patch I'll prepare it in your name.

I can ask him, at least.

-hpa

Signature · 3 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64
#25 lore raw
In reply to H. Peter Anvin
Quoted 3 lines · H. Peter Anvin

It doesn't work for anything but old legacy floppies. I have already sent the code to Alan for 2.5-ac and to Andi for x86-64 (where it has already been integrated); if anyone wants to try to persuade Marcelo to

It seems completely inappropriate to remove a feature from the 'stable' kernel tree.

Alan

#26 lore raw
Followup to:  <[email protected]>
By author:    Alan Cox <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 4 lines

It seems completely inappropriate to remove a feature from the 'stable' kernel tree.

Agreed. The only issue is whether or not it's too broken to be considered a feature at this point (my feeling would be that it's not, and should be removed in 2.5, not 2.4.)

-hpa

Signature · 3 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64