History log of /haiku/src/system/boot/loader/main.cpp
Revision Date Author Comments
# 2ca24be6 30-Sep-2022 David Karoly <karolyd577@gmail.com>

boot: embed Haiku revision in loader binary

Change-Id: I9f71fba6c2c4fdaa63e118825c5fd00d51b556fb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5693
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# f1fa58bf 25-Jul-2021 X512 <danger_mail@list.ru>

haiku_loader.efi: update for riscv64

* Added MMU page table generation.
* Added optional FDT device detection and passing to kernel.
* Add platform address translation stubs to bios_ia32
to drop EFI ifdefs

Change-Id: I89257c93c84404fd988f621b29f927ed0df3c3b1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4304
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 560961ee 11-Aug-2020 Murai Takashi <tmurai01@gmail.com>

Bootloader: replace blacklist with blocklist

Various projects, both commercial and OSS, began to use inclusive
terminology. There is no reason to not do it.

In Haiku, bootloader uses Blacklist, which is recommended to replace
with Denylist or Blocklist. I think Blocklist is appropriate here,
since it's a list used to block offending driver at boot.

Some strings remain unchanged for compatibility with previous naming,
but this change prepares for later removal of these (once everyone has
updated their kernel and bootloader).

Change-Id: Id9105ff5e9fcb866000355089b5ef97bf63ee854
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3145
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# ddcb56f2 21-Apr-2020 Jérôme Duval <jerome.duval@gmail.com>

bootloader: support older kernels.

if no microcode is found, we can also omit the optional fields.
should help with #15891

Change-Id: I2fcb63ccb0cdf77caf7d5e1770c254561b231a18
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2506
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 11f8b65a 20-Feb-2020 Jérôme Duval <jerome.duval@gmail.com>

boot_loader: load intel microcode update data file

Previous version of the patch was broken by the EFI refactoring.

Change-Id: I6dd125100b22b2461c531bfd8f81b3dd28e2b751
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2409
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 6f857fa9 23-Mar-2020 waddlesplash <waddlesplash@gmail.com>

Revert "boot_loader: load intel microcode update data file"

This reverts commit a7320593242cc0863fc909c1a32dbd255384d7dd.

It broke the build on most boot platforms (including EFI.)


# a7320593 20-Feb-2020 Jérôme Duval <jerome.duval@gmail.com>

boot_loader: load intel microcode update data file

Change-Id: I323a57cc0b1f05ad7b60b6a141d068a3e618ee4d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2263
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 56bb1bd5 20-Feb-2020 Jérôme Duval <jerome.duval@gmail.com>

kernel: load cpu microcode update if loaded by the bootloader

add optional fields for microcode in kernel_args.

Change-Id: Ic5fb54cf6c9f489a2d1cdda00f63980c11dcdaeb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2264
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# e1b41d44 13-Jun-2010 Andreas Faerber <andreas.faerber@web.de>

boot loader: Wire up net_stack_cleanup()

Add a platform cleanup hook before starting the kernel. The openfirmware
and PXE loaders clean up their network stack there, while the other
loaders currently do nothing.

This closes ticket #6166

Change-Id: I34765892dfd9b2310c6af97c9ff7d414afae49e5
Reviewed-on: https://review.haiku-os.org/c/50
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# c3361cad 14-Jan-2019 Augustin Cavalier <waddlesplash@gmail.com>

bootloader: Load driver settings before the kernel.

This way, parts of the bootloader (e.g. the ELF loader) that would
like to access driver settings can do so.


# 5effe7f3 09-Mar-2018 Jaroslaw Pelczar <jarek@jpelczar.com>

bootloader: Align boot volume structure to 8 bytes instead of 4.

This alignment is preferred e.g. on ARM when using 64-bit values.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 304f594d 13-Nov-2017 Augustin Cavalier <waddlesplash@gmail.com>

De-wire net_stack_cleanup from boot/loader/main.cpp

