History log of /haiku/src/system/boot/loader/partitions.cpp
Revision Date Author Comments
# a526bddb 16-Jan-2019 Augustin Cavalier <waddlesplash@gmail.com>

bootloader: Add missing NULL check.


# 1fef0f0f 16-Jan-2019 Augustin Cavalier <waddlesplash@gmail.com>

bootloader: Use the already-detected filesystem module...

...rather than enumerating again. Solves a TODO (all filesystems
save tarfs and packagefs, which require special parameters and
of course will not be on standard "partitions", have implemented
the required function.)


# 495efc38 06-Dec-2013 François Revol <revol@free.fr>

loader: Drop the HashMap for partition lookup by id

The HashMap constructor was called before the heap is initialized,
ending up calling malloc from the OpenHashMap constructor.

Oddly it was still working on x86 but broke other platforms.

Instead we add a Lookup() static method to Partition,
which by default walks gPartitions for the id,
and recursively calls itself on the children lists.

This means we must add a partition even temporarily to gPartitions
before Scan()ing it though.

Signed-off-by: François Revol <revol@free.fr>


# 211483cb 14-Apr-2016 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

EFI: Initial test EFI application

* Only set HAIKU_BOOT_PLATFORM to bios_ia32 if not defined
* Add gnuefi build feature
* Introduce BOOT_LDFLAGS, and move options for passing to linker
into ArchitectureSetup
* x86_64 compile fixes for warnings in boot loader
* loader/elf.cpp: don't include ELF32 support when targeting EFI
* relocation_func.cpp: copy of the relocation code from gnuefi
to make _relocate extern "C", and avoid including <efilib.h>
* boot_loader_efi.ld: copy of gnuefi's elf_x86_64_efi.lds,
modified to include support for C++ constructors, etc. Keep in
sync with the gnuefi package

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>


# 20e11028 08-Sep-2013 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Don't use partition pointer as id, as it only works on 32bit platforms.

Use a counter to generate the partition id, and store the id to partition
lookup in a hashmap instead.


# 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.


# 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.


# 085cf27b 16-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added Directory::CreateFile() which can be implemented by file systems to
support file creation.
* Extended open() and open_from() to support O_CREAT to create files.
open_from() has got an optional "permissions" parameter for that purpose.
* Fixed errno. It would crash when being used. Also changed the POSIX functions
to return their error code via errno as expected.
* Added writev().
* FAT file system:
- Added support for reading long file names.
- Added support for creating files (8.3 name only) and writing to them.
- Enabled scanning partitions with it.
* Boot loader menu:
- Enabled the "Reboot" menu item unconditionally.
- Added "Save syslog from previous session" menu item to the debug menu.
Currently saving the syslog to FAT32 volumes is supported.


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


# f335531b 04-Aug-2009 François Revol <revol@free.fr>

Remove file map disk support by default, it's not used anyway, and we'll use layers for CD anyway. Doesn't spare that many bytes though...


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


# 1cc5e469 08-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added offset and size parameters to create_child_partition() and
KPartition::CreateChild(). CreateChild() calls AddChild(), which publishes
the new partition, though at that point offset and size were not set, so that
the published devices would not be usable.


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


# 9da23568 01-Nov-2008 François Revol <revol@free.fr>

Work in progress to pass the image extents to the kernel,
- code is disabled yet as the bootloader doesn't have add_boot_item.. will need to pass via kernel args
- add a GetFileMap() method to the vfs, and implement it in FAT code.


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


# 2a1a5a29 20-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Turned off debug output of the FileMapDisk stuff.
* Minor cleanup.


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


# 2a145810 16-Aug-2008 François Revol <revol@free.fr>

Avoid mounting images inside images (inside images (inside images...)).


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


# 6a591903 13-Aug-2008 François Revol <revol@free.fr>

