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
This commit is contained in:
Axel Dörfler
2005-10-14 21:22:19 +00:00
parent 0703480cab
commit 5ea23bb0a3
7 changed files with 34 additions and 9 deletions
@@ -47,6 +47,9 @@ typedef struct kernel_args {
struct { struct {
disk_identifier identifier; disk_identifier identifier;
off_t partition_offset; off_t partition_offset;
bool user_selected;
bool booted_from_image;
bool cd;
} boot_disk; } boot_disk;
struct driver_settings_file *driver_settings; struct driver_settings_file *driver_settings;
+4
View File
@@ -108,6 +108,9 @@ class Menu {
const char *Title() const { return fTitle; } const char *Title() const { return fTitle; }
void SetChoiceText(const char *text) { fChoiceText = text; }
const char *ChoiceText() const { return fChoiceText; }
void Run(); void Run();
private: private:
@@ -115,6 +118,7 @@ class Menu {
void Draw(MenuItem *item); void Draw(MenuItem *item);
const char *fTitle; const char *fTitle;
const char *fChoiceText;
int32 fCount; int32 fCount;
bool fIsHidden; bool fIsHidden;
MenuItemList fItems; MenuItemList fItems;
-1
View File
@@ -58,7 +58,6 @@ extern status_t platform_add_block_devices(struct stage2_args *args, NodeList *d
extern status_t platform_get_boot_partition(struct stage2_args *args, Node *bootDevice, extern status_t platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
NodeList *partitions, boot::Partition **_partition); NodeList *partitions, boot::Partition **_partition);
extern status_t platform_register_boot_device(Node *device); extern status_t platform_register_boot_device(Node *device);
extern bool platform_boot_device_is_image();
/* menu functions */ /* menu functions */
@@ -484,7 +484,7 @@ TarFS::Directory::Inode() const
TarFS::Volume::Volume() TarFS::Volume::Volume()
: TarFS::Directory("CD/Floppy Boot Disk") : TarFS::Directory("Boot from CD-ROM")
{ {
} }
+1 -1
View File
@@ -187,7 +187,7 @@ load_modules(stage2_args *args, Directory *volume)
// and now load all partitioning and file system modules // and now load all partitioning and file system modules
// needed to identify the boot volume // needed to identify the boot volume
if (!platform_boot_device_is_image()) { if (!gKernelArgs.boot_disk.booted_from_image) {
// iterate over the mounted volumes and load their file system // iterate over the mounted volumes and load their file system
Partition *partition; Partition *partition;
if (gRoot->GetPartitionFor(volume, &partition) == B_OK) { if (gRoot->GetPartitionFor(volume, &partition) == B_OK) {
+22 -4
View File
@@ -76,12 +76,24 @@ MenuItem::SetMarked(bool marked)
} }
void MenuItem::Select(bool selected) { if (fIsSelected == selected) return; void
MenuItem::Select(bool selected)
{
if (selected && fMenu != NULL) {
// always set choice text of parent if we were selected
if (fMenu->Type() == CHOICE_MENU && Type() != MENU_ITEM_NO_CHOICE)
fMenu->SetChoiceText(Label());
}
if (fIsSelected == selected)
return;
if (selected && fMenu != NULL) { if (selected && fMenu != NULL) {
// unselect previous item // unselect previous item
MenuItem *selectedItem = fMenu->FindSelected(); if (selectedItem != MenuItem *selectedItem = fMenu->FindSelected();
NULL) selectedItem->Select(false); } if (selectedItem != NULL)
selectedItem->Select(false);
}
fIsSelected = selected; fIsSelected = selected;
@@ -144,6 +156,7 @@ MenuItem::SetMenu(Menu *menu)
Menu::Menu(menu_type type, const char *title) Menu::Menu(menu_type type, const char *title)
: :
fTitle(title), fTitle(title),
fChoiceText(NULL),
fCount(0), fCount(0),
fIsHidden(true), fIsHidden(true),
fType(type), fType(type),
@@ -342,6 +355,7 @@ user_menu_boot_volume(Menu *menu, MenuItem *item)
bootItem->Select(true); bootItem->Select(true);
bootItem->SetData(item->Data()); bootItem->SetData(item->Data());
gKernelArgs.boot_disk.user_selected = true;
return true; return true;
} }
@@ -390,11 +404,15 @@ add_boot_volume_menu(Directory *bootVolume)
menu->AddItem(item = new MenuItem("Rescan volumes")); menu->AddItem(item = new MenuItem("Rescan volumes"));
item->SetHelpText("Please insert a Haiku CD-ROM or attach a USB disk - depending on your system, you can then boot from them."); item->SetHelpText("Please insert a Haiku CD-ROM or attach a USB disk - depending on your system, you can then boot from them.");
item->SetType(MENU_ITEM_NO_CHOICE); item->SetType(MENU_ITEM_NO_CHOICE);
item->Select(true); if (count == 0)
item->Select(true);
menu->AddItem(item = new MenuItem("Return to main menu")); menu->AddItem(item = new MenuItem("Return to main menu"));
item->SetType(MENU_ITEM_NO_CHOICE); item->SetType(MENU_ITEM_NO_CHOICE);
if (gKernelArgs.boot_disk.booted_from_image)
menu->SetChoiceText("CD-ROM or hard drive");
return menu; return menu;
} }
+3 -2
View File
@@ -9,6 +9,7 @@
#include <boot/partitions.h> #include <boot/partitions.h>
#include <boot/vfs.h> #include <boot/vfs.h>
#include <boot/platform.h> #include <boot/platform.h>
#include <boot/stage2.h>
#include <boot/stdio.h> #include <boot/stdio.h>
#include <ddm_modules.h> #include <ddm_modules.h>
#include <util/kernel_cpp.h> #include <util/kernel_cpp.h>
@@ -206,7 +207,7 @@ Partition::_Mount(file_system_module_info *module, Directory **_fileSystem)
status_t status_t
Partition::Mount(Directory **_fileSystem, bool isBootDevice) Partition::Mount(Directory **_fileSystem, bool isBootDevice)
{ {
if (isBootDevice && platform_boot_device_is_image()) if (isBootDevice && gKernelArgs.boot_disk.booted_from_image)
return _Mount(&gTarFileSystemModule, _fileSystem); return _Mount(&gTarFileSystemModule, _fileSystem);
for (int32 i = 0; i < sNumFileSystemModules; i++) { for (int32 i = 0; i < sNumFileSystemModules; i++) {
@@ -229,7 +230,7 @@ Partition::Scan(bool mountFileSystems, bool isBootDevice)
// if we were not booted from the real boot device, we won't scan // if we were not booted from the real boot device, we won't scan
// the device we were booted from (which is likely to be a slow // the device we were booted from (which is likely to be a slow
// floppy or CD) // floppy or CD)
if (isBootDevice && platform_boot_device_is_image()) if (isBootDevice && gKernelArgs.boot_disk.booted_from_image)
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
const partition_module_info *bestModule = NULL; const partition_module_info *bestModule = NULL;