Skip to content

Commit

Permalink
Version string now stored in /openiboot.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neonkoala authored and Neonkoala committed Nov 6, 2010
1 parent 64c5646 commit b192eb6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
25 changes: 21 additions & 4 deletions openiboot/images.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "aes.h"
#include "sha1.h"
#include "nvram.h"
#include "hfs/fs.h"
#include "hfs/bdev.h"
#include "ftl.h"

static const uint32_t NOREnd = 0xFC000;

Expand Down Expand Up @@ -541,14 +544,28 @@ void images_install(void* newData, size_t newDataLen) {
images_setup();

bufferPrintf("Configuring openiBoot settings...\r\n");
nvram_setvar("opib-version", "0.1.2");

if(!nvram_getvar("opib-temp-os")) {
Volume* volume;
io_func* io;

io = bdev_open(0);
volume = openVolume(io);

char buffer [sizeof(XSTRINGIFY(OPENIBOOT_VERSION))];
strcpy(buffer, XSTRINGIFY(OPENIBOOT_VERSION));
add_hfs(volume, (uint8_t*)buffer, sizeof(buffer), "/openiboot");

closeVolume(volume);
CLOSE(io);

ftl_sync();

if(!nvram_getvar("opib-temp-os")) {
nvram_setvar("opib-temp-os", "0");
}

if(!nvram_getvar("opib-default-os")) {
nvram_setvar("opib-default-os", "0");
if(!nvram_getvar("opib-default-os")) {
nvram_setvar("opib-default-os", "1");
}

if(!nvram_getvar("opib-menu-timeout")) {
Expand Down
1 change: 1 addition & 0 deletions openiboot/includes/hfs/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extern int HasFSInit;
uint32_t readHFSFile(HFSPlusCatalogFile* file, uint8_t** buffer, Volume* volume);

int fs_setup();
int add_hfs(Volume* volume, uint8_t* buffer, size_t size, const char* outFileName);
ExtentList* fs_get_extents(int partition, const char* fileName);
void fs_cmd_ls(int argc, char** argv);
void fs_cmd_cat(int argc, char** argv);
Expand Down

0 comments on commit b192eb6

Please sign in to comment.