History log of /haiku/src/system/boot/loader/file_systems/tarfs/tarfs.cpp
Revision Date Author Comments
# c2066ed1 04-May-2022 Anarchos <sylvain_kerjean@hotmail.com>

Fix PXE boot

-tar fs buffer upgraded to 9Mb
-adding some kernel addons

With this settings i was able to fully boot a gcc2hybrid.
The x86_64 started up to the rocket, but could'nt go into Tracker.

Change-Id: I8f9e1f803f4a918419305bce3068ffce027d2548
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5295
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 6711cd9e 30-Dec-2020 PulkoMandy <pulkomandy@pulkomandy.tk>

bootloader: reduce stack usage

On Sparc Openboot, we get allocated a stack of only 8 kilobytes, and
each called function costs at least 176 bytes for the stack frame.

This means we need to be more careful than usual about stack usage. Move
some large-ish allocations off the stack by either making them static,
or allocated dynamically.

Add a compiler flag to error on functions which use too much stack. The
threshold is at 1023 bytes, because that's what allowed me to find the
two functions that were causing a stack overflow (open_from and
_ParseActivatedPackagesFile)

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


# 6467297a 04-Dec-2020 X512 <danger_mail@list.ru>

simplify AutoDeleter code by using typedef

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


# b49dd60c 07-Nov-2015 Jérôme Duval <jerome.duval@gmail.com>

Drop namespace std after 95d4ed6778c138150a29.


# 95d4ed67 07-Nov-2015 Jonathan Schleifer <js@webkeks.org>

Add missing "using std::nothrow"


# 6879e9df 28-Oct-2014 PulkoMandy <pulkomandy@pulkomandy.tk>

Tarfs: fix traces


# 3465e718 12-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

boot tarfs: Support resolving "." and ".." directory entries

This makes resolving the boot module symlinks work.


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


# 9b74cc66 04-Nov-2011 François Revol <revol@free.fr>

Further reduced the region allocated for the uncompressed data to 8 MB.
Wastes a bit less time allocating pages for nothing, and makes debugging
mmu support less verbose as well.
The (gunzipped) tar file is still less than 4MB and will never be 8MB
realistically anyway.


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


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

Add boot loader packagefs support

* Add pread().
* Add Node::ReadLink() to read a symbolic link path.
* Add Directory::LookupDontTraverse() and make Lookup() non-abstract.
Lookup() is implemented via LookupDontTraverse() and Node::ReadLink().
* Adjust all FS implementations accordingly.
* Add a packagefs implementation. Unlike other FS implementations it
isn't a pseudo-module, but provides a function to explicitly mount a
package file (packagefs_mount_file()).
* Finish BootVolume::SetTo() implementation, mounting the package file
and replacing fSystemDirectory.

Now the boot loader can load the kernel and boot modules from a packaged
system. The kernel boots up to the point where the boot volume is
mounted.


# 30f4c392 12-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Cleanup.


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


# e5ea3d8c 28-Apr-2009 François Revol <revol@free.fr>

Print the zlib-provided message in case of error.


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


# 9b7603b9 19-Jan-2009 François Revol <revol@free.fr>

This should definitely fix CD booting, it was still looking for the tgz at 192k while zbeos is now almost 300k... Maybe we need something more failproof but it shoudl do for now.


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


# 0dc4d1e5 26-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Reverted r27685, r27676, r27665, and r27664, the changes related to
letting the boot loader provide full paths for the pre-loaded images.


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


# 6aa2c9ec 20-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Directory stores its parent directory (if any), now.
* Adjusted used files systems accordingly.
* BFS::Stream::GetName() was broken. It accessed the small data region
which wasn't loaded, since BFS::Stream derived from bfs_inode, which
is a variably-sized structure with the small data region at the end.
Changed that to a ref-counted, shared member instead.
* Implemented RootFileSystem::GetName().
* Added Directory::GetPath() to get a full path of the directory or an
entry.


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


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