This reverts commit 2960780faa7e9c2e5e7a80cb8925be5ee59ae5ef.
Sorry for the noise; I thought I'd run a compile but apparently it was
only a partial one.

It seems that the netboot core is linked into the main bootloader
no matter the build configuration, which means that since this one
function was called, the linker tried to resolve all the other symbols
from that static library. Which of course failed.


# 2960780f 13-Jun-2010 Andreas Faerber <andreas.faerber@web.de>

Wire up net_stack_cleanup()

The NetStack.h header is currently not usable from C code. So while
net_stack_init() is called from platform code, we cannot call
net_stack_cleanup() from OpenFirmware's platform_start_kernel().
Thus call it directly from main()'s cleanup TODO, having assured
that the function is a no-op when no network stack was initialized.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 6a2fd3a5 03-Apr-2014 Jonathan Schleifer <js@webkeks.org>

Add __dso_handle to bootloader and kernel

Clang references these when building for x86_64.


# 8540ec24 19-Jan-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Save previous session's debug syslog during boot

Add boot loader debug menu option "Save syslog from previous session
during boot". If enabled (defaults to true), the previous session's
debug syslog data is copy to a separate buffer and passed to the
kernel, which writes it back to the file /var/log/previous_syslog.
As long as Haiku still boots, this should now be the most convenient way
to retrieve the output from a kernel crash.


# c04f3a62 20-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

boot loader: Add safe mode blacklist submenu

It's a browser for the system package content, where entries can be
selected to blacklist them. The selected entries are removed from the
packagefs instance in the boot loader, so that e.g. selected drivers
won't be picked up. The paths are also added to the safe mode driver
settings and will be interpreted when the system packagefs instance is
mounted by the kernel.


# 4b723e3f 06-May-2013 Axel Dörfler <axeld@pinc-software.de>

boot loader: Almost removed use of kernel_cpp.h.

* For some reason that is beyond me, fat/CachedBlock.cpp needs this header,
or else building the boot loader fails.


# 00090d29 08-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

boot loader: print max heap usage info before entering kernel


# d8efc6ca 21-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Changes to kernel_args to make it identical for x86 and x86_64.

* Added a FixedWidthPointer template class which uses 64-bit storage to hold
a pointer. This is used in place of raw pointers in kernel_args.
* Added __attribute__((packed)) to kernel_args and all structures contained
within it. This is necessary due to different alignment behaviour for
32-bit and 64-bit compilation with GCC.
* With these changes, kernel_args will now come out the same size for both
the x86_64 kernel and the loader, excluding the preloaded_image structure
which has not yet been changed.
* Tested both an x86 GCC2 and GCC4 build, no problems caused by these changes.


# 192af9e0 20-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Changed addr_range to use uint64.

I've tested this change on x86, causing no issues. I've checked over the code
for all other platforms and made the necessary changes and to the best of my
knowledge they should also still work, but I haven't actually built and
tested them. Once I've completed the kernel_args changes the other platforms
will need testing.


# 93cb9538 20-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Don't store a KMessage in kernel_args for the boot volume, only the buffer address/size.

Pointers in kernel_args are going to be changed to unconditionally use 64-bit
storage (to make kernel_args compatible with both the x86 and x86_64 kernels).
KMessage stores a pointer to its buffer, however since KMessage is used
outside of the boot code it is undesirable to change it to use 64-bit storage
for the pointer as it may add additional overhead on 32-bit builds. Therefore,
only store the buffer address and size and then construct a KMessage from
those in the kernel.


# 533833f6 19-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add kernel args boot volume "packaged" flag

* Add BOOT_VOLUME_PACKAGED boot volume message field name constant.
* register_boot_file_system():
- Now takes a BootVolume& parameter.
- If the boot volume is packaged, add that info to the boot volume
message.


# d11ea2b5 17-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Introduce BootVolume abstraction class

