mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-01 10:22:48 +02:00
qi-add-noboot-and-append-check.patch
This adds two features that can be set in the rootfs that Qi is checking. - if it finds /boot/noboot-<device>, eg /boot/noboot-GTA02 then it will skip the rootfs for booting and try the next one if any - if it finds /boot/append-<device>, eg, /boot/append-GTA02 then it will append the contents of this file to the kernel commandline. Signed-off-by: Andy Green <andy@openmoko.com>
This commit is contained in:
parent
3565397f1c
commit
1b06d98bc7
@ -74,6 +74,8 @@ struct board_api {
|
||||
unsigned long linux_tag_placement;
|
||||
const char *commandline_board;
|
||||
const char *commandline_board_debug;
|
||||
const char *noboot;
|
||||
const char *append;
|
||||
const struct board_variant const * (*get_board_variant)(void);
|
||||
int (*is_this_board)(void);
|
||||
void (*early_port_init)(void);
|
||||
|
@ -235,6 +235,8 @@ const struct board_api board_api_gta01 = {
|
||||
"init=/sbin/init "\
|
||||
"ro",
|
||||
.commandline_board_debug = " loglevel=8 console=tty0",
|
||||
.noboot = "boot/noboot-GTA01",
|
||||
.append = "boot/append-GTA01",
|
||||
/* these are the ways we could boot GTA01 in order to try */
|
||||
.kernel_source = {
|
||||
[0] = {
|
||||
@ -244,7 +246,7 @@ const struct board_api board_api_gta01 = {
|
||||
.partition_index = 1,
|
||||
.filesystem = FS_EXT2,
|
||||
.filepath = "boot/uImage-GTA01.bin",
|
||||
.commandline_append = " root=/dev/mmcblk0p1",
|
||||
.commandline_append = " root=/dev/mmcblk0p1 ",
|
||||
},
|
||||
[1] = {
|
||||
.name = "SD Card EXT2 Kernel p2",
|
||||
@ -253,7 +255,7 @@ const struct board_api board_api_gta01 = {
|
||||
.partition_index = 2,
|
||||
.filesystem = FS_EXT2,
|
||||
.filepath = "boot/uImage-GTA01.bin",
|
||||
.commandline_append = " root=/dev/mmcblk0p2",
|
||||
.commandline_append = " root=/dev/mmcblk0p2 ",
|
||||
},
|
||||
[2] = {
|
||||
.name = "SD Card EXT2 Kernel p3",
|
||||
@ -262,7 +264,7 @@ const struct board_api board_api_gta01 = {
|
||||
.partition_index = 3,
|
||||
.filesystem = FS_EXT2,
|
||||
.filepath = "boot/uImage-GTA01.bin",
|
||||
.commandline_append = " root=/dev/mmcblk0p3",
|
||||
.commandline_append = " root=/dev/mmcblk0p3 ",
|
||||
},
|
||||
[3] = {
|
||||
.name = "NAND Kernel",
|
||||
|
@ -396,6 +396,8 @@ const struct board_api board_api_gta02 = {
|
||||
"ro",
|
||||
.commandline_board_debug = " console=tty0 " \
|
||||
"loglevel=8",
|
||||
.noboot = "boot/noboot-GTA02",
|
||||
.append = "boot/append-GTA02",
|
||||
/* these are the ways we could boot GTA02 in the order to try */
|
||||
.kernel_source = {
|
||||
[0] = {
|
||||
@ -405,7 +407,7 @@ const struct board_api board_api_gta02 = {
|
||||
.partition_index = 1,
|
||||
.filesystem = FS_EXT2,
|
||||
.filepath = "boot/uImage-GTA02.bin",
|
||||
.commandline_append = " root=/dev/mmcblk0p1",
|
||||
.commandline_append = " root=/dev/mmcblk0p1 ",
|
||||
},
|
||||
[1] = {
|
||||
.name = "SD Card EXT2 P2 Kernel",
|
||||
@ -414,7 +416,7 @@ const struct board_api board_api_gta02 = {
|
||||
.partition_index = 2,
|
||||
.filesystem = FS_EXT2,
|
||||
.filepath = "boot/uImage-GTA02.bin",
|
||||
.commandline_append = " root=/dev/mmcblk0p2",
|
||||
.commandline_append = " root=/dev/mmcblk0p2 ",
|
||||
},
|
||||
[2] = {
|
||||
.name = "SD Card EXT2 P3 Kernel",
|
||||
@ -423,7 +425,7 @@ const struct board_api board_api_gta02 = {
|
||||
.partition_index = 3,
|
||||
.filesystem = FS_EXT2,
|
||||
.filepath = "boot/uImage-GTA02.bin",
|
||||
.commandline_append = " root=/dev/mmcblk0p3",
|
||||
.commandline_append = " root=/dev/mmcblk0p3 ",
|
||||
},
|
||||
[3] = {
|
||||
.name = "NAND Kernel",
|
||||
@ -431,7 +433,7 @@ const struct board_api board_api_gta02 = {
|
||||
.offset_blocks512_if_no_partition = 0x80000 / 512,
|
||||
.filesystem = FS_RAW,
|
||||
.commandline_append = " rootfstype=jffs2 " \
|
||||
"root=/dev/mtdblock6",
|
||||
"root=/dev/mtdblock6 ",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -57,6 +57,8 @@ const struct board_api board_api_gta03 = {
|
||||
.is_this_board = is_this_board_gta03,
|
||||
.port_init = port_init_gta03,
|
||||
.putc = putc_gta03,
|
||||
.noboot = "boot/noboot-GTA03",
|
||||
.append = "boot/append-GTA03",
|
||||
.commandline_board = "console=ttySAC3,115200 " \
|
||||
"init=/bin/sh " \
|
||||
"loglevel=8 ",
|
||||
@ -67,7 +69,7 @@ const struct board_api board_api_gta03 = {
|
||||
.filesystem = FS_EXT2,
|
||||
.partition_index = 2,
|
||||
.filepath = "boot/uImage-GTA03.bin",
|
||||
.commandline_append = "root=/dev/mmcblk0p2",
|
||||
.commandline_append = "root=/dev/mmcblk0p2 ",
|
||||
},
|
||||
[1] = {
|
||||
.name = "SD Card backup rootfs",
|
||||
@ -75,7 +77,7 @@ const struct board_api board_api_gta03 = {
|
||||
.filesystem = FS_EXT2,
|
||||
.partition_index = 3,
|
||||
.filepath = "boot/uImage-GTA03.bin",
|
||||
.commandline_append = "root=/dev/mmcblk0p3",
|
||||
.commandline_append = "root=/dev/mmcblk0p3 ",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -47,23 +47,25 @@ const struct board_api board_api_smdk6410 = {
|
||||
.putc = putc_smdk6410,
|
||||
.commandline_board = "console=ttySAC0,115200 " \
|
||||
"loglevel=3 " \
|
||||
"init=/bin/sh",
|
||||
"init=/bin/sh ",
|
||||
.noboot = "boot/noboot-SDMK6410",
|
||||
.append = "boot/append-SMDK6410",
|
||||
.kernel_source = {
|
||||
[0] = {
|
||||
.name = "SD Card rootfs",
|
||||
.block_read = sd_card_block_read_smdk6410,
|
||||
.filesystem = FS_EXT2,
|
||||
.partition_index = 2,
|
||||
.filepath = "boot/uImage.bin",
|
||||
.commandline_append = " root=/dev/mmcblk0p2"
|
||||
.filepath = "boot/uImage-SMDK6410.bin",
|
||||
.commandline_append = "root=/dev/mmcblk0p2 "
|
||||
},
|
||||
[1] = {
|
||||
.name = "SD Card backup rootfs",
|
||||
.block_read = sd_card_block_read_smdk6410,
|
||||
.filesystem = FS_EXT2,
|
||||
.partition_index = 3,
|
||||
.filepath = "boot/uImage.bin",
|
||||
.commandline_append = " root=/dev/mmcblk0p3"
|
||||
.filepath = "boot/uImage-SMDK6410.bin",
|
||||
.commandline_append = "root=/dev/mmcblk0p3 "
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ int raise(int n)
|
||||
|
||||
int read_file(const char * filepath, u8 * destination, int size)
|
||||
{
|
||||
unsigned int len = size;
|
||||
int len = size;
|
||||
|
||||
switch (this_kernel->filesystem) {
|
||||
case FS_EXT2:
|
||||
@ -54,12 +54,12 @@ int read_file(const char * filepath, u8 * destination, int size)
|
||||
}
|
||||
puts(" EXT2 open: ");
|
||||
puts(filepath);
|
||||
puts("\n");
|
||||
len = ext2fs_open(filepath);
|
||||
if (len < 0) {
|
||||
puts("Open failed\n");
|
||||
puts(" Open failed\n");
|
||||
return -1;
|
||||
}
|
||||
puts(" OK\n");
|
||||
ext2fs_read((char *)destination, size);
|
||||
break;
|
||||
|
||||
@ -87,6 +87,7 @@ void bootloader_second_phase(void)
|
||||
const struct board_variant * board_variant =
|
||||
(this_board->get_board_variant)();
|
||||
unsigned int initramfs_len = 0;
|
||||
static char commandline_rootfs_append[512] = "";
|
||||
|
||||
/* we try the possible kernels for this board in order */
|
||||
|
||||
@ -165,6 +166,21 @@ void bootloader_second_phase(void)
|
||||
partition_offset_blocks =
|
||||
this_kernel->offset_blocks512_if_no_partition;
|
||||
|
||||
/* does he want us to skip this? */
|
||||
|
||||
if (read_file(this_board->noboot, kernel_dram, 512) >= 0) {
|
||||
puts(" (Skipping on finding ");
|
||||
puts(this_board->noboot);
|
||||
puts(")\n");
|
||||
this_kernel = &this_board->kernel_source[kernel++];
|
||||
continue;
|
||||
}
|
||||
|
||||
/* is there a commandline append file? */
|
||||
|
||||
read_file(this_board->append, (u8 *)commandline_rootfs_append,
|
||||
512);
|
||||
|
||||
/* pull the kernel image */
|
||||
|
||||
if (read_file(this_kernel->filepath, kernel_dram, 4096) < 0) {
|
||||
@ -268,6 +284,9 @@ void bootloader_second_phase(void)
|
||||
if (this_kernel->commandline_append)
|
||||
cmdline += strlen(strcpy(cmdline,
|
||||
this_kernel->commandline_append));
|
||||
if (commandline_rootfs_append[0])
|
||||
cmdline += strlen(strcpy(cmdline,
|
||||
commandline_rootfs_append));
|
||||
|
||||
params->hdr.tag = ATAG_CMDLINE;
|
||||
params->hdr.size = (sizeof (struct tag_header) +
|
||||
|
Loading…
Reference in New Issue
Block a user