Hi all, I’ve some questions/remarks about FreeLoader.

 

But first let’s start with some introduction…

 

On Windows (up to 2k3, things changed starting Vista), the boot loader is in
two flavours, the usual one (NTLDR) used for loading Windows when it is
installed, and another one (SETUPLDR) used only for text-mode setup.

NTLDR shows the classical OS menu (as we do in ReactOS), whereas SETUPLDR
can be seen when you boot with a Windows setup CD: it shows some kind of
text-mode blue-screen, displaying in a status bar the status of loading some
boot-time drivers, possibly allowing you to press a function key to be able
to give additional drivers to be loaded. After that, things are loaded (HAL,
kernel…) and the text-mode setup program proper is loaded (usetup.exe aka
smss.exe in the disc).

 

Whichever bootloader being considered, it is made of two parts
(concatenated):

- a 16 (real-mode)-to-32 bits part, let’s call it STPBOOT.BIN (to follow the
convention of
http://reboot.pro/topic/5900-make-your-own-nt-os-loader-ntldrsetupldr/ ),

- and a 32-bit one.

The 16-bit part is some kind of stub which switches the CPU to 32 bit (and
may also contain some utility functions to make real-mode callbacks). This
stub is the same for both NTLDR and SETUPLDR, whereas the 32-bit part
differs.

In the Windows CD, in the \I386 directory you have those files, NTLDR and
SETUPLDR.BIN. But if you analyze them, and after noticing the (compressed)
files OSLOADER.NT_ (that expands to OSLOADER.NTD, but is in fact a native
.EXE), and SETUPLDR.EX_ (that expands to SETUPLDR.EXE, also native EXE),
you notice that in fact NTLDR == STPBOOT.BIN + OSLOADER.EXE and SETUPLDR.BIN
== STPBOOT.BIN + SETUPLDR.EXE .

 

(EDIT: During writing this mail I discovered that
http://en.wikipedia.org/wiki/Windows_NT_startup_process#CD-ROM_boot_image_ph
ase mentions the same thing in the “Boot loader phase” paragraph).

 

On ReactOS we do the same: our FREELDR.SYS is made of a 16-bit part
FRLDR16.BIN concatenated with FREELDR_PE.DLL (using the names of the
generated files when you compile ROS). Also we had two targets, FREELDR and
SETUPLDR, the former for generating the usual boot loader whereas the latter
was used for the bootcd. However starting revision 65832
(http://svn.reactos.org/svn/reactos?view=revision
<http://svn.reactos.org/svn/reactos?view=revision&revision=65832>
&revision=65832 ) both SETUPLDR and FREELDR became the same. Why? What
differed them was the support of the boot loading option “ReactOSSetup”:
SETUPLDR was in fact FREELDR *with* the support of this option (in some
revisions ago there was also support for some setup-like blue UI, see
revision 57933: http://svn.reactos.org/svn/reactos?view=revision
<http://svn.reactos.org/svn/reactos?view=revision&revision=57933>
&revision=57933 and references within). Starting r65832 the setup support is
automatically included in FREELDR. Therefore when we generate the bootcds,
we generate a FREELDR and a SETUPLDR but both files are the same
binary-wise.

 

Hence the question: “Should we still keep the SETUPLDR target, or just
directly use FREELDR in all situations?”. One may say “keep it” for
“compatibility” purposes (filename-wise), but then one might just keep only
the setupldr.sys file in the bootcd (and remove the freeldr.sys one)?

 

Another question would be: “Should we restore a SETUPLDR target (i.e. put
setup-oriented code for SETUPLDR only and not in the usual FREELDR) in order
to be able, in the future, to implement some sort of on-demand extra driver
loading, as Windows’ SETUPLDR does?”

 

A final note, too (plus question): since our recent PXE support (that
appears to work! Thanks to Jérôme + Pierre effort, and numerous testers)
somebody oriented me to how this is done in Windows: they have a
“STARTROM.0” file that is the bootstrap (downloaded and ran by PXE thing)
which then loads a NTLDR (somewhat). I binary analyzed it and it seems to be
of the same nature as the STPBOOT.BIN file, i.e. 16-bit bootstraper.
Question: does it load (after download) directly the 32-bit OSLOADER? OR
does it load the “full” NTLDR instead?, i.e. loading the 16-bit NTLDR part
(that then loads the 32-bit part)?

 

Answers and comments are highly welcome!!

 

Happy new year to everyone!

 

Hermès.

_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Reply via email to