diff --git a/qiboot/include/qi.h b/qiboot/include/qi.h index 1ecf31f..6cf4cf5 100644 --- a/qiboot/include/qi.h +++ b/qiboot/include/qi.h @@ -54,7 +54,7 @@ struct kernel_source { int partition_index; /* -1 means no partition table */ int offset_blocks512_if_no_partition; /* used if partition_index is -1 */ enum filesystem filesystem; - const char * commandline; + const char * commandline_append; }; /* describes a board variant, eg, PCB revision */ @@ -72,6 +72,8 @@ struct board_api { unsigned long linux_mem_start; unsigned long linux_mem_size; unsigned long linux_tag_placement; + const char *commandline_board; + const char *commandline_board_debug; const struct board_variant const * (*get_board_variant)(void); int (*is_this_board)(void); void (*early_port_init)(void); diff --git a/qiboot/src/cpu/s3c2410/gta01.c b/qiboot/src/cpu/s3c2410/gta01.c index 4b34112..5ad84ca 100644 --- a/qiboot/src/cpu/s3c2410/gta01.c +++ b/qiboot/src/cpu/s3c2410/gta01.c @@ -224,6 +224,17 @@ const struct board_api board_api_gta01 = { .port_init = port_init_gta01, .putc = putc_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 */ .kernel_source = { [0] = { @@ -233,18 +244,7 @@ const struct board_api board_api_gta01 = { .partition_index = 1, .filesystem = FS_EXT2, .filepath = "boot/uImage-GTA01.bin", - .commandline = "mtdparts=" \ - "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" + .commandline_append = " root=/dev/mmcblk0p1", }, [1] = { .name = "SD Card EXT2 Kernel p2", @@ -253,18 +253,7 @@ const struct board_api board_api_gta01 = { .partition_index = 2, .filesystem = FS_EXT2, .filepath = "boot/uImage-GTA01.bin", - .commandline = "mtdparts=" \ - "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" + .commandline_append = " root=/dev/mmcblk0p2", }, [2] = { .name = "SD Card EXT2 Kernel p3", @@ -273,37 +262,15 @@ const struct board_api board_api_gta01 = { .partition_index = 3, .filesystem = FS_EXT2, .filepath = "boot/uImage-GTA01.bin", - .commandline = "mtdparts=" \ - "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" + .commandline_append = " root=/dev/mmcblk0p3", }, [3] = { .name = "NAND Kernel", .block_read = nand_read_ll, .offset_blocks512_if_no_partition = 0x44000 / 512, .filesystem = FS_RAW, - .commandline = "mtdparts=" \ - "neo1973-nand:" \ - "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" + .commandline_append = " rootfstype=jffs2 " \ + "root=/dev/mtdblock4 ", }, }, }; diff --git a/qiboot/src/cpu/s3c2442/gta02.c b/qiboot/src/cpu/s3c2442/gta02.c index a9078fe..f434ba9 100644 --- a/qiboot/src/cpu/s3c2442/gta02.c +++ b/qiboot/src/cpu/s3c2442/gta02.c @@ -383,7 +383,20 @@ const struct board_api board_api_gta02 = { .port_init = port_init_gta02, .putc = putc_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 = { [0] = { .name = "SD Card EXT2 P1 Kernel", @@ -392,19 +405,7 @@ const struct board_api board_api_gta02 = { .partition_index = 1, .filesystem = FS_EXT2, .filepath = "boot/uImage-GTA02.bin", - .commandline = "mtdparts=physmap-flash:-(nor);" \ - "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" + .commandline_append = " root=/dev/mmcblk0p1", }, [1] = { .name = "SD Card EXT2 P2 Kernel", @@ -413,19 +414,7 @@ const struct board_api board_api_gta02 = { .partition_index = 2, .filesystem = FS_EXT2, .filepath = "boot/uImage-GTA02.bin", - .commandline = "mtdparts=physmap-flash:-(nor);" \ - "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" + .commandline_append = " root=/dev/mmcblk0p2", }, [2] = { .name = "SD Card EXT2 P3 Kernel", @@ -434,39 +423,15 @@ const struct board_api board_api_gta02 = { .partition_index = 3, .filesystem = FS_EXT2, .filepath = "boot/uImage-GTA02.bin", - .commandline = "mtdparts=physmap-flash:-(nor);" \ - "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" + .commandline_append = " root=/dev/mmcblk0p3", }, [3] = { .name = "NAND Kernel", .block_read = nand_read_ll, .offset_blocks512_if_no_partition = 0x80000 / 512, .filesystem = FS_RAW, - .commandline = "mtdparts=physmap-flash:-(nor);" \ - "neo1973-nand:" \ - "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" + .commandline_append = " rootfstype=jffs2 " \ + "root=/dev/mtdblock6", }, }, }; diff --git a/qiboot/src/cpu/s3c6410/gta03-steppingstone.c b/qiboot/src/cpu/s3c6410/gta03-steppingstone.c index eb10622..ac147c2 100644 --- a/qiboot/src/cpu/s3c6410/gta03-steppingstone.c +++ b/qiboot/src/cpu/s3c6410/gta03-steppingstone.c @@ -57,6 +57,9 @@ const struct board_api board_api_gta03 = { .is_this_board = is_this_board_gta03, .port_init = port_init_gta03, .putc = putc_gta03, + .commandline_board = "console=ttySAC3,115200 " \ + "init=/bin/sh " \ + "loglevel=8 ", .kernel_source = { [0] = { .name = "SD Card rootfs", @@ -64,9 +67,7 @@ const struct board_api board_api_gta03 = { .filesystem = FS_EXT2, .partition_index = 2, .filepath = "boot/uImage-GTA03.bin", - .commandline = "console=ttySAC3,115200 " \ - "loglevel=8 init=/bin/sh " \ - "root=/dev/mmcblk0p2" + .commandline_append = "root=/dev/mmcblk0p2", }, [1] = { .name = "SD Card backup rootfs", @@ -74,9 +75,7 @@ const struct board_api board_api_gta03 = { .filesystem = FS_EXT2, .partition_index = 3, .filepath = "boot/uImage-GTA03.bin", - .commandline = "console=ttySAC3,115200 " \ - "loglevel=8 init=/bin/sh " \ - "root=/dev/mmcblk0p3" + .commandline_append = "root=/dev/mmcblk0p3", }, }, }; diff --git a/qiboot/src/cpu/s3c6410/smdk6410-steppingstone.c b/qiboot/src/cpu/s3c6410/smdk6410-steppingstone.c index f41d904..8a62b6c 100644 --- a/qiboot/src/cpu/s3c6410/smdk6410-steppingstone.c +++ b/qiboot/src/cpu/s3c6410/smdk6410-steppingstone.c @@ -45,6 +45,9 @@ const struct board_api board_api_smdk6410 = { .get_board_variant = get_board_variant_smdk6410, .is_this_board = is_this_board_smdk6410, .putc = putc_smdk6410, + .commandline_board = "console=ttySAC0,115200 " \ + "loglevel=3 " \ + "init=/bin/sh", .kernel_source = { [0] = { .name = "SD Card rootfs", @@ -52,9 +55,7 @@ const struct board_api board_api_smdk6410 = { .filesystem = FS_EXT2, .partition_index = 2, .filepath = "boot/uImage.bin", - .commandline = "console=ttySAC0,115200 " \ - "loglevel=3 init=/bin/sh " \ - "root=/dev/mmcblk0p2" + .commandline_append = " root=/dev/mmcblk0p2" }, [1] = { .name = "SD Card backup rootfs", @@ -62,9 +63,8 @@ const struct board_api board_api_smdk6410 = { .filesystem = FS_EXT2, .partition_index = 3, .filepath = "boot/uImage.bin", - .commandline = "console=ttySAC0,115200 " \ - "loglevel=8 init=/bin/sh " \ - "root=/dev/mmcblk0p3" - }, }, + .commandline_append = " root=/dev/mmcblk0p3" + }, + }, }; diff --git a/qiboot/src/phase2.c b/qiboot/src/phase2.c index 847dfc8..60bace3 100644 --- a/qiboot/src/phase2.c +++ b/qiboot/src/phase2.c @@ -94,6 +94,7 @@ void bootloader_second_phase(void) while (this_kernel->name) { const char *p; + char * cmdline; struct tag *params = (struct tag *)this_board->linux_tag_placement; void * kernel_dram = (void *)this_board->linux_mem_start + 0x8000; unsigned long crc; @@ -104,7 +105,7 @@ void bootloader_second_phase(void) partition_length_blocks = 0; /* eat leading white space */ - for (p = this_kernel->commandline; *p == ' '; p++); + for (p = this_board->commandline_board; *p == ' '; p++); puts("\nTrying kernel: "); 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 * the storage before we jump into it and maybe crash silently @@ -266,10 +263,20 @@ void bootloader_second_phase(void) /* kernel commandline */ 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.size = (sizeof (struct tag_header) + - strlen (p) + 1 + 4) >> 2; - strcpy (params->u.cmdline.cmdline, p); + strlen(params->u.cmdline.cmdline) + 1 + 4) >> 2; + + puts(" Cmdline: "); + puts(params->u.cmdline.cmdline); + puts("\n"); + params = tag_next (params); }