OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Defines the BootloaderType class. This class wraps the kernel commandline | 5 // Defines the BootloaderType class. This class wraps the kernel commandline |
6 // to determine the bootloader type. Our bootloaders are configured to boot | 6 // to determine the bootloader type. Our bootloaders are configured to boot |
7 // with identifying kernel command lines: | 7 // with identifying kernel command lines: |
8 // - EFI uses cros_efi | 8 // - EFI uses cros_efi |
9 // - Legacy uses cros_legacy | 9 // - Legacy uses cros_legacy |
10 // - Chrome OS uses cros_secure | 10 // - Chrome OS uses cros_secure |
11 // - A debug override can use cros_debug. | 11 // - A debug override can use cros_debug. |
12 // This done by walking /proc/cmdline. | 12 // This done by walking /proc/cmdline. |
13 // | 13 // |
14 #ifndef CROS_BOOT_MODE_BOOTLOADER_TYPE_H_ | 14 #ifndef CROS_BOOT_MODE_BOOTLOADER_TYPE_H_ |
15 #define CROS_BOOT_MODE_BOOTLOADER_TYPE_H_ | 15 #define CROS_BOOT_MODE_BOOTLOADER_TYPE_H_ |
16 | 16 |
17 #include <sys/types.h> | 17 #include <sys/types.h> |
18 | 18 |
19 #include "platform_reader.h" | 19 #include "platform_reader.h" |
20 | 20 |
21 namespace cros_boot_mode { | 21 namespace cros_boot_mode { |
22 | 22 |
23 class BootloaderType : public PlatformReader { | 23 class BootloaderType : public PlatformReader { |
24 public: | 24 public: |
25 static const char *kBootloaderTypePath; | 25 static const char *kBootloaderTypePath; |
26 enum { | 26 enum { |
27 kChromeOS = 0, | 27 kDebug = 0, |
| 28 kChromeOS, |
28 kEFI, | 29 kEFI, |
29 kLegacy, | 30 kLegacy, |
30 kDebug, | |
31 }; | 31 }; |
32 // API-exposed names | 32 // API-exposed names |
33 static const char *kBootloaderTypeText[]; | 33 static const char *kBootloaderTypeText[]; |
34 static const size_t kBootloaderTypeCount; | 34 static const size_t kBootloaderTypeCount; |
35 // Maximum allowed /proc/cmdline size. | 35 // Maximum allowed /proc/cmdline size. |
36 static const int kMaxKernelCmdlineSize; | 36 static const int kMaxKernelCmdlineSize; |
37 // Functional names found in /proc/cmdline. | 37 // Functional names found in /proc/cmdline. |
38 static const char *kSupportedBootloaders[]; | 38 static const char *kSupportedBootloaders[]; |
39 | 39 |
40 | 40 |
(...skipping 14 matching lines...) Expand all Loading... |
55 virtual const char *default_platform_file_path() const { | 55 virtual const char *default_platform_file_path() const { |
56 return "/proc/cmdline"; | 56 return "/proc/cmdline"; |
57 } | 57 } |
58 virtual size_t max_size() const { | 58 virtual size_t max_size() const { |
59 return kMaxKernelCmdlineSize; | 59 return kMaxKernelCmdlineSize; |
60 } | 60 } |
61 }; | 61 }; |
62 | 62 |
63 } // namespace cros_boot_mode | 63 } // namespace cros_boot_mode |
64 #endif // CROS_BOOT_MODE_BOOTLOADER_TYPE_H_ | 64 #endif // CROS_BOOT_MODE_BOOTLOADER_TYPE_H_ |
OLD | NEW |