Toomas, I may be misunderstanding, but I believe pmbr.s is stage 0 pointing to stage 1, as determined by the linker. but what about stage 1 to stage 2? where is the stage 1 code?
thanks On Fri, Jul 26, 2024, 6:39 PM Toomas Soome via illumos-discuss < discuss@lists.illumos.org> wrote: > > > On 27. Jul 2024, at 01:20, Bryce <678...@gmail.com> wrote: > > Toomas, you mentioned that you can "script" booting from the unformatted > disk... could you elaborate on this? > > > since loader is using forth as command interpreter and we have forth words > to open, close, read from files, so we can do something like open > “disk0p1:” and then read data from it. > > > > Im aware of the sector zero (mbr or vbr) limitations, so i underatand that > stage 1 must be loaded using bios int 13h. But what about stage 1 loading > stage 2? could you point me to the relevant loop in stage 1 that deals with > passing control to stage 2? specifically, how stage 1 finds stage 2 on disk? > > > we are just recording starting lba and size in sectors in pmbr binary and > it is reading those blocks into memory and jumps there. See > usr/src/boot/i386/pmbr/pmbr.s. > The values are set by installboot program. To avoid browsing partition > tables to guess where our rootfs might be, installboot also does record the > lba of rootfs partition in next stage. > > rgds, > toomas > > > Thanks > > On Fri, Jul 26, 2024, 4:39 PM Toomas Soome via illumos-discuss < > discuss@lists.illumos.org> wrote: > >> >> >> > On 26. Jul 2024, at 22:16, Joshua M. Clulow via illumos-discuss < >> discuss@lists.illumos.org> wrote: >> > >> > >> > We actually don't use our legacy GRUB anymore. It hasn't been deleted >> > from the source tree, but it will eventually be when someone finds >> > time to do that gracefully. Our current boot loader is in the tree >> > under "usr/src/boot", and is one we imported from FreeBSD. I don't >> > believe that loader can read directly from a disk slice, but it does >> > have support for several file systems including pcfs (aka FAT), hsfs >> > (aka ISO), UFS, ZFS, etc. >> > >> >> reading from “raw” disk is nothing impossible - we can actually even >> script it, but it is another question, why…. With BIOS setup, we actually >> read stage1 (gptzfsboot) from either boot slice or from zfs label boot >> block area, and the reason is, stage0 is small an can not have file system >> driver built in (we can use 446 bytes max;). The cost of it is that you >> have to have infrastructure to install and maintain your program in raw >> disk space… >> >> rgds, >> toomas >> >> >> ------------------------------------------ >> illumos: illumos-discuss >> Permalink: >> https://illumos.topicbox.com/groups/discuss/Tc9bfa679c7294ee7-M7326ab2012b69062f05d8abf >> Delivery options: >> https://illumos.topicbox.com/groups/discuss/subscription >> > > *illumos <https://illumos.topicbox.com/latest>* / illumos-discuss / see > discussions <https://illumos.topicbox.com/groups/discuss> + participants > <https://illumos.topicbox.com/groups/discuss/members> + delivery options > <https://illumos.topicbox.com/groups/discuss/subscription> Permalink > <https://illumos.topicbox.com/groups/discuss/Tc9bfa679c7294ee7-M8a383c71a51fe01800536ffe> > ------------------------------------------ illumos: illumos-discuss Permalink: https://illumos.topicbox.com/groups/discuss/Tc9bfa679c7294ee7-Mc217b4a13817c5c0be2ce90f Delivery options: https://illumos.topicbox.com/groups/discuss/subscription