BootVolume is initialized from a root directory of a volume. It finds
the system directory, and -- not implemented yet -- mounts the system
package, if the system is packaged, replacing the system directory with
it. Adjusted several functionality (main(), the loader functions,
user_menu()) to use BootVolume instead of the root directory.


# 7b1d69ec 23-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Added safe mode option B_SAFEMODE_4_GB_MEMORY_LIMIT (plus a boot loader menu
item) and kernel settings option "4gb_memory_limit". Enabling either one
causes the memory beyond 4 GB to be ignored.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37225 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 25bca188 27-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved setting the debug syslog default to main(). Previously that was done
only when the boot loader menu was entered.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35977 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 56c6c0fe 03-Aug-2009 François Revol <revol@free.fr>

- introduced an "argumetns" field in stage2_args to hold command line args from chaining loader,
- added some multiboot support code:
- dump some of the passed info,
- parse command line (skip the 'kernel' name and pass the rest to stage2_args.arguments),
- added an add_stage2_driver_settings() function which takes stage2_args.arguments and translates it into safe mode driver settings, a bit dumb for now.
This allows using qemu -kernel haiku_loader -append 'debug_screen true' and get debug output without having to enter the menu (once multiboot info is used to determine the boot device too).
The idea is to allow passing driver settings and using them to pass extra stuff (like 'force_keymap fr' and other stuff for demo), and to help automate tests ('run_test /bin/sometest').
This should answer Axel's question :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32076 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9e8dc2a9 14-Jul-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

