[Rockchip RK356x] | Kernel command line的定义来源

Posted Neutionwei

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Rockchip RK356x] | Kernel command line的定义来源相关的知识,希望对你有一定的参考价值。

一、Kernel command line打印

[    0.000000] Kernel command line: storagemedia=emmc androidboot.storagemedia=emmc androidboot.mode=normal ro rootwait earlycon=uart8250,mmio32,0xfe660000 console=ttyFIQ0
root=PARTLABEL=rootfs rootfstype=ext4 overlayroot=device:dev=PARTLABEL=userdata,fstype=ext4,mkfs=1 coherent_pool=1m systemd.gpt_auto=0 cgroup_enable=memory swapaccount=1

二、U-Boot定义部分

arch/arm/mach-rockchip/boot_rkimg.c

static int get_bootdev_type(void)

	char *boot_media = NULL, *devtype = NULL;
	char boot_options[128] = 0;
	static int appended;
	ulong devnum = 0;
	int type = 0;

	devtype = env_get("devtype");
	devnum = env_get_ulong("devnum", 10, 0);

	/* For current use(Only EMMC support!) */
	if (!devtype) 
		devtype = "mmc";
		printf("Use emmc as default boot media\\n");
	

	if (!strcmp(devtype, "mmc")) 
		type = IF_TYPE_MMC;
		if (devnum == 1)
			boot_media = "sd";
		else
			boot_media = "emmc";
	 else if (!strcmp(devtype, "rknand")) 
		type = IF_TYPE_RKNAND;
		boot_media = "nand";
	 else if (!strcmp(devtype, "spinand")) 
		type = IF_TYPE_SPINAND;
		boot_media = "nand"; /* kernel treat sfc nand as nand device */
	 else if (!strcmp(devtype, "spinor")) 
		type = IF_TYPE_SPINOR;
		boot_media = "nor";
	 else if (!strcmp(devtype, "ramdisk")) 
		type = IF_TYPE_RAMDISK;
		boot_media = "ramdisk";
	 else if (!strcmp(devtype, "mtd")) 
		type = IF_TYPE_MTD;
		boot_media = "mtd";
	 else if (!strcmp(devtype, "scsi")) 
		type = IF_TYPE_SCSI;
		boot_media = "scsi";
	 else if (!strcmp(devtype, "nvme")) 
		type = IF_TYPE_NVME;
		boot_media = "nvme";
	 else 
		/* Add new to support */
	

	if (!appended && boot_media) 
		appended = 1;

	/*
	 * The legacy rockchip Android (SDK < 8.1) requires "androidboot.mode="
	 * to be "charger" or boot media which is a rockchip private solution.
	 *
	 * The official Android rule (SDK >= 8.1) is:
	 * "androidboot.mode=normal" or "androidboot.mode=charger".
	 *
	 * Now that this U-Boot is usually working with higher version
	 * Android (SDK >= 8.1), we follow the official rules.
	 *
	 * Common: androidboot.mode=charger has higher priority, don't override;
	 */
#ifdef CONFIG_RKIMG_ANDROID_BOOTMODE_LEGACY
		/* rknand doesn't need "androidboot.mode="; */
		if (env_exist("bootargs", "androidboot.mode=charger") ||
		    (type == IF_TYPE_RKNAND) ||
		    (type == IF_TYPE_SPINAND) ||
		    (type == IF_TYPE_SPINOR))
			snprintf(boot_options, sizeof(boot_options),
				 "storagemedia=%s", boot_media);
		else
			snprintf(boot_options, sizeof(boot_options),
				 "storagemedia=%s androidboot.mode=%s",
				 boot_media, boot_media);
#else
		/*
		 * 1. "storagemedia": This is a legacy variable to indicate board
		 *    storage media for kernel and android.
		 *
		 * 2. "androidboot.storagemedia": The same purpose as "storagemedia",
		 *    but the android framework will auto create property by
		 *    variable with format "androidboot.xxx", eg:
		 *
		 *    "androidboot.storagemedia" => "ro.boot.storagemedia".
		 *
		 *    So, U-Boot pass this new variable is only for the convenience
		 *    to Android.
		 */
		if (env_exist("bootargs", "androidboot.mode=charger"))
			snprintf(boot_options, sizeof(boot_options),
				 "storagemedia=%s androidboot.storagemedia=%s",
				 boot_media, boot_media);
		else
			snprintf(boot_options, sizeof(boot_options),
				 "storagemedia=%s androidboot.storagemedia=%s "
				 "androidboot.mode=normal ",
				 boot_media, boot_media);
#endif
		env_update("bootargs", boot_options);
	

	return type;

三、Kernel dts定义部分

arch/arm64/boot/dts/rockchip/rk3568-linux.dtsi

chosen: chosen                                                                                                       
	bootargs = "earlycon=uart8250,mmio32,0xfe660000 console=ttyFIQ0 root=PARTLABEL=rootfs rootfstype=ext4 ro rootwait overlayroot=device:dev=PARTLABEL=userdata,fstype=ext4,mkfs=1 coherent_pool=1m systemd.gpt_auto=0 cgroup_enable=memory swapaccount=1";
;

以上是关于[Rockchip RK356x] | Kernel command line的定义来源的主要内容,如果未能解决你的问题,请参考以下文章

[RK356x] [Firefly-Linux] 一节课间时间带你了解Ubuntu固件各个分区

RK356x U-Boot研究所(引导篇)1.1 BootLoader引导过程浅析

瑞芯微rk356x板子快速上手

瑞芯微rk356x板子快速上手

RK356x U-Boot研究所(命令篇)3.9 scsi命令的用法

Rockchip | Rockchip原始固件与RK固件格式