* Reduced the region allocated for the uncompressed data to 16 MB. With
32 MB the kernel's VM initialization code would run into trouble.
Accessing freshly mapped memory in the generic page mapper would
result in a page fault. To be investigated.
* Apparently in the boot loader the file systems are responsible for
resolving symbolic links (instead of the VFS). We do that now.


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


# dcb3c6c3 06-Jul-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for symlinks.
* Prepared for other uses than just boot floppies (/CDs). We first try to
inflate the contents of the given device at offset 0 before using the
floppy disk offset. This will make it easy to mount tgz files loaded via
network or built into the boot loader itself.
* Increased the max possible size of inflated data to 32 MB.


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


# d0d30c36 12-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

The length of the extra field was not correctly determined, and the
offset was not changed correctly either: the order in which the
expression was evaluated was undefined; in fact, GCC 2.95.3 would use
the same buffer[index] twice.


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


# 82029bda 16-Sep-2006 Marcus Overhagen <marcusoverhagen@gmail.com>

added missing nothrow parameter


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


# c83d9dad 28-Dec-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* platform_allocate_region() has a new boolean parameter "exactAddress"
specifying whether only the exact supplied address is acceptable. If
false, the address is considered a hint only. It will be picked, if
available, otherwise a greater address is tried to be acquired, and
as last resort any address. This feature is only implemented for PPC.
It is needed since the preferred kernel text base address 0x80000000
might not be available (and actually isn't on my Mac mini).
* Fixed a bug in the PPC memory management code:
is_{virtual,physical}_allocated() were checking whether the given
range was completely contained by an existing range instead of
checking for intersection. As a consequence we could (and did) allocate
a range intersecting with already allocated ranges. The kernel segment
thus overwrote OF memory for instance.
* The ELF loader makes sure that it got both text and data segment of
the image to be loaded.

The PPC boot loader successfully loads kernel and modules now. Next
comes the hard part, I'm afraid.



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


# 94caf40a 17-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Enlarged the buffer size to the standard CD block size - this greatly speeds up
the boot process. Will experiment with larger sizes later (24k is the current
limit, due to the memory layout used by the platform dependent code).


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


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

tarfs is now maintaining a node ID and got all methods that its entries are statable.
Renamed TarFS::Node to TarFS::File to correctly name the class hierarchy.


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


# 0ecc530b 13-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

TAR fs is now also working correctly in the real boot loader.
Some more cleanup and better error output.


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


# 6879e9df771aedcbb13b61e542076777fe1edc3f 28-Oct-2014 PulkoMandy <pulkomandy@pulkomandy.tk>

Tarfs: fix traces


# 3465e718e75b0bf46fb4c060229645d75aa862b9 12-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

boot tarfs: Support resolving "." and ".." directory entries

This makes resolving the boot module symlinks work.


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


# 9b74cc663747ea962a5087fd009dbbcd1f29fb3c 04-Nov-2011 François Revol <revol@free.fr>

Further reduced the region allocated for the uncompressed data to 8 MB.
Wastes a bit less time allocating pages for nothing, and makes debugging
mmu support less verbose as well.
The (gunzipped) tar file is still less than 4MB and will never be 8MB
realistically anyway.


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


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

Add boot loader packagefs support

* Add pread().
* Add Node::ReadLink() to read a symbolic link path.
* Add Directory::LookupDontTraverse() and make Lookup() non-abstract.
Lookup() is implemented via LookupDontTraverse() and Node::ReadLink().
* Adjust all FS implementations accordingly.
* Add a packagefs implementation. Unlike other FS implementations it
isn't a pseudo-module, but provides a function to explicitly mount a
package file (packagefs_mount_file()).
* Finish BootVolume::SetTo() implementation, mounting the package file
and replacing fSystemDirectory.

Now the boot loader can load the kernel and boot modules from a packaged
system. The kernel boots up to the point where the boot volume is
mounted.


# 30f4c392a4236fd84958293eadc00ca1272eb23f 12-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Cleanup.


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


# e5ea3d8c41235a687cbd9b89f0ab5858b1421966 28-Apr-2009 François Revol <revol@free.fr>

Print the zlib-provided message in case of error.


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


# 9b7603b992e41b7e4f239b14d5af0eb02aaae634 19-Jan-2009 François Revol <revol@free.fr>

This should definitely fix CD booting, it was still looking for the tgz at 192k while zbeos is now almost 300k... Maybe we need something more failproof but it shoudl do for now.


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


# 0dc4d1e5ca08e5fe65c04f40f2628c29a9f4b5e0 26-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Reverted r27685, r27676, r27665, and r27664, the changes related to
letting the boot loader provide full paths for the pre-loaded images.


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


# 6aa2c9ecf151dae2111df60a737ceb266fd18002 20-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Directory stores its parent directory (if any), now.
* Adjusted used files systems accordingly.
* BFS::Stream::GetName() was broken. It accessed the small data region
which wasn't loaded, since BFS::Stream derived from bfs_inode, which
is a variably-sized structure with the small data region at the end.
Changed that to a ref-counted, shared member instead.
* Implemented RootFileSystem::GetName().
* Added Directory::GetPath() to get a full path of the directory or an
entry.


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


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

* Reduced the region allocated for the uncompressed data to 16 MB. With
32 MB the kernel's VM initialization code would run into trouble.
Accessing freshly mapped memory in the generic page mapper would
result in a page fault. To be investigated.
* Apparently in the boot loader the file systems are responsible for
resolving symbolic links (instead of the VFS). We do that now.


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


# dcb3c6c3217d315367e2ee3c973bb43ebab2ffcf 06-Jul-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for symlinks.
* Prepared for other uses than just boot floppies (/CDs). We first try to
inflate the contents of the given device at offset 0 before using the
floppy disk offset. This will make it easy to mount tgz files loaded via
network or built into the boot loader itself.
* Increased the max possible size of inflated data to 32 MB.


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


# d0d30c36cadbb971034a78d2eacf1d360b0933bc 12-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

The length of the extra field was not correctly determined, and the
offset was not changed correctly either: the order in which the
expression was evaluated was undefined; in fact, GCC 2.95.3 would use
the same buffer[index] twice.


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


# 82029bdae870b0e257a54929116ddfb6da9efdca 16-Sep-2006 Marcus Overhagen <marcusoverhagen@gmail.com>

added missing nothrow parameter


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


# c83d9dad1c3cb1b0910f5db8c3f4645d3a206171 28-Dec-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* platform_allocate_region() has a new boolean parameter "exactAddress"
specifying whether only the exact supplied address is acceptable. If
false, the address is considered a hint only. It will be picked, if
available, otherwise a greater address is tried to be acquired, and
as last resort any address. This feature is only implemented for PPC.
It is needed since the preferred kernel text base address 0x80000000
might not be available (and actually isn't on my Mac mini).
* Fixed a bug in the PPC memory management code:
is_{virtual,physical}_allocated() were checking whether the given
range was completely contained by an existing range instead of
checking for intersection. As a consequence we could (and did) allocate
a range intersecting with already allocated ranges. The kernel segment
thus overwrote OF memory for instance.
* The ELF loader makes sure that it got both text and data segment of
the image to be loaded.

The PPC boot loader successfully loads kernel and modules now. Next
comes the hard part, I'm afraid.



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


# 94caf40a8ee70ee69a7da4820319186fdf7af59f 17-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Enlarged the buffer size to the standard CD block size - this greatly speeds up
the boot process. Will experiment with larger sizes later (24k is the current
limit, due to the memory layout used by the platform dependent code).


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


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

tarfs is now maintaining a node ID and got all methods that its entries are statable.
Renamed TarFS::Node to TarFS::File to correctly name the class hierarchy.


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


# 0ecc530bf0d2a48fc83af60844955a5f63588a70 13-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

TAR fs is now also working correctly in the real boot loader.
Some more cleanup and better error output.


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