CORE-19691
Removing the `livecd_start.cmd` entry also caused the "Profiles/Default User/My Documents"
directory to not be created in the LiveImage. When booting it, this
caused explorer.exe to hang while loading the desktop, for **some**
(but not all) non-english environments.
(Technically it should instead ignore the non-existing directory if it
cannot create or open it, or drop an error then continue execution...
But that's another bug for another time!)
Adding back the creation of this directory fixes the hang.
CORE-15156, CORE-19691, CORE-19692
Finally get rid of the livecd_start.cmd hack introduced waaaay back
in commit ff6d7b0236 (r54514)!
See also commits ea682b6909 (r54512) and 71867403fd (r54513).
For target paths, use the shell "special shell folder" syntax:
`shell:windows\...` or `shell:system\...`, introduced in commit
7b081be46d (PR #7158) by Whindmar Saksit.
Specify an explicit icon path and index for the "Read Me.lnk" shortcut.
Includes ideas from PR #7154 by Katayama Hirofumi MZ.
The generated shell links are confirmed to work on ReactOS, but also on
Windows 2003 and Windows 7.
- Change the MKSHELLLINK icon parameter syntax to be: `-i [icon_path[,nr]]`
where, either both `icon_path` and icon index are given, separated by
a comma ',' , or, either the `icon_path` is given but the index is
optional (default: 0), or, only the icon index is given, in which case
the icon path is set to the target instead.
- Use a `VERBATIM` command-line for `add_custom_command()`, so that *nix
builds can cope with parameters containing backslashes.
- The shortcut target path, working directory, command-line arguments,
and icon path all may specify explicit Win32 environment variables
(like `%SystemRoot%`, `%HOMEDRIVE%`, etc.). Because these environment
variables are specified as data given to the build tool via CMake,
**AND** we have to workaround keeping these variables unexpanded when
they are transmitted to the tool via CMD.EXE (on builds made on Windows),
specify these variables in an "escaped" format, using `^%` instead:
`^%SystemRoot^%`, etc.
Additionally these paths may be explicitly quoted and passed that way
to the MKSHELLLINK tool.
In order to deal with both unquoting the strings and unescaping the
environment variables, introduce a helper function and invoke them on
the aforementioned strings.
- Use variables to define and hold the on-disk shortcuts destination
directories (the "Profiles/All Users/..."), and use these variables
in the `add_livecd_shortcut()` calls; this allows shortening the
corresponding lines.
- There are currently two shortcuts: "Command Prompt" and "ReactOS
Explorer", that are added to more than one destination.
Previously, we had to invoke `add_livecd_shortcut()` for each
destination. However, each invocation recreated the _**same**_
shortcut file (with the same .lnk file name) in the build directory.
To solve this, the `dest` parameter of the `add_livecd_shortcut()`
function, is replaced by a `DESTINATION` keyword, whose value is
a list of one or more destination directories, where the shortcut
should be added.
CMakeLists.txt: `add_livecd_shortcut()`:
Turn the macro into a function. Instead of keeping a `LIVECD_SHORTCUTS`
global-scope list variable, just define a `livecd_links` custom target
as initially empty, then, using `set_property()`, directly append to it
its "SOURCES" i.e. generated .lnk files.
(This is equivalent to using `target_sources(livecd_links PRIVATE ...)`
only in CMake 3.20+ for the custom target.)
CMakeMacros.cmake: `add_link()`:
- Since both `name` and `path` parameters are mandatory, make them
explicit in the function declaration instead of defining them as
"optional" parameters.
- Remove the `set_source_files_properties(... PROPERTIES GENERATED TRUE)`
invocation that followed the `add_custom_command(...)` call, since,
per the documentation[^1],
"Each output file will be marked with the `GENERATED` source file
property automatically." (Since CMake 3.2 at least.)
[^1]: https://cmake.org/cmake/help/v3.17/command/add_custom_command.html
The PAE flag might be enabled on some x86-32 UEFI platforms, causing a crash in the kernel.
```
Assertion C:\reactos-master\reactos\ntoskrnl\mm\ARM3\miarm.h(971): PointerPte->u.Hard.Valid == 0
nt!MI_WRITE_VALID_PTE+0x28:
822d1d08 cd2c int 2Ch
```
Tested using qemu with `OVMF32_CODE_4M.fd` firmware, and with 32bit UEFI in VMware.
- Make the menu contents more dynamic; inspired by PR #8871 by Ahmed Arif.
- advopts.c: Double-relicense ntldropts.c/h to GPL-2.0-or-later or MIT,
as most of the code in this file has been rewritten for years now.
- options.c (FreeLoader setup options menu):
Double-relicense options.c/h to GPL-2.0-or-later or MIT, as most
of the code in this file has been rewritten since commit 9ff4e4b9ef.
CORE-9069, CORE-13525, RELEASE-11
This new BootCD contains the functionality of both the original bootcd
(text-mode 1st-stage installer) and the livecd (that will include the
1st-stage GUI installer later).
Our separate livecd ISOs become obsolete, and this completely removes
the need for the so-called "hybridcd" ISO.
Some details:
- The "hybridcd" build target is completely removed, since now the new
BootCD *is* basically what we used to call "hybridcd".
- The "livecd" build target is kept so far (to minimize the code changes),
but internally I start to refer to it as "LiveImage", and is reduced
to a minimum.
A minimal non-bootable "liveimg.iso" is built (but currently not
included within the BootCD). Its purpose will be to implement the
"ReactOS Live" functionality as a RAMDISK.
(We currently don't support other file formats apart from ISO and
flat disk for a RAMDISK).
The "ReactOS Live" (non-RAMDISK) is implemented by adding to the
BootCD file tree the files from the LiveImage.
These files add two root directories, "Profiles" and "reactos"
(which is the SystemRoot for the non-ramdisk LiveImage).
- The minimal text-mode ReactOS installation used for the 1st-stage
installer, including USETUP itself, and the executable for the
1st-stage GUI installer and the reactos.cab (installation source),
are moved to the root directory called "i386" (ideally, one directory
per architecture).
- The "bootcdregtest" target, i.e. the ISOs we feed our testbots with,
are left untouched, i.e. they are only constituted of the 1st-stage
text-mode installation only, but placed in a per-architecture root
directory ("i386", etc. as for the bootcd).
- Remove the ACPI APIC/SMP entries from bootcd.ini. They will be made
available via the Advanced Boot Options F8 menu in Debug builds, for
testing purposes only, in a subsequent commit.
This commit is based upon an older SVN one:
svn path=/branches/setup_improvements/; revision=75273
And slightly improve the search loop.
- Unconditionally look into the root directory as well, in order to cover
all possible boot disk layouts in case someone customizes the ReactOS
boot media layout.
- Improve the `InfOpenFile()` call error handling, in order to show the
erroneous line _iff_ the call failed because of a wrong syntax in
TXTSETUP.SIF . Distinguish it from a failure because the file doesn't
exist in the source path being tested (in which case, no error is shown).
The legide.sys driver, introduced in commit ae2827f481, is compiled *ONLY*
for the x86 platform (not x64 nor the others) as specified in commit 7d33f7503b.
Fix the file installation copy by moving its entry into the x86-specific section.
Addendum to commit 7174935d73 (PR #8888). CORE-17256
After merging the new ATA driver, FreeLdr complains about not being able
to load legide.sys. Fix that by adding legide.sys driver to txtsetup.sif
so FreeLoader can load it.
Addendum to ae2827f481. CORE-17256
These two registry values, stored in `HKEY_LOCAL_MACHINE\SYSTEM\Setup`,
are generated at runtime by the kernel; they are based on the current
values of: `LoaderBlock->NtHalPathName` and `LoaderBlock->ArcBootDeviceName`
respectively.
In particular, hardcoding `SystemPartition` to a default value
"\Device\Harddisk0\Partition1" , would be as random as hardcoding it
to anything else, since nothing justifies that there exists a partition
on the first harddisk, and if there is one, nothing guarantees that it
is one that was used to boot the operating system... Especially when
booting a LiveCD!
instead of the MBR-specific PARTITION_TABLE_ENTRY structure.
Simplify also some aspects of the code:
- for MBR code, avoid copying around partition entries, but use
pointers instead;
- more generally, use the actual disk sector size instead of guessing,
and pass it to the partition interface routines.
- `ArcBootDeviceName`: Given a theoretically valid ARC boot path
of the form:
`multi(0)disk(0)rdisk(0)partition(2)ReactOS\\weird)name`
correctly determine `ArcBootDeviceName` to be:
`multi(0)disk(0)rdisk(0)partition(2)`
and `SystemRoot` to be what follows it:
`ReactOS\\weird)name`
Usual paths like: `multi(0)disk(0)rdisk(0)partition(2)\\ReactOS`
are still correctly handled, of course.
- The `ArcHalDeviceName` path is the ARC path to the system partition,
where the firmware started the bootloader from. For historical reasons
it's called Arc **HAL**, because on older (and non-x86) Windows versions
the HAL was to be placed next to the OS loader in the system partition,
while the rest of the OS (kernel, etc.) was placed elsewhere.
So, in order to correctly set `ArcHalDeviceName`, pass the determined
SystemPartition all the way down to `WinLdrInitializePhase1()`.
For fixed-disks (i.e. not floppy nor CD-ROM), check in `disk.c!DiskInitialize()`
whether the disk being enumerated is GPT. If so, retrieve its disk GUID.
Pass this information to `AddReactOSArcDiskInfo()` when filling the ARC
disk information block, which sets the `IsGpt` and `GptSignature` members
of the `ARC_DISK_SIGNATURE` structure accordingly.
Debugging output example, where the first disk (0x80) is MBR, while the
second (0x81) is GPT:
```
(freeldr\disk\disk.c:100) err: DiskInitialize(0x80, 'multi(0)disk(0)rdisk(0)', Type: 25)
(freeldr\disk\disk.c:125) err: Signature: 163fbb9d
(freeldr\disk\disk.c:134) err: Checksum: 47699104
(freeldr\disk\disk.c:137) err: IsPartitionValid: TRUE
(freeldr\disk\disk.c:100) err: DiskInitialize(0x81, 'multi(0)disk(0)rdisk(1)', Type: 25)
(freeldr\disk\disk.c:125) err: Signature: 0
(freeldr\disk\disk.c:134) err: Checksum: 9cb5ff90
(freeldr\disk\disk.c:137) err: IsPartitionValid: TRUE
(freeldr\disk\disk.c:157) err: Disk 0x81 is GPT, DiskGuid: {1e4e8972-e026-4d5f-b213-7be3f2fad3f8}
```
----
This fixes the BSOD 0x7B `INACCESSIBLE_BOOT_DEVICE` that happens when
trying to boot a ReactOS installation present in a partition on a GPT
partitioned disk.
In the kernel IO manager:
`IopCreateArcNamesDisk()`, invoked by `IopCreateArcNames()`, tries to
map the list of disks dynamically detected by the boot disk drivers
with those detected by the bootloader, by matching their disk signatures.
- The signatures of the disks detected by the boot disk drivers are
obtained when querying their drive layout and partition table (which
also tells whether the disk is MBR or GPT partitioned);
- while the signatures of the disks detected by the bootloader are
enumerated in the `LoaderBlock->ArcDiskInformation->DiskSignatureListHead`
linked-list (inside `ARC_DISK_SIGNATURE` structures).
The routine compares the disk signatures by invoking `IopVerifyDiskSignature()`,
which, depending on whether the disk is MBR or GPT (as reported in the
drive layout), compares the signature with that of `ARC_DISK_SIGNATURE`
`Signature` (for MBR) or `GptSignature` (for GPT) structure members.
In case the boot disk turns out to not be mapped -- which was the case
until now if it was GPT-partitioned -- then the `IopMarkBootPartition()`
routine invoked later, wouldn't be able to find and open the boot disk,
and would trigger the BSOD 0x7B, as the result.
so that it can be used for other platforms.
Based upon suggestions by Daniel Victor (@iLauncherDev).
partition.c: Double-license GPL-2.0-or-later and MIT
This fixes boot regression on Xbox, introduced in 3964c936cb.
A new `call writestr` on early boot leads to `writechr` helper call,
which uses INT 10h BIOS service. This ends up in early boot crash,
as the original Xbox doesn't have VGA BIOS, nor the BIOS Data Area.
Fix the problem by adding Xbox-specific assembly helpers.
CORE-16216, CORE-19882
CORE-9023
In case FREELDR.INI is missing, or there are no operating systems listed
and available (either the corresponding section is missing, or is empty),
fall back to the FreeLoader Setup and Configuration F2 menu, that allows
performing a minimal number of operations (enabling FreeLoader debugging;
doing a custom boot... and more to come!)
Fix also a bug in `InitOperatingSystemList()`, that would allow
allocating an empty list with zero items. Now it returns NULL if
no operating systems are found.
Default to the Minimal text UI instead of the fullfledged one, if no
"MinimalUI" option can be found in FREELDR.INI (or if the INI is missing).
CORE-9023
Make also the advanced boot menu depend on the operating system type.
It can be opened by pressing F8, or F5, as in the Windows' bootloader.
The FreeLoader-specific options are moved to a separate menu,
accessible via the F2 key from the main menu.
Work-in-progress: display the boot options that correspond to the
currently-selected boot entry.
Use `NtLdrGetNextOption()` to loop over each individual option and move
it to its proper place. This automatically trims any '/' option
separator, including repeated ones and whitespaces, and allow for
straightforward replacement with one single space.
instead of returning an erroneous value, since the rosload.exe entry point
`RunLoader()` doesn't return any value. This allows exiting from rosload.exe
and NOT having the `LaunchSecondStageLoader()` returning 0, for example,
which would then be interpreted as an error condition and showing the
"Unable to load second stage loader." error box.
- `AtaInit()` returns the number of detected ATA devices. Therefore,
when iterating over them, go from index 0 to the count _minus_ 1,
in `Pc98InitializeBootDevices()` and in `XboxDiskInit()`.
- Initialize `DiskDrive->Type` to `DRIVE_TYPE_HDD` for detected SCSI
hard-disk drives in `pc98disk.c!InitScsiDrive()`.
- Rearrange `XboxDiskInit()` and reduce its indentation level.
Move the `DiskReportError()` and `DiskError()` routines into the
`freeldr/disk/disk.c` file, reviving it as a collection of disk
devices helpers (and more in the future).
The architecture-specific disk modules only define the error code mapping
`DiskGetErrorCodeString()` function, that is then used by `DiskError()`.
- Let it take a `MachFindPciBios` parameter, similar to the
`GET_SERIAL_PORT MachGetSerialPort` parameter of `DetectSerialPorts()`.
- Remove the `FindPciBios` global.
- Reduce indentation level.
Skip x86 BIOS emulator initialization on EFI boots by having FreeLdr populate EFI boot state in the loader block and making HAL consume it.
This keeps BIOS behavior unchanged while avoiding legacy BIOS/INT10 setup in the EFI path and preventing early EFI boot failures caused by entering the BIOS emulator path at all.
* [FREELDR][UEFI] Add BGRT logo support and center it on the loading screen
* [FREELDR][UEFI] Rework BGRT support and localize ACPI definitions
* [FREELDR][UEFI] Handle signed BGRT BMP height explicitly
* [FREELDR][UEFI] Use shared ACPI BGRT definitions
---------
Co-authored-by: Ahmed ARIF <arif.ing@outlook.com>
- Fix #GP crash on UEFI x64 boot caused by `call ExecuteLoaderCleanly[rip]` and `mov rax, UefiExitBootServices[rip]; call rax` generating indirect calls that read function code bytes as a pointer.
- Reload CS and data segments after `lgdt` to avoid #GP from stale UEFI selectors (e.g. CS=0x38) exceeding the new GDT limit.
Detect whether we run on XBOX or PC98 (on x86 builds), or on (U)EFI or on
a BIOS-based PC, or whether a generic linear framebuffer mode is used, in
order to choose the correct bootvid module to load, based from a predefined
file names list (ideally it should be derived from txtsetup.sif...).
Supersedes PR #8701.
Use `KeFindConfiguration*Entry()` to spelunk the hardware configuration
tree in the NT loader module.
Alternatively, allow the user to override the choice with a new `BOOTVID=`
boot option. In any case, if the selected bootvid module failed to be loaded,
silently fall back to the default bootvid.dll file. The fallback is done
by just letting the PE loader resolve the necessary exports from hal.dll
and ntoskrnl.exe.
This is the same feature as the one that already exists in the
NTOS:KD!kdmain.c module used by the in-kernel KDBG debugger
(GCC builds), first introduced in commit 4ce30245de (r54473),
and documented at:
https://reactos.org/wiki/Debugging#Changing_the_serial_port_address
This feature is useful if one uses a PCI, PCIe, PCMCIA, or ExpressCard
serial card on real hardware (these cards are used e.g. with laptops
without a built-in serial port), or with AMT serial over LAN.
After determining the serial port I/O address (say, 0xCC00), specify
the debug port as follows:
/DEBUGPORT=COM:0xCC00
instead of the usual syntax: /DEBUGPORT=COMn (n an integer).
The same syntax can be used for debugging FreeLoader as well: in the
FREELDR.INI file, add a "Debug" line in the "FREELOADER" section,
as follows:
```
[FREELOADER]
Debug=/DEBUG /DEBUGPORT=COM:0xCC00 /BAUDRATE=115200
```
----
NOTE for KDCOM/KDGDB:
Since `strtoul()` is used, but isn't exported by ntoskrnl, link against
the "strtol" static library that has been introduced in commit d317d4fbcc
(r71481).
Don't loop past the end of the command-line buffer, if the command-line
terminates with a lone "DEBUGPORT" without any extra parameter following.
For example: "some things DEBUGPORT "