如果uboot的bootargs设置了,kernel的Boot options中的Default kernel command string设置与否,都不启作用,即bootargs覆盖掉设置的Default kernel command string,打印的信息也是bootargs传过来的command string。
如果uboot的bootargs未设置的话,kernel就以Boot options中的Default kernel command string的设置进行启动。
总之:
不管是从NAND还是NOR起动,uboot是用来引导linux的,如果uboot的bootargs设置了的话,uboot在引导Linux时会用bootargs替换掉linux的command string。CONFIG_CMDLINE实在bootloader无法给内核传递参数的情况下才有用,一般是用不到内核自己配的CONFIG_CMDLINE的 。
#define LINUX_MAX_ENVS 256
#define LINUX_MAX_ARGS 256
static int linux_argc;
static char ** linux_argv;
static char ** linux_env;
static char * linux_env_p;
static int linux_env_idx;
static void linux_params_init (ulong start, char * commandline);
static void linux_env_set (char * env_name, char * env_val);
int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
{
void (*theKernel) (int, char **, char **, int *);
char *commandline = getenv ("bootargs");
char env_buf[12];
char *cp;
if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
return 1;
/* find kernel entry point */
theKernel = (void (*)(int, char **, char **, int *))images->ep;
show_boot_progress (15);
#ifdef DEBUG
printf ("## Transferring control to Linux (at address %08lx) ...\n",
(ulong) theKernel);
#endif
#linux_argc=1; linux_argv[0]=0
linux_params_init (UNCACHED_SDRAM (gd->bd->bi_boot_params), commandline);
#ifdef CONFIG_MEMSIZE_IN_BYTES
sprintf (env_buf, "%lu", (ulong)gd->ram_size);
debug ("## Giving linux memsize in bytes, %lu\n", (ulong)gd->ram_size);
#else
sprintf (env_buf, "%lu", (ulong)(gd->ram_size >> 20));
debug ("## Giving linux memsize in MB, %lu\n", (ulong)(gd->ram_size >> 20));
#endif /* CONFIG_MEMSIZE_IN_BYTES */
linux_env_set ("memsize", env_buf); #memsize=512
sprintf (env_buf, "0x%08X", (uint) UNCACHED_SDRAM (images->rd_start));
linux_env_set ("initrd_start", env_buf); #initrd_size=0x0
sprintf (env_buf, "0x%X", (uint) (images->rd_end - images->rd_start));
linux_env_set ("initrd_size", env_buf); #initrd_size=0x0
sprintf (env_buf, "0x%08X", (uint) (gd->bd->bi_flashstart));
linux_env_set ("flash_start", env_buf);
sprintf (env_buf, "0x%X", (uint) (gd->bd->bi_flashsize));
linux_env_set ("flash_size", env_buf);
cp = getenv("ethaddr");
if (cp != NULL) {
linux_env_set("ethaddr", cp);
}
cp = getenv("eth1addr");
if (cp != NULL) {
linux_env_set("eth1addr", cp);
}
/* we assume that the kernel is in place */
printf ("\nStarting kernel ...\n\n");
#ifdef CONFIG_INTERRUPT_SUPPORT
{ /* for INTERRUPT */
unsigned int ebase = MIPS_DEFAULT_EBASE;
common_disable_interrupt();
write_c0_ebase(ebase);
}
#endif /*CONFIG_INTERRUPT_SUPPORT*/
theKernel (linux_argc, linux_argv, linux_env, 0);
/* does not return */
return 1;
}
#bootargs=noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200 rootfstype=yaffs2 rw mem=64M
#bootcmd=nand read 0x32000000 0x60000 0x300000; bootm 0x32000000
#setenv bootargs console=/dev/ttyS0,115200 root=/dev/nfs nfsroot=192.168.1.26:/eric_root_devel ip=\%1:192.16
static void linux_params_init (ulong start, char *line)
{
char *next, *quote, *argp;
linux_argc = 1;
linux_argv = (char **) start; #将内存分配的地址强制转化为二级指针地址
linux_argv[0] = 0;
argp = (char *) (linux_argv + LINUX_MAX_ARGS);#偏移256 * 4 = 1KBytes大小
next = line;
while (line && *line && linux_argc < LINUX_MAX_ARGS) {
quote = strchr (line, '"');
next = strchr (line, ' ');
while (next != NULL && quote != NULL && quote < next) {
/* we found a left quote before the next blank
* now we have to find the matching right quote
*/
next = strchr (quote + 1, '"');
if (next != NULL) {
quote = strchr (next + 1, '"');
next = strchr (next + 1, ' ');
}
}
if (next == NULL) {
next = line + strlen (line);
}
linux_argv[linux_argc] = argp;
memcpy (argp, line, next - line);
argp[next - line] = 0;
argp += next - line + 1;
linux_argc++;
if (*next)
next++;
line = next;
}
linux_env = (char **) (((ulong) argp + 15) & ~15);
linux_env[0] = 0;
linux_env_p = (char *) (linux_env + LINUX_MAX_ENVS);
linux_env_idx = 0;
}
static void linux_env_set (char *env_name, char *env_val)
{
if (linux_env_idx < LINUX_MAX_ENVS - 1) {
linux_env[linux_env_idx] = linux_env_p;
strcpy (linux_env_p, env_name);
linux_env_p += strlen (env_name);
strcpy (linux_env_p, "=");
linux_env_p += 1;
strcpy (linux_env_p, env_val);
linux_env_p += strlen (env_val);
linux_env_p++;
linux_env[++linux_env_idx] = 0;
}
}
Administrator@LBDZ-20190907AC MINGW32 /d/lyeffrot/vscodeSourceC/kernel/uClinux/linux-4.4.x
$ grep "\bCONFIG_CMDLINE\b" ./ -nR --color=always
./.config:1453:CONFIG_CMDLINE="console=ttyS0,115200"
./.config.old:1453:CONFIG_CMDLINE="console=ttyS0,115200"
./arch/arm/configs/acs5k_defconfig:26:CONFIG_CMDLINE="mem=32M console=ttyS0,115200 initrd=0x20410000,3145728 root=/dev/ram0 rw"
./arch/arm/configs/acs5k_tiny_defconfig:19:CONFIG_CMDLINE="console=ttyAM0,115200 init=/bin/sh"
./arch/arm/configs/am200epdkit_defconfig:25:CONFIG_CMDLINE="console=ttyS0,115200n8 root=1f01 rootfstype=jffs2"
./arch/arm/configs/arm_defconfig:268:CONFIG_CMDLINE=""
./arch/arm/configs/assabet_defconfig:14:CONFIG_CMDLINE="mem=32M console=ttySA0,38400n8 initrd=0xc0800000,3M root=/dev/ram"
./arch/arm/configs/at91_dt_defconfig:28:CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw"
./arch/arm/configs/badge4_defconfig:10:CONFIG_CMDLINE="init=/linuxrc root=/dev/mtdblock3"
./arch/arm/configs/bcm_defconfig:37:CONFIG_CMDLINE="console=ttyS0,115200n8 mem=128M"
./arch/arm/configs/cerfcube_defconfig:17:CONFIG_CMDLINE="console=ttySA0,38400 root=/dev/mtdblock3 rootfstype=jffs2 rw mem=32M init=/linuxrc"
./arch/arm/configs/cm_x2xx_defconfig:30:CONFIG_CMDLINE="root=1f03 mem=32M"
./arch/arm/configs/cm_x300_defconfig:22:CONFIG_CMDLINE="root=/dev/mtdblock5 rootfstype=ubifs console=ttyS2,38400"
./arch/arm/configs/cns3420vb_defconfig:30:CONFIG_CMDLINE="console=ttyS0,38400 mem=128M root=/dev/mmcblk0p1 ro rootwait"
./arch/arm/configs/colibri_pxa300_defconfig:8:CONFIG_CMDLINE="console=ttyS0,115200 rw"
./arch/arm/configs/collie_defconfig:20:CONFIG_CMDLINE="noinitrd root=/dev/mtdblock2 rootfstype=jffs2 fbcon=rotate:1"
./arch/arm/configs/corgi_defconfig:25:CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug"
./arch/arm/configs/ebsa110_defconfig:13:CONFIG_CMDLINE="root=/dev/nfs rw mem=16M console=ttyS1,38400n8"
./arch/arm/configs/em_x270_defconfig:23:CONFIG_CMDLINE="root=1f03 mem=32M"
./arch/arm/configs/ep93xx_defconfig:38:CONFIG_CMDLINE="console=ttyAM0,115200 root=/dev/nfs ip=bootp"
./arch/arm/configs/exynos_defconfig:28:CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc mem=256M"
./arch/arm/configs/ezx_defconfig:28:CONFIG_CMDLINE="console=tty1 root=/dev/mmcblk0p2 rootfstype=ext2 rootdelay=3 ip=192.168.0.202:192.168.0.200:192.168.0.200:255.255.255.0 debug"
./arch/arm/configs/h5000_defconfig:20:CONFIG_CMDLINE="keepinitrd"
./arch/arm/configs/hackkit_defconfig:12:CONFIG_CMDLINE="console=ttySA0,115200 root=/dev/ram0 initrd=0xc0400000,8M init=/rootshell"
./arch/arm/configs/imote2_defconfig:27:CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=jffs2 console=ttyS2,115200 mem=32M"
./arch/arm/configs/imx_v6_v7_defconfig:54:CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
./arch/arm/configs/integrator_defconfig:31:CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp"
./arch/arm/configs/iop13xx_defconfig:22:CONFIG_CMDLINE="ip=bootp root=nfs console=ttyS0,115200 nfsroot=,tcp,v3,wsize=8192,rsize=8192"
./arch/arm/configs/iop32x_defconfig:19:CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp cachepolicy=writealloc"
./arch/arm/configs/iop33x_defconfig:17:CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp cachepolicy=writealloc iop3xx_init_atu=y"
./arch/arm/configs/ixp4xx_defconfig:33:CONFIG_CMDLINE="console=ttyS0,115200 ip=bootp root=/dev/nfs"
./arch/arm/configs/ks8695_defconfig:24:CONFIG_CMDLINE="mem=32M console=ttyS0,115200 initrd=0x20410000,3145728 root=/dev/ram0 rw"
./arch/arm/configs/lart_defconfig:12:CONFIG_CMDLINE="console=ttySA0,9600 root=/dev/ram"
./arch/arm/configs/lpc32xx_defconfig:28:CONFIG_CMDLINE="console=ttyS0,115200n81 root=/dev/ram0"
./arch/arm/configs/lpd270_defconfig:11:CONFIG_CMDLINE="root=/dev/nfs ip=bootp console=ttyS0,115200 mem=64M"
./arch/arm/configs/lubbock_defconfig:14:CONFIG_CMDLINE="root=/dev/nfs ip=bootp console=ttyS0,115200 mem=64M"
./arch/arm/configs/magician_defconfig:23:CONFIG_CMDLINE="keepinitrd"
./arch/arm/configs/mainstone_defconfig:12:CONFIG_CMDLINE="root=/dev/nfs ip=bootp console=ttyS0,115200 mem=64M"
./arch/arm/configs/mmp2_defconfig:19:CONFIG_CMDLINE="root=/dev/nfs rootfstype=nfs nfsroot=192.168.1.100:/nfsroot/ ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on console=ttyS2,38400 mem=128M user_debug=255 earlyprintk"
./arch/arm/configs/neponset_defconfig:18:CONFIG_CMDLINE="console=ttySA0,38400n8 cpufreq=221200 rw root=/dev/mtdblock2 mtdparts=sa1100:512K(boot),1M(kernel),2560K(initrd),4M(root) load_ramdisk=1 prompt_ramdisk=0 mem=32M noinitrd initrd=0xc0800000,3M"
./arch/arm/configs/netwinder_defconfig:10:CONFIG_CMDLINE="root=0x301"
./arch/arm/configs/netx_defconfig:18:CONFIG_CMDLINE="console=ttySMX0,115200"
./arch/arm/configs/nuc910_defconfig:14:CONFIG_CMDLINE="root=/dev/ram0 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M"
./arch/arm/configs/nuc950_defconfig:18:CONFIG_CMDLINE="root=/dev/ram0 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M"
./arch/arm/configs/nuc960_defconfig:18:CONFIG_CMDLINE="root=/dev/ram0 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M"
./arch/arm/configs/omap1_defconfig:58:CONFIG_CMDLINE="root=1f03 rootfstype=jffs2"
./arch/arm/configs/omap2plus_defconfig:63:CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200"
./arch/arm/configs/palmz72_defconfig:20:CONFIG_CMDLINE="mem=32M console=tty root=/dev/mmcblk0"
./arch/arm/configs/pleb_defconfig:16:CONFIG_CMDLINE="console=ttySA0,9600 mem=16M@0xc0000000 mem=16M@0xc8000000 root=/dev/ram initrd=0xc0400000,4M"
./arch/arm/configs/pxa168_defconfig:20:CONFIG_CMDLINE="root=/dev/nfs rootfstype=nfs nfsroot=192.168.2.100:/nfsroot/ ip=192.168.2.101:192.168.2.100::255.255.255.0::eth0:on console=ttyS0,115200 mem=128M"
./arch/arm/configs/pxa255-idp_defconfig:12:CONFIG_CMDLINE="root=/dev/nfs ip=dhcp console=ttyS0,115200 mem=64M"
./arch/arm/configs/pxa3xx_defconfig:18:CONFIG_CMDLINE="root=/dev/nfs rootfstype=nfs nfsroot=192.168.1.100:/nfsroot/ ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on console=ttyS0,115200 mem=64M debug"
./arch/arm/configs/pxa910_defconfig:20:CONFIG_CMDLINE="root=/dev/nfs rootfstype=nfs nfsroot=192.168.2.100:/nfsroot/ ip=192.168.2.101:192.168.2.100::255.255.255.0::eth0:on console=ttyS0,115200 mem=128M earlyprintk"
./arch/arm/configs/raumfeld_defconfig:15:CONFIG_CMDLINE="console=ttyS0,115200 rw"
./arch/arm/configs/realview-smp_defconfig:20:CONFIG_CMDLINE="root=/dev/nfs nfsroot=10.1.69.3:/work/nfsroot ip=dhcp console=ttyAMA0 mem=128M"
./arch/arm/configs/realview_defconfig:19:CONFIG_CMDLINE="root=/dev/nfs nfsroot=10.1.69.3:/work/nfsroot ip=dhcp console=ttyAMA0 mem=128M"
./arch/arm/configs/s3c2410_defconfig:51:CONFIG_CMDLINE="root=/dev/hda1 ro init=/bin/bash console=ttySAC0"
./arch/arm/configs/s3c6400_defconfig:22:CONFIG_CMDLINE="console=ttySAC0,115200 root=/dev/ram init=/linuxrc initrd=0x51000000,6M ramdisk_size=6144"
./arch/arm/configs/s5pv210_defconfig:21:CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x20800000,8M console=ttySAC1,115200 init=/linuxrc"
./arch/arm/configs/sama5_defconfig:25:CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw"
./arch/arm/configs/shannon_defconfig:12:CONFIG_CMDLINE="console=ttySA0,9600 console=tty1 root=/dev/mtdblock2 init=/linuxrc"
./arch/arm/configs/simpad_defconfig:17:CONFIG_CMDLINE="mtdparts=sa1100:512k(boot),1m(kernel),-(root) console=ttySA0 root=1f02 noinitrd mem=64M jffs2_orphaned_inodes=delete rootfstype=jffs2"
./arch/arm/configs/spitz_defconfig:23:CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug"
./arch/arm/configs/tct_hammer_defconfig:21:CONFIG_CMDLINE="mem=64M root=/dev/ram0 init=/linuxrc rw"
./arch/arm/configs/trizeps4_defconfig:26:CONFIG_CMDLINE="root=fe01 console=ttyS0,38400n8 loglevel=5"
./arch/arm/configs/u300_defconfig:23:CONFIG_CMDLINE="root=/dev/ram0 rw rootfstype=rootfs console=ttyAMA0,115200n8 lpj=515072"
./arch/arm/configs/u8500_defconfig:22:CONFIG_CMDLINE="root=/dev/ram0 console=ttyAMA2,115200n8"
./arch/arm/configs/versatile_defconfig:15:CONFIG_CMDLINE="root=1f03 mem=32M"
./arch/arm/configs/vexpress_defconfig:36:CONFIG_CMDLINE="console=ttyAMA0"
./arch/arm/configs/vf610m4_defconfig:17:CONFIG_CMDLINE="console=/dev/ttyLP2"
./arch/arm/configs/viper_defconfig:22:CONFIG_CMDLINE="root=31:02 rootfstype=jffs2 ro console=ttyS0,115200"
./arch/arm/configs/xcep_defconfig:31:CONFIG_CMDLINE="root=mtd4 rootfstype=jffs2 ro console=ttyS0,115200"
./arch/arm/configs/zeus_defconfig:16:CONFIG_CMDLINE="root=31:02 rootfstype=jffs2 ro console=ttyS0,115200"
./arch/arm/configs/zx_defconfig:44:CONFIG_CMDLINE="console=ttyAMA0,115200 debug earlyprintk root=/dev/ram rw rootwait"
./arch/arm/kernel/atags_parse.c:34:static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
./arch/arm64/configs/defconfig:63:CONFIG_CMDLINE="console=ttyAMA0"
./arch/arm64/configs/lsk_defconfig:63:CONFIG_CMDLINE="console=ttyAMA0"
./arch/arm64/kernel/kaslr.c:47: static __initconst const u8 default_cmdline[] = CONFIG_CMDLINE;
./arch/blackfin/configs/BF527-AD7160-EVAL_defconfig:31:CONFIG_CMDLINE="bootargs=root=/dev/mtdblock0 rw clkin_hz=24000000 earlyprintk=serial,uart0,57600 console=tty0 console=ttyBF0,57600"
./arch/blackfin/kernel/setup.c:932: strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line));
./arch/c6x/configs/dsk6455_defconfig:21:CONFIG_CMDLINE=""
./arch/c6x/configs/evmc6457_defconfig:21:CONFIG_CMDLINE=""
./arch/c6x/configs/evmc6472_defconfig:21:CONFIG_CMDLINE=""
./arch/c6x/configs/evmc6474_defconfig:21:CONFIG_CMDLINE=""
./arch/c6x/configs/evmc6678_defconfig:21:CONFIG_CMDLINE=""
./arch/hexagon/kernel/setup.c:38:static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
./arch/mips/configs/ar7_defconfig:147:CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
./arch/mips/configs/bcm47xx_defconfig:85:CONFIG_CMDLINE="console=ttyS0,115200"
./arch/mips/configs/bcm63xx_defconfig:88:CONFIG_CMDLINE="console=ttyS0,115200"
./arch/mips/configs/bmips_be_defconfig:85:CONFIG_CMDLINE="earlycon"
./arch/mips/configs/bmips_stb_defconfig:88:CONFIG_CMDLINE="earlycon"
./arch/mips/configs/capcella_defconfig:75:CONFIG_CMDLINE="mem=32M console=ttyVR0,38400"
./arch/mips/configs/ci20_defconfig:162:CONFIG_CMDLINE="earlycon console=ttyS4,115200 clk_ignore_unused"
./arch/mips/configs/e55_defconfig:42:CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x1f0,0x3f6,40 mem=8M"
./arch/mips/configs/gpr_defconfig:330:CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs rw ip=auto"
./arch/mips/configs/markeins_defconfig:202:CONFIG_CMDLINE="console=ttyS0,115200 mem=192m ip=bootp root=/dev/nfs rw"
./arch/mips/configs/mpc30x_defconfig:60:CONFIG_CMDLINE="mem=32M console=ttyVR0,19200 ide0=0x170,0x376,73"
./arch/mips/configs/tb0219_defconfig:96:CONFIG_CMDLINE="cca=3 mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
./arch/mips/configs/tb0226_defconfig:92:CONFIG_CMDLINE="cca=3 mem=32M console=ttyVR0,115200"
./arch/mips/configs/tb0287_defconfig:110:CONFIG_CMDLINE="cca=3 mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
./arch/mips/configs/workpad_defconfig:73:CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x170,0x376,49 mem=16M"
./arch/mips/configs/xilfpga_defconfig:40:CONFIG_CMDLINE="console=ttyS0,115200"
./arch/mips/Kconfig.debug:46: in CONFIG_CMDLINE.
./arch/mips/kernel/setup.c:78:static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
./arch/nios2/kernel/setup.c:131: strncpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
./arch/powerpc/configs/40x/virtex_defconfig:20:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/akebono_defconfig:23:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/arches_defconfig:15:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/bamboo_defconfig:13:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/bluestone_defconfig:15:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/canyonlands_defconfig:15:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/currituck_defconfig:21:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/eiger_defconfig:14:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/icon_defconfig:13:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/iss476-smp_defconfig:21:CONFIG_CMDLINE="root=/dev/issblk0"
./arch/powerpc/configs/44x/katmai_defconfig:13:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/rainier_defconfig:14:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/redwood_defconfig:14:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/sam440ep_defconfig:18:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/sequoia_defconfig:15:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/taishan_defconfig:13:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/virtex5_defconfig:20:CONFIG_CMDLINE=""
./arch/powerpc/configs/44x/warp_defconfig:18:CONFIG_CMDLINE="ip=on"
./arch/powerpc/configs/holly_defconfig:16:CONFIG_CMDLINE="console=ttyS0,115200"
./arch/powerpc/configs/mvme5100_defconfig:26:CONFIG_CMDLINE="console=ttyS0,9600 ip=dhcp root=/dev/nfs"
./arch/powerpc/configs/ps3_defconfig:39:CONFIG_CMDLINE=""
./arch/powerpc/configs/storcenter_defconfig:16:CONFIG_CMDLINE="console=ttyS0,115200"
./arch/powerpc/kernel/prom_init.c:598:#ifdef CONFIG_CMDLINE
./arch/powerpc/kernel/prom_init.c:601: CONFIG_CMDLINE, sizeof(prom_cmd_line));
./arch/powerpc/kernel/prom_init.c:602:#endif /* CONFIG_CMDLINE */
./arch/rlx/configs/ar7_defconfig:147:CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
./arch/rlx/configs/bcm47xx_defconfig:85:CONFIG_CMDLINE="console=ttyS0,115200"
./arch/rlx/configs/bcm63xx_defconfig:88:CONFIG_CMDLINE="console=ttyS0,115200"
./arch/rlx/configs/bmips_be_defconfig:85:CONFIG_CMDLINE="earlycon"
./arch/rlx/configs/bmips_stb_defconfig:88:CONFIG_CMDLINE="earlycon"
./arch/rlx/configs/capcella_defconfig:75:CONFIG_CMDLINE="mem=32M console=ttyVR0,38400"
./arch/rlx/configs/ci20_defconfig:162:CONFIG_CMDLINE="earlycon console=ttyS4,115200 clk_ignore_unused"
./arch/rlx/configs/e55_defconfig:42:CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x1f0,0x3f6,40 mem=8M"
./arch/rlx/configs/gpr_defconfig:330:CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs rw ip=auto"
./arch/rlx/configs/markeins_defconfig:202:CONFIG_CMDLINE="console=ttyS0,115200 mem=192m ip=bootp root=/dev/nfs rw"
./arch/rlx/configs/mpc30x_defconfig:60:CONFIG_CMDLINE="mem=32M console=ttyVR0,19200 ide0=0x170,0x376,73"
./arch/rlx/configs/tb0219_defconfig:96:CONFIG_CMDLINE="cca=3 mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
./arch/rlx/configs/tb0226_defconfig:92:CONFIG_CMDLINE="cca=3 mem=32M console=ttyVR0,115200"
./arch/rlx/configs/tb0287_defconfig:110:CONFIG_CMDLINE="cca=3 mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
./arch/rlx/configs/workpad_defconfig:73:CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x170,0x376,49 mem=16M"
./arch/rlx/configs/xilfpga_defconfig:40:CONFIG_CMDLINE="console=ttyS0,115200"
./arch/rlx/Kconfig.debug:46: in CONFIG_CMDLINE.
./arch/rlx/kernel/setup.c:78:static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
./arch/sh/configs/ap325rxa_defconfig:20:CONFIG_CMDLINE="console=tty1 console=ttySC5,38400 root=/dev/nfs ip=dhcp"
./arch/sh/configs/dreamcast_defconfig:28:CONFIG_CMDLINE="console=ttySC1,115200 panic=3"
./arch/sh/configs/ecovec24-romimage_defconfig:20:CONFIG_CMDLINE="console=ttySC0,115200"
./arch/sh/configs/ecovec24_defconfig:21:CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 root=/dev/nfs ip=dhcp mem=248M memchunk.vpu=8m memchunk.veu0=4m"
./arch/sh/configs/edosk7760_defconfig:24:CONFIG_CMDLINE="mem=64M console=ttySC2,115200 root=/dev/nfs rw nfsroot=192.168.0.3:/scripts/filesys ip=192.168.0.4"
./arch/sh/configs/espt_defconfig:21:CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/nfs ip=bootp"
./arch/sh/configs/kfr2r09-romimage_defconfig:20:CONFIG_CMDLINE="console=ttySC1,115200 quiet"
./arch/sh/configs/kfr2r09_defconfig:26:CONFIG_CMDLINE="console=tty0 console=ttySC1,115200"
./arch/sh/configs/lboxre2_defconfig:18:CONFIG_CMDLINE="console=ttySC1,115200 root=/dev/sda1"
./arch/sh/configs/microdev_defconfig:17:CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/hda1"
./arch/sh/configs/migor_defconfig:22:CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 earlyprintk=serial ip=on root=/dev/nfs ip=dhcp"
./arch/sh/configs/polaris_defconfig:31:CONFIG_CMDLINE="console=ttySC1,115200 root=/dev/mtdblock2 rootfstype=jffs2 mem=63M mtdparts=physmap-flash.0:0x00100000(bootloader)ro,0x00500000(Kernel)ro,0x00A00000(Filesystem)"
./arch/sh/configs/r7780mp_defconfig:29:CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
./arch/sh/configs/r7785rp_defconfig:35:CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
./arch/sh/configs/rsk7201_defconfig:29:CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ignore_loglevel"
./arch/sh/configs/rsk7203_defconfig:34:CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ignore_loglevel"
./arch/sh/configs/rts7751r2d1_defconfig:18:CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1"
./arch/sh/configs/rts7751r2dplus_defconfig:18:CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1"
./arch/sh/configs/sdk7780_defconfig:27:CONFIG_CMDLINE="mem=128M console=tty0 console=ttySC0,115200 ip=bootp root=/dev/nfs nfsroot=192.168.0.1:/home/rootfs"
./arch/sh/configs/sdk7786_defconfig:76:CONFIG_CMDLINE="console=ttySC1,115200 earlyprintk=sh-sci.1,115200 root=/dev/sda1 nmi_debug=state,debounce rootdelay=5 pmb=iomap ignore_loglevel"
./arch/sh/configs/se7206_defconfig:46:CONFIG_CMDLINE="console=ttySC3,115200 ignore_loglevel earlyprintk=serial"
./arch/sh/configs/se7343_defconfig:24:CONFIG_CMDLINE="console=ttySC0,115200"
./arch/sh/configs/se7712_defconfig:29:CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
./arch/sh/configs/se7721_defconfig:29:CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda2"
./arch/sh/configs/se7724_defconfig:22:CONFIG_CMDLINE="console=tty1 console=ttySC3,115200 root=/dev/nfs ip=dhcp memchunk.vpu=4m"
./arch/sh/configs/se7751_defconfig:18:CONFIG_CMDLINE="console=ttySC1,38400"
./arch/sh/configs/se7780_defconfig:19:CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
./arch/sh/configs/sh03_defconfig:23:CONFIG_CMDLINE="console=ttySC1,115200 mem=64M root=/dev/nfs"
./arch/sh/configs/sh2007_defconfig:25:CONFIG_CMDLINE="console=ttySC1,115200 ip=dhcp root=/dev/nfs rw nfsroot=/nfs/rootfs,rsize=1024,wsize=1024 earlyprintk=sh-sci.1"
./arch/sh/configs/sh7757lcr_defconfig:27:CONFIG_CMDLINE="console=ttySC2,115200 root=/dev/nfs ip=dhcp"
./arch/sh/configs/sh7763rdp_defconfig:21:CONFIG_CMDLINE="console=ttySC2,115200 root=/dev/sda1 rootdelay=10"
./arch/sh/configs/shmin_defconfig:26:CONFIG_CMDLINE="console=ttySC1,115200 root=1f01 mtdparts=phys_mapped_flash:64k(firm)ro,-(sys) netdev=34,0x300,eth0 "
./arch/sh/configs/shx3_defconfig:54:CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=bios ignore_loglevel"
./arch/sh/configs/titan_defconfig:26:CONFIG_CMDLINE="console=ttySC1,38400N81 root=/dev/nfs ip=:::::eth1:autoconf rw"
./arch/sh/configs/ul2_defconfig:25:CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/nfs ip=dhcp"
./arch/sh/kernel/setup.c:279: strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line));
./arch/sh/kernel/setup.c:284: strlcat(command_line, CONFIG_CMDLINE, sizeof(command_line));
./arch/sparc/prom/bootstr_64.c:27:#ifdef CONFIG_CMDLINE
./arch/sparc/prom/bootstr_64.c:29: .bootstr_buf = CONFIG_CMDLINE,
./arch/tile/Kconfig:365: the boot arguments in CONFIG_CMDLINE.
./arch/tile/kernel/setup.c:1417:static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
./arch/unicore32/configs/unicore32_defconfig:32:CONFIG_CMDLINE="earlyprintk=ocd,keep ignore_loglevel"
./arch/unicore32/kernel/setup.c:65:static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
./arch/x86/Kconfig:2118: boot arguments in CONFIG_CMDLINE.
./arch/x86/kernel/setup.c:238:static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
./arch/xtensa/configs/audio_kc705_defconfig:36:CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug"
./arch/xtensa/configs/common_defconfig:79:CONFIG_CMDLINE="console=ttyS0,38400 ip=bootp root=nfs nfsroot=/opt/montavista/pro/devkit/xtensa/linux_be/target"
./arch/xtensa/configs/generic_kc705_defconfig:36:CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug"
./arch/xtensa/configs/iss_defconfig:165:CONFIG_CMDLINE="console=ttyS0,38400 eth0=tuntap,,tap0 ip=192.168.168.5:192.168.168.1 root=nfs nfsroot=192.168.168.1:/opt/montavista/pro/devkit/xtensa/linux_be/target"
./arch/xtensa/configs/nommu_kc705_defconfig:40:CONFIG_CMDLINE="earlycon=uart8250,mmio32,0x9d050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug"
./arch/xtensa/configs/smp_lx200_defconfig:40:CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug"
./arch/xtensa/kernel/setup.c:88:static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
./Documentation/init.txt:15:0) Set "debug" kernel parameter (in bootloader config file or CONFIG_CMDLINE)
./Documentation/kernel-parameters.txt:3496: 0 -- disable. (may be 1 via CONFIG_CMDLINE="skew_tick=1"
./drivers/firmware/efi/libstub/arm-stub.c:226: static const u8 default_cmdline[] = CONFIG_CMDLINE;
./drivers/of/fdt.c:972: * CONFIG_CMDLINE is meant to be a default in case nothing else
./drivers/of/fdt.c:976:#ifdef CONFIG_CMDLINE
./drivers/of/fdt.c:980: strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
./drivers/of/fdt.c:981:#endif /* CONFIG_CMDLINE */
./include/config/auto.conf:284:CONFIG_CMDLINE="console=ttyS0,115200"
./include/generated/autoconf.h:286:#define CONFIG_CMDLINE "console=ttyS0,115200"
./tools/testing/ktest/sample.conf:613:# CONFIG_CMDLINE=""
1.启动参数传递:其中struct tag_header表示参数的类型和长度。
Struct bd_t : 宏CONFIG_NR_DRAM_BANKS位于include/configs/webee210.h
Gd_t:其初始化位于init_sequence处。
2.U_BOOT_CMD/do_bootm----->(bootm_start–bootm_load_os–do_bootm_linux)---->函数指针数组boot_os_fn *boot_os[] ---->do_bootm_linux---->setup_start_tag
Uchar default_environment[]:可在uboot命令模式下用printenv打印出来,这些环境变量也在init_sequence处被初始化。Env_common.c。
U_BOOT_CMD:include/command.h
中断向量表:该部分为处理器的异常处理向量表。地址范围为0x0000 0000 ~ 0x0000 0020,刚好8条指令。
复位程序
该函数中调用了
lowlevel_init
直接从nand或SD卡启动uboot
arch\arm\cpu\armv7\s5pc1xxs\nand_cp.c
从SD卡启动uboot:start.s调board_init_f—>relocate(relocate/stack_setup/copy_loop),uboot搬到内存后直接跳到内存执行board_init_r
Main_loop分析:Uboot加载内核
如果定义了BOOTDELAY,则从环境变量中获取BOOTDELAY的值
从环境变量中获取bootcmd并执行(如bootcmd= bootm 0x20700000),abortboot中会延时3秒并打印“Hit any key to stop autoboot”、记录串口控制台是否输入ctrl+B.
3秒内未输入ctrl+B则不会执行bootcmd,才会执行到此处进入for循环,循环从控制台读取console_buffer,执行用户输入的命令
启动内核