app/moboot, lib/bootlinux: experimental ramdisk support

This commit is contained in:
James Sullins committed 2011-11-02 08:37:40 -05:00
1 parent ff838783fd
commit 0be67e1b88
2 files changed
+68 -7

No files matched your search

+51 -2
View File
@@ -252,6 +252,8 @@ void moboot_init(const struct app_descriptor *app)
unsigned xoff, yoff;
unsigned ramdisk_mounted, ramdisk_start, ramdisk_size;
unsigned i, j;
unsigned default_menu_entry = 0;
@@ -271,6 +273,8 @@ void moboot_init(const struct app_descriptor *app)
void *tile_ptr;
char splash_path[256];
ssize_t rdmsgsz;
char *rdmsg;
keys_pressed = 0;
@@ -286,6 +290,24 @@ void moboot_init(const struct app_descriptor *app)
}
#endif
gfxconsole_clear();
gfxconsole_setpos(0,0);
ramdisk_mounted = 0;
atags_get_ramdisk(&ramdisk_start, &ramdisk_size);
if (ramdisk_size && ramdisk_start) {
ramdisk_init(ramdisk_start, ramdisk_size);
if (fs_mount("/ramdisk", "/dev/ramdisk")) {
printf("Ramdisk start=%08x size=%08x\n", ramdisk_start, ramdisk_size);
printf("Unable to mount /ramdisk\n");
printf("Press SELECT to continue\n");
gpiokeys_wait_select();
} else {
ramdisk_mounted = 1;
}
}
if (fs_mount("/boot", "/dev/mmcblk0p13")) {
printf("\nUnable to mount /boot, exiting.\n");
while (1) {
@@ -371,7 +393,35 @@ void moboot_init(const struct app_descriptor *app)
i++;
}
if (rc < 0) {
dprintf(SPEW, "DirList ERROR rc = %d\n", rc);
dprintf(SPEW, "/boot dirList ERROR rc = %d\n", rc);
}
i = 0;
while ((rc = fs_dirent("/ramdisk/boot", i, &ptr)) > 0) {
sprintf(path, "/ramdisk/boot/%s", ptr);
if (strncmp("uImage.", ptr, 7) == 0) {
if (strncmp("uImage.moboot", ptr, 13) != 0) {
newtitle = malloc(strlen(ptr) - 7 + 5 + 1);
sprintf(newtitle, "boot %s", ptr + 7);
newpath = malloc(strlen(ptr) + 14 + 1);
sprintf(newpath, "/ramdisk/boot/%s", ptr);
newname = malloc(strlen(ptr) - 7 + 1);
sprintf(newname, "%s", ptr + 7);
if (strcmp(default_image, ptr + 7) == 0) {
default_menu_entry = num_menu_entries;
}
if (strcmp(next_image, ptr + 7) == 0) {
next_menu_entry = num_menu_entries;
use_next = 1;
}
set_menu_entry(newtitle, BOOT_FS, newpath, newname);
counted_images++;
}
}
free(ptr);
i++;
}
if (rc < 0) {
dprintf(SPEW, "/ramdisk/boot dirList ERROR rc = %d\n", rc);
}
if (counted_images == 0) {
@@ -379,7 +429,6 @@ void moboot_init(const struct app_descriptor *app)
}
if (gpiokeys_poll(KEY_ALL)) {
keys_pressed = 1;
printf("\nPlease release key(s)...");
+17 -5
View File
@@ -34,10 +34,10 @@
#define RAMDISK_ADDR 0x60000000
char root_dev_ram[] = "/dev/ram";
char root_dev_ram[] = "/dev/ram0";
char root_dev_noram[] = "/dev/mmcblk0p13";
char tty_dev_ram[] = "tty1";
char tty_dev_noram[] = "ttyS0,115200n8";
char tty_dev_fbcon[] = "tty1";
char tty_dev_nofbcon[] = "ttyS0,115200n8";
char *root_dev;
char *tty_dev;
@@ -160,9 +160,9 @@ unsigned bootlinux_uimage_mem(void *data, unsigned len, void (*callback)())
}
#if 1
sprintf(cmdline
,"root=%s rootwait ro fbcon=disable console=ttyS0,115200n8 %s%s%s%s%s%s"
, "root=%s rootwait rw logo.nologo fbcon=rotate:3 console=tty1 %s%s%s%s%s%s"
, root_dev
, atags_get_cmdline_arg(passed_atags, "fb")
, atags_get_cmdline_arg(passed_atags, "nduid")
@@ -171,6 +171,18 @@ unsigned bootlinux_uimage_mem(void *data, unsigned len, void (*callback)())
, atags_get_cmdline_arg(passed_atags, "boardtype")
, atags_get_cmdline_arg(passed_atags, "lastboot")
);
#else
sprintf(cmdline
,"root=%s rootwait ro fbcon=disable console=ttyS0,115200n8 testit=1234%s%s%s%s%s%s"
, root_dev
, atags_get_cmdline_arg(passed_atags, "fb")
, atags_get_cmdline_arg(passed_atags, "nduid")
, atags_get_cmdline_arg(passed_atags, "klog")
, atags_get_cmdline_arg(passed_atags, "klog_len")
, atags_get_cmdline_arg(passed_atags, "boardtype")
, atags_get_cmdline_arg(passed_atags, "lastboot")
);
#endif
printf("cmdline='%s'\n", cmdline);