[Sorry, couldn't split this one up any further.]
* Images preloaded by the boot loader had to be modules to be of any use
to the kernel. Extended the mechanism so that any images not accepted
by the module code would later be tried to be added as drivers by the
devfs. This is a little hacky ATM, since the devfs manages the drivers
using a hash map keyed by the drivers inode ID, which those drivers
obviously don't have.
* The devfs emulates read_pages() using read(), if the device driver
doesn't implement the former (all old-style drivers), thus making it
possible to BFS, which uses the file cache which in turn requires
read_pages(), on the device. write_pages() emulation is still missing.
* Replaced the kernel_args::boot_disk structure by a KMessage, which can
more flexibly be extended and deals more gracefully with
arbitrarily-size data. The disk_identifier structure still exists,
though. It is added as message field in cases where needed (non net
boot). Moved the boot_drive_number field of the bios_ia32 platform
specific args into the message.
* Made the stage 1 PXE boot loader superfluous. Moved the relevant
initialization code into the stage 2 loader, which can now be loaded
directly via PXE.
* The PXE boot loader does now download a boot tgz archive via TFTP. It
does no longer use the RemoteDisk protocol (it could actually be
removed from the boot loader). It also parses the DHCP options in the
DHCPACK packet provided by PXE and extracts the root path to be
mounted by the kernel.
* Reorganized the boot volume search in the kernel (vfs_boot.cpp) and
added support for network boot. In this case the net stack is
initialized and the network interface the boot loader used is brought
up and configured. Since NBD and RemoteDisk are our only options for
net boot (and those aren't really configurable dynamically) ATM, the
the boot device is found automatically by the disk device manager.

Booting via PXE does work to some degree now. The most grievous problem
is that loading certain drivers or kernel modules (or related activity)
causes a reboot (likely a triple fault, though one wonders where our
double fault handler is on vacation). Namely the keyboard and mouse input
server add-ons need to be deactivated as well as the media server.
A smaller problem is the net server, which apparently tries to
(re-)configure the network interface we're using to boot, which
obviously doesn't work out that well. So, if all this stuff is disabled
Haiku does fully boot, when using the RemoteDisk protocol (not being
able to use keyboard or mouse doesn't make this a particular fascinating
experience, though ;-)). I had no luck with NBD -- it seemed to have
protocol problems with the servers I tried.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21611 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59d0807e 19-Dec-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Missing newline in output.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15586 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5af32e75 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed src/kernel to src/system.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12359 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6a2fd3a50eca601f2fc2dd22dfe9a581333c9420 03-Apr-2014 Jonathan Schleifer <js@webkeks.org>

Add __dso_handle to bootloader and kernel

Clang references these when building for x86_64.


# 8540ec2446d1fda22904ace548570b73d91f4726 19-Jan-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Save previous session's debug syslog during boot

Add boot loader debug menu option "Save syslog from previous session
during boot". If enabled (defaults to true), the previous session's
debug syslog data is copy to a separate buffer and passed to the
kernel, which writes it back to the file /var/log/previous_syslog.
As long as Haiku still boots, this should now be the most convenient way
to retrieve the output from a kernel crash.


# c04f3a625afa73d870e755e27e1ebdf9ea6c8038 20-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

boot loader: Add safe mode blacklist submenu

It's a browser for the system package content, where entries can be
selected to blacklist them. The selected entries are removed from the
packagefs instance in the boot loader, so that e.g. selected drivers
won't be picked up. The paths are also added to the safe mode driver
settings and will be interpreted when the system packagefs instance is
mounted by the kernel.


# 4b723e3fb86ecc8027728c6c26d782964419f573 06-May-2013 Axel Dörfler <axeld@pinc-software.de>

boot loader: Almost removed use of kernel_cpp.h.

* For some reason that is beyond me, fat/CachedBlock.cpp needs this header,
or else building the boot loader fails.


# 00090d290d61b06dc60dc91e2b4d9f90f638dd22 08-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

boot loader: print max heap usage info before entering kernel


# d8efc6caf6babe278c48e8aa3277376fb68ff455 21-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Changes to kernel_args to make it identical for x86 and x86_64.

* Added a FixedWidthPointer template class which uses 64-bit storage to hold
a pointer. This is used in place of raw pointers in kernel_args.
* Added __attribute__((packed)) to kernel_args and all structures contained
within it. This is necessary due to different alignment behaviour for
32-bit and 64-bit compilation with GCC.
* With these changes, kernel_args will now come out the same size for both
the x86_64 kernel and the loader, excluding the preloaded_image structure
which has not yet been changed.
* Tested both an x86 GCC2 and GCC4 build, no problems caused by these changes.


# 192af9e0afd2f3d0cbaf5c935480343a70c8ff53 20-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Changed addr_range to use uint64.

I've tested this change on x86, causing no issues. I've checked over the code
for all other platforms and made the necessary changes and to the best of my
knowledge they should also still work, but I haven't actually built and
tested them. Once I've completed the kernel_args changes the other platforms
will need testing.


# 93cb9538be54a2dd4ab6097453ac7d521a9a0b6c 20-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Don't store a KMessage in kernel_args for the boot volume, only the buffer address/size.

Pointers in kernel_args are going to be changed to unconditionally use 64-bit
storage (to make kernel_args compatible with both the x86 and x86_64 kernels).
KMessage stores a pointer to its buffer, however since KMessage is used
outside of the boot code it is undesirable to change it to use 64-bit storage
for the pointer as it may add additional overhead on 32-bit builds. Therefore,
only store the buffer address and size and then construct a KMessage from
those in the kernel.


# 533833f646106f4d14f8329ea7773b42c7e45682 19-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add kernel args boot volume "packaged" flag

* Add BOOT_VOLUME_PACKAGED boot volume message field name constant.
* register_boot_file_system():
- Now takes a BootVolume& parameter.
- If the boot volume is packaged, add that info to the boot volume
message.


# d11ea2b5edf78d1018b1149a57a593af50687920 17-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Introduce BootVolume abstraction class

BootVolume is initialized from a root directory of a volume. It finds
the system directory, and -- not implemented yet -- mounts the system
package, if the system is packaged, replacing the system directory with
it. Adjusted several functionality (main(), the loader functions,
user_menu()) to use BootVolume instead of the root directory.


# 7b1d69ecbb66d555b074b028e26380e92c198673 23-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Added safe mode option B_SAFEMODE_4_GB_MEMORY_LIMIT (plus a boot loader menu
item) and kernel settings option "4gb_memory_limit". Enabling either one
causes the memory beyond 4 GB to be ignored.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37225 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 25bca18888c038fe4cedfc1a7711498f48a7814b 27-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved setting the debug syslog default to main(). Previously that was done
only when the boot loader menu was entered.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35977 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 56c6c0fefbb82f729ae4dfd3ed04adfc236390cd 03-Aug-2009 François Revol <revol@free.fr>

