1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-26 16:55:19 +02:00

qi-commandline-split.patch

Signed-off-by: Andy Green <andy@openmoko.com>
This commit is contained in:
Andy Green 2008-11-28 10:16:45 +00:00 committed by Andy Green
parent f6ee0972f9
commit 46fd1c005b
6 changed files with 64 additions and 124 deletions

View File

@ -54,7 +54,7 @@ struct kernel_source {
int partition_index; /* -1 means no partition table */ int partition_index; /* -1 means no partition table */
int offset_blocks512_if_no_partition; /* used if partition_index is -1 */ int offset_blocks512_if_no_partition; /* used if partition_index is -1 */
enum filesystem filesystem; enum filesystem filesystem;
const char * commandline; const char * commandline_append;
}; };
/* describes a board variant, eg, PCB revision */ /* describes a board variant, eg, PCB revision */
@ -72,6 +72,8 @@ struct board_api {
unsigned long linux_mem_start; unsigned long linux_mem_start;
unsigned long linux_mem_size; unsigned long linux_mem_size;
unsigned long linux_tag_placement; unsigned long linux_tag_placement;
const char *commandline_board;
const char *commandline_board_debug;
const struct board_variant const * (*get_board_variant)(void); const struct board_variant const * (*get_board_variant)(void);
int (*is_this_board)(void); int (*is_this_board)(void);
void (*early_port_init)(void); void (*early_port_init)(void);

View File

@ -224,6 +224,17 @@ const struct board_api board_api_gta01 = {
.port_init = port_init_gta01, .port_init = port_init_gta01,
.putc = putc_gta01, .putc = putc_gta01,
.close = close_gta01, .close = close_gta01,
.commandline_board = "mtdparts=" \
"neo1973-nand:" \
"0x00040000(qi)," \
"0x00004000(u-boot_env)," \
"0x00200000(kernel)," \
"0x000a0000(splash)," \
"0x03d1c000(rootfs) " \
"console=ttySAC0,115200 " \
"init=/sbin/init "\
"ro",
.commandline_board_debug = " loglevel=8 console=tty0",
/* these are the ways we could boot GTA01 in order to try */ /* these are the ways we could boot GTA01 in order to try */
.kernel_source = { .kernel_source = {
[0] = { [0] = {
@ -233,18 +244,7 @@ const struct board_api board_api_gta01 = {
.partition_index = 1, .partition_index = 1,
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.filepath = "boot/uImage-GTA01.bin", .filepath = "boot/uImage-GTA01.bin",
.commandline = "mtdparts=" \ .commandline_append = " root=/dev/mmcblk0p1",
"neo1973-nand:" \
"0x00040000(qi)," \
"0x00004000(u-boot_env)," \
"0x00200000(kernel)," \
"0x000a0000(splash)," \
"0x03d1c000(rootfs) " \
"root=/dev/mmcblk0p2 " \
"console=ttySAC0,115200 " \
"loglevel=4 " \
"init=/sbin/init "\
"ro"
}, },
[1] = { [1] = {
.name = "SD Card EXT2 Kernel p2", .name = "SD Card EXT2 Kernel p2",
@ -253,18 +253,7 @@ const struct board_api board_api_gta01 = {
.partition_index = 2, .partition_index = 2,
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.filepath = "boot/uImage-GTA01.bin", .filepath = "boot/uImage-GTA01.bin",
.commandline = "mtdparts=" \ .commandline_append = " root=/dev/mmcblk0p2",
"neo1973-nand:" \
"0x00040000(qi)," \
"0x00004000(u-boot_env)," \
"0x00200000(kernel)," \
"0x000a0000(splash)," \
"0x03d1c000(rootfs) " \
"root=/dev/mmcblk0p2 " \
"console=ttySAC0,115200 " \
"loglevel=4 " \
"init=/sbin/init "\
"ro"
}, },
[2] = { [2] = {
.name = "SD Card EXT2 Kernel p3", .name = "SD Card EXT2 Kernel p3",
@ -273,37 +262,15 @@ const struct board_api board_api_gta01 = {
.partition_index = 3, .partition_index = 3,
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.filepath = "boot/uImage-GTA01.bin", .filepath = "boot/uImage-GTA01.bin",
.commandline = "mtdparts=" \ .commandline_append = " root=/dev/mmcblk0p3",
"neo1973-nand:" \
"0x00040000(qi)," \
"0x00004000(u-boot_env)," \
"0x00200000(kernel)," \
"0x000a0000(splash)," \
"0x03d1c000(rootfs) " \
"root=/dev/mmcblk0p2 " \
"console=ttySAC0,115200 " \
"loglevel=4 " \
"init=/sbin/init "\
"ro"
}, },
[3] = { [3] = {
.name = "NAND Kernel", .name = "NAND Kernel",
.block_read = nand_read_ll, .block_read = nand_read_ll,
.offset_blocks512_if_no_partition = 0x44000 / 512, .offset_blocks512_if_no_partition = 0x44000 / 512,
.filesystem = FS_RAW, .filesystem = FS_RAW,
.commandline = "mtdparts=" \ .commandline_append = " rootfstype=jffs2 " \
"neo1973-nand:" \ "root=/dev/mtdblock4 ",
"0x00040000(qi)," \
"0x00004000(u-boot_env)," \
"0x00200000(kernel)," \
"0x000a0000(splash)," \
"0x03d1c000(rootfs) " \
"rootfstype=jffs2 " \
"root=/dev/mtdblock4 " \
"console=ttySAC0,115200 " \
"loglevel=4 " \
"init=/sbin/init "\
"ro"
}, },
}, },
}; };

View File

@ -383,7 +383,20 @@ const struct board_api board_api_gta02 = {
.port_init = port_init_gta02, .port_init = port_init_gta02,
.putc = putc_gta02, .putc = putc_gta02,
.close = close_gta02, .close = close_gta02,
/* these are the ways we could boot GTA02 in order to try */ .commandline_board = "mtdparts=physmap-flash:-(nor);" \
"neo1973-nand:" \
"0x00040000(qi)," \
"0x00040000(cmdline)," \
"0x00800000(backupkernel)," \
"0x000a0000(extra)," \
"0x00040000(identity)," \
"0x0f6a0000(backuprootfs) " \
"console=ttySAC2,115200 " \
"init=/sbin/init " \
"ro",
.commandline_board_debug = " console=tty0 " \
"loglevel=8",
/* these are the ways we could boot GTA02 in the order to try */
.kernel_source = { .kernel_source = {
[0] = { [0] = {
.name = "SD Card EXT2 P1 Kernel", .name = "SD Card EXT2 P1 Kernel",
@ -392,19 +405,7 @@ const struct board_api board_api_gta02 = {
.partition_index = 1, .partition_index = 1,
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.filepath = "boot/uImage-GTA02.bin", .filepath = "boot/uImage-GTA02.bin",
.commandline = "mtdparts=physmap-flash:-(nor);" \ .commandline_append = " root=/dev/mmcblk0p1",
"neo1973-nand:" \
"0x00040000(qi)," \
"0x00040000(cmdline)," \
"0x00800000(backupkernel)," \
"0x000a0000(extra)," \
"0x00040000(identity)," \
"0x0f6a0000(backuprootfs) " \
"root=/dev/mmcblk0p1 " \
"console=ttySAC2,115200 " \
"loglevel=8 console=tty0 " \
"init=/sbin/init "\
"ro"
}, },
[1] = { [1] = {
.name = "SD Card EXT2 P2 Kernel", .name = "SD Card EXT2 P2 Kernel",
@ -413,19 +414,7 @@ const struct board_api board_api_gta02 = {
.partition_index = 2, .partition_index = 2,
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.filepath = "boot/uImage-GTA02.bin", .filepath = "boot/uImage-GTA02.bin",
.commandline = "mtdparts=physmap-flash:-(nor);" \ .commandline_append = " root=/dev/mmcblk0p2",
"neo1973-nand:" \
"0x00040000(qi)," \
"0x00040000(cmdline)," \
"0x00800000(backupkernel)," \
"0x000a0000(extra)," \
"0x00040000(identity)," \
"0x0f6a0000(backuprootfs) " \
"root=/dev/mmcblk0p2 " \
"console=ttySAC2,115200 " \
"loglevel=8 console=tty0 " \
"init=/sbin/init "\
"ro"
}, },
[2] = { [2] = {
.name = "SD Card EXT2 P3 Kernel", .name = "SD Card EXT2 P3 Kernel",
@ -434,39 +423,15 @@ const struct board_api board_api_gta02 = {
.partition_index = 3, .partition_index = 3,
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.filepath = "boot/uImage-GTA02.bin", .filepath = "boot/uImage-GTA02.bin",
.commandline = "mtdparts=physmap-flash:-(nor);" \ .commandline_append = " root=/dev/mmcblk0p3",
"neo1973-nand:" \
"0x00040000(qi)," \
"0x00040000(cmdline)," \
"0x00800000(backupkernel)," \
"0x000a0000(extra)," \
"0x00040000(identity)," \
"0x0f6a0000(backuprootfs) " \
"root=/dev/mmcblk0p3 " \
"console=ttySAC2,115200 " \
"loglevel=8 console=tty0 " \
"init=/sbin/init "\
"ro"
}, },
[3] = { [3] = {
.name = "NAND Kernel", .name = "NAND Kernel",
.block_read = nand_read_ll, .block_read = nand_read_ll,
.offset_blocks512_if_no_partition = 0x80000 / 512, .offset_blocks512_if_no_partition = 0x80000 / 512,
.filesystem = FS_RAW, .filesystem = FS_RAW,
.commandline = "mtdparts=physmap-flash:-(nor);" \ .commandline_append = " rootfstype=jffs2 " \
"neo1973-nand:" \ "root=/dev/mtdblock6",
"0x00040000(qi)," \
"0x00040000(cmdline)," \
"0x00800000(backupkernel)," \
"0x000a0000(extra)," \
"0x00040000(identity)," \
"0x0f6a0000(backuprootfs) " \
"rootfstype=jffs2 " \
"root=/dev/mtdblock6 " \
"console=ttySAC2,115200 " \
"loglevel=8 console=tty0 " \
"init=/sbin/init "\
"ro"
}, },
}, },
}; };

View File

@ -57,6 +57,9 @@ const struct board_api board_api_gta03 = {
.is_this_board = is_this_board_gta03, .is_this_board = is_this_board_gta03,
.port_init = port_init_gta03, .port_init = port_init_gta03,
.putc = putc_gta03, .putc = putc_gta03,
.commandline_board = "console=ttySAC3,115200 " \
"init=/bin/sh " \
"loglevel=8 ",
.kernel_source = { .kernel_source = {
[0] = { [0] = {
.name = "SD Card rootfs", .name = "SD Card rootfs",
@ -64,9 +67,7 @@ const struct board_api board_api_gta03 = {
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.partition_index = 2, .partition_index = 2,
.filepath = "boot/uImage-GTA03.bin", .filepath = "boot/uImage-GTA03.bin",
.commandline = "console=ttySAC3,115200 " \ .commandline_append = "root=/dev/mmcblk0p2",
"loglevel=8 init=/bin/sh " \
"root=/dev/mmcblk0p2"
}, },
[1] = { [1] = {
.name = "SD Card backup rootfs", .name = "SD Card backup rootfs",
@ -74,9 +75,7 @@ const struct board_api board_api_gta03 = {
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.partition_index = 3, .partition_index = 3,
.filepath = "boot/uImage-GTA03.bin", .filepath = "boot/uImage-GTA03.bin",
.commandline = "console=ttySAC3,115200 " \ .commandline_append = "root=/dev/mmcblk0p3",
"loglevel=8 init=/bin/sh " \
"root=/dev/mmcblk0p3"
}, },
}, },
}; };

View File

@ -45,6 +45,9 @@ const struct board_api board_api_smdk6410 = {
.get_board_variant = get_board_variant_smdk6410, .get_board_variant = get_board_variant_smdk6410,
.is_this_board = is_this_board_smdk6410, .is_this_board = is_this_board_smdk6410,
.putc = putc_smdk6410, .putc = putc_smdk6410,
.commandline_board = "console=ttySAC0,115200 " \
"loglevel=3 " \
"init=/bin/sh",
.kernel_source = { .kernel_source = {
[0] = { [0] = {
.name = "SD Card rootfs", .name = "SD Card rootfs",
@ -52,9 +55,7 @@ const struct board_api board_api_smdk6410 = {
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.partition_index = 2, .partition_index = 2,
.filepath = "boot/uImage.bin", .filepath = "boot/uImage.bin",
.commandline = "console=ttySAC0,115200 " \ .commandline_append = " root=/dev/mmcblk0p2"
"loglevel=3 init=/bin/sh " \
"root=/dev/mmcblk0p2"
}, },
[1] = { [1] = {
.name = "SD Card backup rootfs", .name = "SD Card backup rootfs",
@ -62,9 +63,8 @@ const struct board_api board_api_smdk6410 = {
.filesystem = FS_EXT2, .filesystem = FS_EXT2,
.partition_index = 3, .partition_index = 3,
.filepath = "boot/uImage.bin", .filepath = "boot/uImage.bin",
.commandline = "console=ttySAC0,115200 " \ .commandline_append = " root=/dev/mmcblk0p3"
"loglevel=8 init=/bin/sh " \ },
"root=/dev/mmcblk0p3" },
}, },
}; };

View File

@ -94,6 +94,7 @@ void bootloader_second_phase(void)
while (this_kernel->name) { while (this_kernel->name) {
const char *p; const char *p;
char * cmdline;
struct tag *params = (struct tag *)this_board->linux_tag_placement; struct tag *params = (struct tag *)this_board->linux_tag_placement;
void * kernel_dram = (void *)this_board->linux_mem_start + 0x8000; void * kernel_dram = (void *)this_board->linux_mem_start + 0x8000;
unsigned long crc; unsigned long crc;
@ -104,7 +105,7 @@ void bootloader_second_phase(void)
partition_length_blocks = 0; partition_length_blocks = 0;
/* eat leading white space */ /* eat leading white space */
for (p = this_kernel->commandline; *p == ' '; p++); for (p = this_board->commandline_board; *p == ' '; p++);
puts("\nTrying kernel: "); puts("\nTrying kernel: ");
puts(this_kernel->name); puts(this_kernel->name);
@ -208,10 +209,6 @@ void bootloader_second_phase(void)
} }
} }
puts(" Cmdline: ");
puts(p);
puts("\n");
/* /*
* It's good for now to know that our kernel is intact from * It's good for now to know that our kernel is intact from
* the storage before we jump into it and maybe crash silently * the storage before we jump into it and maybe crash silently
@ -266,10 +263,20 @@ void bootloader_second_phase(void)
/* kernel commandline */ /* kernel commandline */
if (*p) { if (*p) {
cmdline = params->u.cmdline.cmdline;
cmdline += strlen(strcpy(cmdline, p));
if (this_kernel->commandline_append)
cmdline += strlen(strcpy(cmdline,
this_kernel->commandline_append));
params->hdr.tag = ATAG_CMDLINE; params->hdr.tag = ATAG_CMDLINE;
params->hdr.size = (sizeof (struct tag_header) + params->hdr.size = (sizeof (struct tag_header) +
strlen (p) + 1 + 4) >> 2; strlen(params->u.cmdline.cmdline) + 1 + 4) >> 2;
strcpy (params->u.cmdline.cmdline, p);
puts(" Cmdline: ");
puts(params->u.cmdline.cmdline);
puts("\n");
params = tag_next (params); params = tag_next (params);
} }