[haiku-commits] r40911 - in haiku/branches/features/package-management: headers/private/libroot src/system/boot/loader

  • From: zooey@xxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 11 Mar 2011 09:50:39 +0100 (CET)

Author: zooey
Date: 2011-03-11 09:50:39 +0100 (Fri, 11 Mar 2011)
New Revision: 40911
Changeset: http://dev.haiku-os.org/changeset/40911

Modified:
   
haiku/branches/features/package-management/headers/private/libroot/directories.h
   haiku/branches/features/package-management/src/system/boot/loader/loader.cpp
Log:
adjust haiku_loader to use constants for directory names:
* added volume-local paths to kernel add-ons to directories.h
* replaced strings with directory name defines
* clarified intention of 'failed' in load_modules(), which fixes the
  panic we ran into before with more than two paths active


Modified: 
haiku/branches/features/package-management/headers/private/libroot/directories.h
===================================================================
--- 
haiku/branches/features/package-management/headers/private/libroot/directories.h
    2011-03-10 22:32:12 UTC (rev 40910)
+++ 
haiku/branches/features/package-management/headers/private/libroot/directories.h
    2011-03-11 08:50:39 UTC (rev 40911)
@@ -19,6 +19,14 @@
 #define kAppLocalAddonsDirectory               "%A/add-ons"
 #define kAppLocalLibDirectory                  "%A/lib"
 
+#define kVolumeLocalSystemKernelAddonsDirectory        "system/add-ons/kernel"
+#define kVolumeLocalCommonNonpackagedKernelAddonsDirectory     \
+       "common/non-packaged/add-ons/kernel"
+#define kVolumeLocalCommonKernelAddonsDirectory        "common/add-ons/kernel"
+#define kVolumeLocalUserNonpackagedKernelAddonsDirectory       \
+       "home/config/non-packaged/add-ons/kernel"
+#define kVolumeLocalUserKernelAddonsDirectory  "home/config/add-ons/kernel"
+
 #define kSystemDirectory                               "/boot/system"
 #define kSystemAddonsDirectory                         "/boot/system/add-ons"
 #define kSystemAppsDirectory                   "/boot/system/apps"

Modified: 
haiku/branches/features/package-management/src/system/boot/loader/loader.cpp
===================================================================
--- 
haiku/branches/features/package-management/src/system/boot/loader/loader.cpp    
    2011-03-10 22:32:12 UTC (rev 40910)
+++ 
haiku/branches/features/package-management/src/system/boot/loader/loader.cpp    
    2011-03-11 08:50:39 UTC (rev 40911)
@@ -8,6 +8,7 @@
 #include "elf.h"
 #include "RootFileSystem.h"
 
+#include <directories.h>
 #include <OS.h>
 #include <util/list.h>
 #include <boot/stage2.h>
@@ -27,14 +28,12 @@
 #define KERNEL_PATH            "system/" KERNEL_IMAGE
 
 
-// TODO: activating more than just the two below results in a panic about
-// kernel_args max range being too low ...
 static const char *sPaths[] = {
-       "system/add-ons/kernel",
-//     "common/non-packaged/add-ons/kernel",
-//     "common/add-ons/kernel",
-//     "home/config/non-packaged/add-ons/kernel",
-       "home/config/add-ons/kernel",
+       kVolumeLocalSystemKernelAddonsDirectory,
+       kVolumeLocalCommonNonpackagedKernelAddonsDirectory,
+       kVolumeLocalCommonKernelAddonsDirectory,
+       kVolumeLocalUserNonpackagedKernelAddonsDirectory,
+       kVolumeLocalUserKernelAddonsDirectory,
        NULL
 };
 
@@ -181,7 +180,8 @@
 
        // ToDo: this should be mostly replaced by a hardware oriented 
detection mechanism
 
-       for (int32 i = 0; sPaths[i]; i++) {
+       int32 i = 0;
+       for (; sPaths[i]; i++) {
                char path[B_FILE_NAME_LENGTH];
                snprintf(path, sizeof(path), "%s/boot", sPaths[i]);
 
@@ -189,7 +189,7 @@
                        failed++;
        }
 
-       if (failed > 1) {
+       if (failed == i) {
                // couldn't load any boot modules
                // fall back to load all modules (currently needed by the boot 
floppy)
                const char *paths[] = { "bus_managers", "busses/ide", 
"busses/scsi",


Other related posts:

  • » [haiku-commits] r40911 - in haiku/branches/features/package-management: headers/private/libroot src/system/boot/loader - zooey