- introduced an "argumetns" field in stage2_args to hold command line args from chaining loader,
- added some multiboot support code:
- dump some of the passed info,
- parse command line (skip the 'kernel' name and pass the rest to stage2_args.arguments),
- added an add_stage2_driver_settings() function which takes stage2_args.arguments and translates it into safe mode driver settings, a bit dumb for now.
This allows using qemu -kernel haiku_loader -append 'debug_screen true' and get debug output without having to enter the menu (once multiboot info is used to determine the boot device too).
The idea is to allow passing driver settings and using them to pass extra stuff (like 'force_keymap fr' and other stuff for demo), and to help automate tests ('run_test /bin/sometest').
This should answer Axel's question :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32076 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9e8dc2a9bbbe768acdfd224a6a4af01918bb4ce0 14-Jul-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

[Sorry, couldn't split this one up any further.]
* Images preloaded by the boot loader had to be modules to be of any use
to the kernel. Extended the mechanism so that any images not accepted
by the module code would later be tried to be added as drivers by the
devfs. This is a little hacky ATM, since the devfs manages the drivers
using a hash map keyed by the drivers inode ID, which those drivers
obviously don't have.
* The devfs emulates read_pages() using read(), if the device driver
doesn't implement the former (all old-style drivers), thus making it
possible to BFS, which uses the file cache which in turn requires
read_pages(), on the device. write_pages() emulation is still missing.
* Replaced the kernel_args::boot_disk structure by a KMessage, which can
more flexibly be extended and deals more gracefully with
arbitrarily-size data. The disk_identifier structure still exists,
though. It is added as message field in cases where needed (non net
boot). Moved the boot_drive_number field of the bios_ia32 platform
specific args into the message.
* Made the stage 1 PXE boot loader superfluous. Moved the relevant
initialization code into the stage 2 loader, which can now be loaded
directly via PXE.
* The PXE boot loader does now download a boot tgz archive via TFTP. It
does no longer use the RemoteDisk protocol (it could actually be
removed from the boot loader). It also parses the DHCP options in the
DHCPACK packet provided by PXE and extracts the root path to be
mounted by the kernel.
* Reorganized the boot volume search in the kernel (vfs_boot.cpp) and
added support for network boot. In this case the net stack is
initialized and the network interface the boot loader used is brought
up and configured. Since NBD and RemoteDisk are our only options for
net boot (and those aren't really configurable dynamically) ATM, the
the boot device is found automatically by the disk device manager.

Booting via PXE does work to some degree now. The most grievous problem
is that loading certain drivers or kernel modules (or related activity)
causes a reboot (likely a triple fault, though one wonders where our
double fault handler is on vacation). Namely the keyboard and mouse input
server add-ons need to be deactivated as well as the media server.
A smaller problem is the net server, which apparently tries to
(re-)configure the network interface we're using to boot, which
obviously doesn't work out that well. So, if all this stuff is disabled
Haiku does fully boot, when using the RemoteDisk protocol (not being
able to use keyboard or mouse doesn't make this a particular fascinating
experience, though ;-)). I had no luck with NBD -- it seemed to have
protocol problems with the servers I tried.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21611 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59d0807e012ad247ffc8dedd8c598a5156b59a9f 19-Dec-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Missing newline in output.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15586 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5af32e752606778be5dd7379f319fe43cb3f6b8c 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed src/kernel to src/system.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12359 a95241bf-73f2-0310-859d-f6bbb57e9c96