This makes the FileMapDisk code work. zbeos can now locate an haiku.image embedded within another one as BEOS/IMAGE.BE (that's just for testing, it will be used with FAT or ISO9660 later on). It starts to boot the kernel but crashes later, it will need an fmap driver anyway.


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


# 2157e06c 27-Dec-2007 Axel Dörfler <axeld@pinc-software.de>

* Moved code to remove the parent to the Partition destructor - this should fix
the problem that the parent partition was still referenced in some cases.
* Minor cleanup.


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


# 88212335 26-Dec-2007 Marcus Overhagen <marcusoverhagen@gmail.com>

Added more debugging code. The partition code appears to be using objects that have been destroyed.


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


# 67486592 04-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Added an identify_file_system() hook to the FS modules. The boot loader
does no longer give partitioning systems precedence over file systems.
The one with the greater identification priority wins. ATM, if a file
system wins, we still mount the first file system that recognized the
partition at all, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22446 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


# eef8417e 30-Jun-2007 Axel Dörfler <axeld@pinc-software.de>

* Added (non-working) EFI module to the boot loader and its test application.
* Fixed a warning in efi_gpt.cpp.


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


# 8d9e5a45 29-Sep-2006 Axel Dörfler <axeld@pinc-software.de>

* Turned on debugging in the Intel partitioning system add-on, and the partition
stuff of the boot loader to help with bug #238.
* Minor cleanup (added license headers, fixed debug output)


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


# 5ea23bb0 14-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Removed platform_boot_device_is_image() again; it's now replaced by a field
"booted_from_image" in the kernel_args' boot_disk structure.
Also, added fields "cd" and "user_selected".
A CHOICE_MENU menu can now have a choice text - this is automatically updated
as entries in the menu get selected.
The boot volume menu now has the initial choice text "CD-ROM or hard drive"
in case the boot loader was loaded from an image. The "Rescan volumes" item
is no longer selected by default (only if there was no boot volume found) - but
it's still functionless anyway.
The TAR fs will now appear as "Boot from CD-ROM" in the boot volume menu.


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


# e3fcb58e 14-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

The boot loader now has special support for being booted from a boot image
like floppy or CD boot.
This allows it to reduce the number of scans needed to identify the boot
partition - when booted from a real floppy, this speeds up the boot
process by a magnitude.
Also, the loader now has a fall back in case there were no "boot" links
on the disk - the current boot floppy script doesn't create them.
With these changes, I was able to boot into a HD based Haiku installation
from a floppy disk. It's not yet enough to boot from CD (as the boot
device selection is a bit too simplistic right now), but it will eventually
come next. Testing is a lot slower here, though, as neither qemu nor
Bochs support multi-session CDs (at least I have no idea how to get them
to do this).


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


# 85a53ea2 10-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

The boot loader now has tarfs support needed for booting from CD-ROM.
It expects the zipped TAR at offset 192 kB on the boot image.
This work was mostly done by Ingo during BeGeistert.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14343 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


# 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.


# 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.


# 085cf27b40c06dc45f633f33c41258f32bec3a23 16-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added Directory::CreateFile() which can be implemented by file systems to
support file creation.
* Extended open() and open_from() to support O_CREAT to create files.
open_from() has got an optional "permissions" parameter for that purpose.
* Fixed errno. It would crash when being used. Also changed the POSIX functions
to return their error code via errno as expected.
* Added writev().
* FAT file system:
- Added support for reading long file names.
- Added support for creating files (8.3 name only) and writing to them.
- Enabled scanning partitions with it.
* Boot loader menu:
- Enabled the "Reboot" menu item unconditionally.
- Added "Save syslog from previous session" menu item to the debug menu.
Currently saving the syslog to FAT32 volumes is supported.


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


# f335531bbc3e489df4eb1c085da3cf7426af0a1f 04-Aug-2009 François Revol <revol@free.fr>

Remove file map disk support by default, it's not used anyway, and we'll use layers for CD anyway. Doesn't spare that many bytes though...


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


# 1cc5e46925a7e64708d7565fe2c1ac3f448c9d58 08-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added offset and size parameters to create_child_partition() and
KPartition::CreateChild(). CreateChild() calls AddChild(), which publishes
the new partition, though at that point offset and size were not set, so that
the published devices would not be usable.


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


# 9da2356857a48ac7e27b325ba3f69aef9b79dddd 01-Nov-2008 François Revol <revol@free.fr>

