Hi,
I'm searching for a way to find a 2nd stage of a boot loader - best would be to be fs-independent. Any clues??
Thanks
Darkening
Finding stage2
Re: Finding stage2
If you don't use the filesystem, there are two other ways:
1. Assume the second stage is stored in contiguous sectors
on the disk. The only information you need to find the
second stage is the starting sector and number of sectors.
A file stored on a freshly-formatted FAT12 or FAT16 disk
will be stored in contiguous sectors, but not if you modify
the file afterwards.
2. Write a program to make a list of the disk sectors
which contain the second stage, then write this sector list
into the first stage code. This is how the LILO and GRUB
first stages work, I think.
If you modify the second stage file, you must re-run the
sector list installer.
1. Assume the second stage is stored in contiguous sectors
on the disk. The only information you need to find the
second stage is the starting sector and number of sectors.
A file stored on a freshly-formatted FAT12 or FAT16 disk
will be stored in contiguous sectors, but not if you modify
the file afterwards.
2. Write a program to make a list of the disk sectors
which contain the second stage, then write this sector list
into the first stage code. This is how the LILO and GRUB
first stages work, I think.
If you modify the second stage file, you must re-run the
sector list installer.
Re: Finding stage2
Thanks for the hints, I also thought about an asm-header with a signature. Now I'm wondering about the 2nd stage - I'd like to use gcc - but it outputs 32bit (with objcopy) and then I can't read from disk (GRUB does this with switching between 16- and 32bit, but it seems a bit complicated), so does anyone know something about this???
Darkening
Darkening
Re: Finding stage2
There are at least 4 free C compilers that produce 16-bit
(real mode) code. I've used Watcom C and Turbo C. Both work OK.
(real mode) code. I've used Watcom C and Turbo C. Both work OK.