Skip to content

Commit 79f87e2

Browse files
committed
vmbuild: update default bootloader location
1 parent 7cade87 commit 79f87e2

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

vmbuild/vmbuild.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#define SECT_SIZE_ERR 666
3737
#define DISK_SIZE_ERR 999
3838

39-
bool verb = true;
39+
bool verb = false;
4040

4141
#define INFO_(FROM, TEXT, ...) if (verb) fprintf(stderr, "%13s ] " TEXT "\n", "[ " FROM, ##__VA_ARGS__)
4242
#define INFO(X,...) INFO_("Vmbuild", X, ##__VA_ARGS__)
@@ -65,12 +65,18 @@ string get_bootloader_path(int argc, char** argv) {
6565
if (argc == 2) {
6666
// Determine IncludeOS install location from environment, or set to default
6767
std::string includeos_install;
68-
if (auto env_install = getenv("INCLUDEOS_INSTALL")) {
69-
includeos_install = env_install;
68+
std::string arch = "x86_64";
69+
auto env_arch = getenv("ARCH");
70+
71+
if (env_arch)
72+
arch = std::string(env_arch);
73+
74+
if (auto env_install = getenv("INCLUDEOS_PREFIX")) {
75+
includeos_install = std::string{env_install} + "/includeos/" + arch;
7076
} else {
7177
includeos_install = std::string{getenv("HOME")} + "/IncludeOS_install";
7278
}
73-
return includeos_install + "/bootloader";
79+
return includeos_install + "/boot/bootloader";
7480
} else {
7581
return argv[2];
7682
}
@@ -79,7 +85,7 @@ string get_bootloader_path(int argc, char** argv) {
7985
int main(int argc, char** argv)
8086
{
8187
// Verify proper command usage
82-
if (argc <= 2) {
88+
if (argc < 2) {
8389
cout << info << usage;
8490
exit(EXIT_FAILURE);
8591
}
@@ -91,11 +97,11 @@ int main(int argc, char** argv)
9197

9298
const string bootloader_path = get_bootloader_path(argc, argv);
9399

94-
INFO("Using bootloader %s" , bootloader_path.c_str());
95-
96100
if (argc > 2)
97101
const string bootloader_path {argv[2]};
98102

103+
INFO("Using bootloader %s" , bootloader_path.c_str());
104+
99105
const string elf_binary_path {argv[1]};
100106
const string img_name {elf_binary_path.substr(elf_binary_path.find_last_of("/") + 1, string::npos) + ".img"};
101107

0 commit comments

Comments
 (0)