Work in progress to pass the image extents to the kernel,
- code is disabled yet as the bootloader doesn't have add_boot_item.. will need to pass via kernel args
- add a GetFileMap() method to the vfs, and implement it in FAT code.


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


# 2a1a5a296f0f0b8f6de4ecd009b59e847867cae3 20-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Turned off debug output of the FileMapDisk stuff.
* Minor cleanup.


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


# 2a1458104dffea1397f45eabd7759da7933e2e16 16-Aug-2008 François Revol <revol@free.fr>

Avoid mounting images inside images (inside images (inside images...)).


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


# 6a5919034d734f7ba9a937d21c6d652dae20cd9c 13-Aug-2008 François Revol <revol@free.fr>

This makes the FileMapDisk code work. zbeos can now locate an haiku.image embedded within another one as BEOS/IMAGE.BE (that's just for testing, it will be used with FAT or ISO9660 later on). It starts to boot the kernel but crashes later, it will need an fmap driver anyway.


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


# 2157e06c6325f15097aeb225948a79049366b5fe 27-Dec-2007 Axel Dörfler <axeld@pinc-software.de>

* Moved code to remove the parent to the Partition destructor - this should fix
the problem that the parent partition was still referenced in some cases.
* Minor cleanup.


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


# 882123356b4727ee42f569a7d2bf42fe6fad962c 26-Dec-2007 Marcus Overhagen <marcusoverhagen@gmail.com>

Added more debugging code. The partition code appears to be using objects that have been destroyed.


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


# 6748659272e95419925e7c7b84d7f98b48182075 04-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Added an identify_file_system() hook to the FS modules. The boot loader
does no longer give partitioning systems precedence over file systems.
The one with the greater identification priority wins. ATM, if a file
system wins, we still mount the first file system that recognized the
partition at all, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22446 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


# eef8417e272495ca9e026a9298167ed4180a1edb 30-Jun-2007 Axel Dörfler <axeld@pinc-software.de>

* Added (non-working) EFI module to the boot loader and its test application.
* Fixed a warning in efi_gpt.cpp.


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


# 8d9e5a451e2fb58549aba969c921614bb15d2607 29-Sep-2006 Axel Dörfler <axeld@pinc-software.de>

* Turned on debugging in the Intel partitioning system add-on, and the partition
stuff of the boot loader to help with bug #238.
* Minor cleanup (added license headers, fixed debug output)


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


# 5ea23bb0a3c0abdd8494122942c1327e5734d959 14-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Removed platform_boot_device_is_image() again; it's now replaced by a field
"booted_from_image" in the kernel_args' boot_disk structure.
Also, added fields "cd" and "user_selected".
A CHOICE_MENU menu can now have a choice text - this is automatically updated
as entries in the menu get selected.
The boot volume menu now has the initial choice text "CD-ROM or hard drive"
in case the boot loader was loaded from an image. The "Rescan volumes" item
is no longer selected by default (only if there was no boot volume found) - but
it's still functionless anyway.
The TAR fs will now appear as "Boot from CD-ROM" in the boot volume menu.


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


# e3fcb58ebb7497340ed016d1a5ac4d4f13564d90 14-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

The boot loader now has special support for being booted from a boot image
like floppy or CD boot.
This allows it to reduce the number of scans needed to identify the boot
partition - when booted from a real floppy, this speeds up the boot
process by a magnitude.
Also, the loader now has a fall back in case there were no "boot" links
on the disk - the current boot floppy script doesn't create them.
With these changes, I was able to boot into a HD based Haiku installation
from a floppy disk. It's not yet enough to boot from CD (as the boot
device selection is a bit too simplistic right now), but it will eventually
come next. Testing is a lot slower here, though, as neither qemu nor
Bochs support multi-session CDs (at least I have no idea how to get them
to do this).


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


# 85a53ea28069a930c55299069fc9d893eb2da532 10-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

The boot loader now has tarfs support needed for booting from CD-ROM.
It expects the zipped TAR at offset 192 kB on the boot image.
This work was mostly done by Ingo during BeGeistert.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14343 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