cmd: mmc: add mmcboot command
PATCH 1/1 cmd: mmc: add mmcboot command
Similar to usbboot, add command line to boot from raw mmc partition using common_diskboot(), which supports legacy or FIT images.
Usage:
mmcboot loadAaddr dev:part
Where <loadAddr> defaults to CONFIG_SYS_LOAD_ADDR, and <dev:part> defaults to ${bootdevice}.
Also fixing config macro usage for CONFIG_SUPPORT_EMMC_BOOT (suggested by checkpatch.pl).
--- cmd/mmc.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
cmd/mmc.c +19 -3
@@ -711,7 +711,7 @@ static int do_mmc_hwpartition(struct cmd_tbl *cmdtp, int flag, }#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )static int do_mmc_bootbus (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {
@@ -950,7 +950,7 @@ static struct cmd_tbl cmd_mmc[] = {#if CONFIG_IS_ENABLED (MMC_HW_PARTITIONING ) U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )U_BOOT_CMD_MKENT (bootbus,5 ,0 , do_mmc_bootbus,"" ,"" ),U_BOOT_CMD_MKENT (bootpart-resize,4 ,0 , do_mmc_boot_resize,"" ,"" ), U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""),
@@ -992,6 +992,14 @@ static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc,return cp->cmd (cmdtp, flag, argc, argv); } +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT ) +static int do_mmcboot (cmd_tbl_t *cmdtp,int flag,int argc, +char *const argv[]) +{ +return common_diskboot (cmdtp,"mmc" , argc, argv); +} +#endif + U_BOOT_CMD( mmc, 29, 1, do_mmcops, "MMC sub system",
@@ -1016,7 +1024,7 @@ U_BOOT_CMD(" WARNING: Partitioning is a write-once setting once it is set to complete.\n" " Power cycling is required to initialize partitions after set to complete.\n"#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )"mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n" " - Set the BOOT_BUS_WIDTH field of the specified device\n" "mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>\n"
@@ -1046,3 +1054,11 @@ U_BOOT_CMD("display MMC info" ,"- display info of the current MMC device" ); + +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT ) +U_BOOT_CMD ( + mmcboot,3 ,1 , do_mmcboot, +"boot from eMMC" , +"loadAddr dev:part" +); +#endif
Signature · 1 line
2.17.1
PATCH 1/1 cmd: mmc: add mmcboot command
Hi Ravik,
Quoted 11 lines · Ravik Hasija
Similar to usbboot, add command line to boot from raw mmc partition using
common_diskboot(), which supports legacy or FIT images.Usage:
mmcboot loadAaddr dev:partWhere <loadAddr> defaults to
CONFIG_SYS_LOAD_ADDR, and <dev:part> defaults to ${bootdevice}.Also fixing config macro usage for
CONFIG_SUPPORT_EMMC_BOOT(suggested by checkpatch.pl).
Could you check a build error?
Quoted 30 lines
Signed-off-by Ravik Hasija <[email protected]>Signed-off-by Dhananjay Phadke <[email protected]>--- cmd/mmc.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)cmd/mmc.c +2
-2@@ -711,7 +711,7 @@ static int do_mmc_hwpartition(struct cmd_tbl *cmdtp, int flag, }#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )static int do_mmc_bootbus (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {@@ -950,7 +950,7 @@ static struct cmd_tbl cmd_mmc[] = {#if CONFIG_IS_ENABLED (MMC_HW_PARTITIONING ) U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )U_BOOT_CMD_MKENT (bootbus,5 ,0 , do_mmc_bootbus,"" ,"" ),U_BOOT_CMD_MKENT (bootpart-resize,4 ,0 , do_mmc_boot_resize,"" ,"" ), U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""),
cmd/mmc.c static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc, · line 997
Quoted 6 lines
cmd/mmc.c +3
-0@@ -992,6 +992,14 @@ static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc,return cp->cmd (cmdtp, flag, argc, argv); } +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT ) +static int do_mmcboot (cmd_tbl_t *cmdtp,int flag,int argc, +char *const argv[])
cmd/mmc.c:996:23: error: unknown type name 'cmd_tbl_t'
996 | static int do_mmcboot(cmd_tbl_t *cmdtp, int flag, int argc,
| ^~~~~~~~~
cmd/mmc.c static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc, · line 999
Quoted 2 lines
cmd/mmc.c +2
-0+{ +return common_diskboot (cmdtp,"mmc" , argc, argv);
common_diskboot is depend on CONFIG_CMD_IDE, so i think that you have to enable CMD_IDE.
Quoted 16 lines
cmd/mmc.c +4
-1+} +#endif + U_BOOT_CMD( mmc, 29, 1, do_mmcops, "MMC sub system",@@ -1016,7 +1024,7 @@ U_BOOT_CMD(" WARNING: Partitioning is a write-once setting once it is set to complete.\n" " Power cycling is required to initialize partitions after set to complete.\n"#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )"mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n" " - Set the BOOT_BUS_WIDTH field of the specified device\n" "mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>\n"
cmd/mmc.c U_BOOT_CMD( · line 1062
Quoted 9 lines
cmd/mmc.c +6
-0@@ -1046,3 +1054,11 @@ U_BOOT_CMD("display MMC info" ,"- display info of the current MMC device" ); + +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT ) +U_BOOT_CMD ( + mmcboot,3 ,1 , do_mmcboot, +"boot from eMMC" , + "loadAddr dev:part"
Update the usage which arguments are optional or mandatory with <>, [].
Best Regards,
Jaehoon Chung
Quoted 3 lines
cmd/mmc.c +2
-0+); +#endif
PATCH 1/1 cmd: mmc: add mmcboot command
Quoted 12 lines · Jaehoon Chung
Hi Ravik,
Quoted 9 lines · Ravik Hasija
Similar to usbboot, add command line to boot from raw mmc partition using
common_diskboot(), which supports legacy or FIT images.Usage:
mmcboot loadAaddr dev:partWhere <loadAddr> defaults to
CONFIG_SYS_LOAD_ADDR, and <dev:part> defaults to ${bootdevice}.
Please, add a man-page under doc/usage/. You can use doc/usage/button.rst as template.
Best regards
Heinrich
Quoted 84 lines
Quoted 2 lines
Also fixing config macro usage for
CONFIG_SUPPORT_EMMC_BOOT(suggested by checkpatch.pl).Could you check a build error?
Quoted 30 lines
Signed-off-by Ravik Hasija <[email protected]>Signed-off-by Dhananjay Phadke <[email protected]>--- cmd/mmc.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)cmd/mmc.c +2
-2@@ -711,7 +711,7 @@ static int do_mmc_hwpartition(struct cmd_tbl *cmdtp, int flag, }#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )static int do_mmc_bootbus (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {@@ -950,7 +950,7 @@ static struct cmd_tbl cmd_mmc[] = {#if CONFIG_IS_ENABLED (MMC_HW_PARTITIONING ) U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )U_BOOT_CMD_MKENT (bootbus,5 ,0 , do_mmc_bootbus,"" ,"" ),U_BOOT_CMD_MKENT (bootpart-resize,4 ,0 , do_mmc_boot_resize,"" ,"" ), U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""),cmd/mmc.c static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc, · line 997
Quoted 6 lines
cmd/mmc.c +3
-0@@ -992,6 +992,14 @@ static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc,return cp->cmd (cmdtp, flag, argc, argv); } +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT ) +static int do_mmcboot (cmd_tbl_t *cmdtp,int flag,int argc, +char *const argv[])
cmd/mmc.c:996:23: error: unknown type name 'cmd_tbl_t'
996 | static int do_mmcboot(cmd_tbl_t *cmdtp, int flag, int argc,| ^~~~~~~~~cmd/mmc.c static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc, · line 999
Quoted 2 lines
cmd/mmc.c +2
-0+{ +return common_diskboot (cmdtp,"mmc" , argc, argv);
common_diskbootis depend onCONFIG_CMD_IDE, so i think that you have to enableCMD_IDE.Quoted 16 lines
cmd/mmc.c +4
-1+} +#endif + U_BOOT_CMD( mmc, 29, 1, do_mmcops, "MMC sub system",@@ -1016,7 +1024,7 @@ U_BOOT_CMD(" WARNING: Partitioning is a write-once setting once it is set to complete.\n" " Power cycling is required to initialize partitions after set to complete.\n"#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )"mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n" " - Set the BOOT_BUS_WIDTH field of the specified device\n" "mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>\n" cmd/mmc.c U_BOOT_CMD( · line 1062
Quoted 9 lines
cmd/mmc.c +6
-0@@ -1046,3 +1054,11 @@ U_BOOT_CMD("display MMC info" ,"- display info of the current MMC device" ); + +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT ) +U_BOOT_CMD ( + mmcboot,3 ,1 , do_mmcboot, +"boot from eMMC" , + "loadAddr dev:part"Update the usage which arguments are optional or mandatory with <>, [].
Quoted 3 lines
cmd/mmc.c +2
-0+); +#endif
PATCH 1/1 cmd: mmc: add mmcboot command
In reply to Ravik HasijaQuoted 10 lines · Ravik Hasija
Similar to usbboot, add command line to boot from raw mmc partition using
common_diskboot(), which supports legacy or FIT images.Usage:
mmcboot loadAaddr dev:partWhere <loadAddr> defaults to
CONFIG_SYS_LOAD_ADDR, and <dev:part> defaults to ${bootdevice}.
Quoted 9 lines
Also fixing config macro usage for
CONFIG_SUPPORT_EMMC_BOOT(suggested by checkpatch.pl).Signed-off-by Ravik Hasija <[email protected]>Signed-off-by Dhananjay Phadke <[email protected]>--- cmd/mmc.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
PATCH v2 1/1 cmd: mmc: add mmcboot command
In reply to Ravik HasijaSimilar to usbboot, add command line to boot from raw mmc partition using common_diskboot(), which supports legacy or FIT images.
Usage:
mmcboot [loadAaddr] [dev:part]
Where [loadAddr] defaults to CONFIG_SYS_LOAD_ADDR, and [dev:part] defaults to ${bootdevice}.
Also fixing config macro usage for CONFIG_SUPPORT_EMMC_BOOT (suggested by checkpatch.pl).
---
v2:
* Fixed build failure.
* Updated syntax of mmcboot cmd.
--- cmd/Makefile | 2 +- cmd/mmc.c | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-)
cmd/Makefile +1 -1
@@ -97,7 +97,7 @@ obj-$(CONFIG_CMD_MII) += mii.o obj-$(CONFIG_CMD_MISC) += misc.o obj-$(CONFIG_CMD_MDIO) += mdio.o obj-$(CONFIG_CMD_SLEEP) += sleep.o -obj-$(CONFIG_CMD_MMC) += mmc.o +obj-$(CONFIG_CMD_MMC) += mmc.o disk.o obj-$(CONFIG_CMD_OPTEE_RPMB) += optee_rpmb.o obj-$(CONFIG_MP) += mp.o obj-$(CONFIG_CMD_MTD) += mtd.o
cmd/mmc.c +19 -3
@@ -711,7 +711,7 @@ static int do_mmc_hwpartition(struct cmd_tbl *cmdtp, int flag, }#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )static int do_mmc_bootbus (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {
@@ -950,7 +950,7 @@ static struct cmd_tbl cmd_mmc[] = {#if CONFIG_IS_ENABLED (MMC_HW_PARTITIONING ) U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )U_BOOT_CMD_MKENT (bootbus,5 ,0 , do_mmc_bootbus,"" ,"" ),U_BOOT_CMD_MKENT (bootpart-resize,4 ,0 , do_mmc_boot_resize,"" ,"" ), U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""),
@@ -992,6 +992,14 @@ static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc,return cp->cmd (cmdtp, flag, argc, argv); } +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT ) +static int do_mmcboot (struct cmd_tbl *cmdtp,int flag,int argc, +char *const argv[]) +{ +return common_diskboot (cmdtp,"mmc" , argc, argv); +} +#endif + U_BOOT_CMD( mmc, 29, 1, do_mmcops, "MMC sub system",
@@ -1016,7 +1024,7 @@ U_BOOT_CMD(" WARNING: Partitioning is a write-once setting once it is set to complete.\n" " Power cycling is required to initialize partitions after set to complete.\n"#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )"mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n" " - Set the BOOT_BUS_WIDTH field of the specified device\n" "mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>\n"
@@ -1046,3 +1054,11 @@ U_BOOT_CMD("display MMC info" ,"- display info of the current MMC device" ); + +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT ) +U_BOOT_CMD ( + mmcboot,3 ,1 , do_mmcboot, +"boot from eMMC" , +"[loadAddr] [dev:part]" +); +#endif
Signature · 1 line
2.17.1
PATCH v2 1/1 cmd: mmc: add mmcboot command
Quoted 11 lines · Ravik Hasija
Similar to usbboot, add command line to boot from raw mmc partition using
common_diskboot(), which supports legacy or FIT images.Usage:
mmcboot [loadAaddr] [dev:part]Where [loadAddr] defaults to
CONFIG_SYS_LOAD_ADDR, and [dev:part] defaults to ${bootdevice}.Also fixing config macro usage for
CONFIG_SUPPORT_EMMC_BOOT(suggested by checkpatch.pl).
Can this not be implemented by some U-Boot script ?
I can imagine that reading the first few bytes from the partition (mmc read) would permit you to obtain the uImage/fitImage header from the partition, from which you can obtain the image size, which is the total number of bytes to read (iminfo might help , or fdt header), and then read out the entire image and bootm it.
PATCH v2 1/1 cmd: mmc: add mmcboot command
Quoted 6 lines
Can this not be implemented by some U-Boot script ?
I can imagine that reading the first few bytes from the partition (mmc read) would permit you to obtain the uImage/fitImage header from the partition, from which you can obtain the image size, which is the total number of bytes to read (iminfo might help , or fdt header), and then read out the entire image and bootm it.
Using this command provides the advantage to reduce code replication & maintainence by leveraging existing APIs (common_diskboot) which functionally does the same thing as a uboot script would do read one block, get size from header, read whole image, and bootm it, while additionally doing basic checks.
--
Sent from: http://u-boot.10912.n7.nabble.com/
PATCH v2 1/1 cmd: mmc: add mmcboot command
In reply to Ravik HasijaQuoted 30 lines · Ravik Hasija
Similar to usbboot, add command line to boot from raw mmc partition using
common_diskboot(), which supports legacy or FIT images.Usage:
mmcboot [loadAaddr] [dev:part]Where [loadAddr] defaults to
CONFIG_SYS_LOAD_ADDR, and [dev:part] defaults to ${bootdevice}.Also fixing config macro usage for
CONFIG_SUPPORT_EMMC_BOOT(suggested by checkpatch.pl).Signed-off-by Ravik Hasija <[email protected]>Signed-off-by Dhananjay Phadke <[email protected]>Reviewed-by Jaehoon Chung <[email protected]>Reviewed-by Simon Glass <[email protected]>---
v2:
* Fixed build failure.
* Updated syntax of mmcboot cmd.--- cmd/Makefile | 2 +- cmd/mmc.c | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-)cmd/Makefile +0
-0
cmd/Makefile obj-$(CONFIG_CMD_MII) += mii.o · line 100
Quoted 5 lines
cmd/Makefile +1
-1@@ -97,7 +97,7 @@ obj-$(CONFIG_CMD_MII) += mii.o obj-$(CONFIG_CMD_MISC) += misc.o obj-$(CONFIG_CMD_MDIO) += mdio.o obj-$(CONFIG_CMD_SLEEP) += sleep.o -obj-$(CONFIG_CMD_MMC) += mmc.o +obj-$(CONFIG_CMD_MMC) += mmc.o disk.o
I think that it's not good about building disk.c by default when CONFIG_CMD_MMC is enabled.
Best Regards,
Jaehoon Chung
Quoted 62 lines
cmd/Makefile +0
-0obj-$(CONFIG_CMD_OPTEE_RPMB) += optee_rpmb.o obj-$(CONFIG_MP) += mp.o obj-$(CONFIG_CMD_MTD) += mtd.ocmd/mmc.c +19
-3@@ -711,7 +711,7 @@ static int do_mmc_hwpartition(struct cmd_tbl *cmdtp, int flag, }#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )static int do_mmc_bootbus (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {@@ -950,7 +950,7 @@ static struct cmd_tbl cmd_mmc[] = {#if CONFIG_IS_ENABLED (MMC_HW_PARTITIONING ) U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )U_BOOT_CMD_MKENT (bootbus,5 ,0 , do_mmc_bootbus,"" ,"" ),U_BOOT_CMD_MKENT (bootpart-resize,4 ,0 , do_mmc_boot_resize,"" ,"" ), U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""),@@ -992,6 +992,14 @@ static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc,return cp->cmd (cmdtp, flag, argc, argv); } +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT ) +static int do_mmcboot (struct cmd_tbl *cmdtp,int flag,int argc, +char *const argv[]) +{ +return common_diskboot (cmdtp,"mmc" , argc, argv); +} +#endif + U_BOOT_CMD( mmc, 29, 1, do_mmcops, "MMC sub system",@@ -1016,7 +1024,7 @@ U_BOOT_CMD(" WARNING: Partitioning is a write-once setting once it is set to complete.\n" " Power cycling is required to initialize partitions after set to complete.\n"#endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT )"mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n" " - Set the BOOT_BUS_WIDTH field of the specified device\n" "mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>\n" @@ -1046,3 +1054,11 @@ U_BOOT_CMD("display MMC info" ,"- display info of the current MMC device" ); + +#if CONFIG_IS_ENABLED (SUPPORT_EMMC_BOOT ) +U_BOOT_CMD ( + mmcboot,3 ,1 , do_mmcboot, +"boot from eMMC" , +"[loadAddr] [dev:part]" +); +#endif
PATCH v2 1/1 cmd: mmc: add mmcboot command
Quoted 1 line
I think that it's not good about building
disk.cby default when
CONFIG_CMD_MMC is enabled.
Agree, its not an optimal solution. However, we chose to do it this way because:
- It causes minimal change to the size of binary (~200 bytes).
- To be consistent with upstream code where it is built similarly for usb/scsi etc.
--
Sent from: http://u-boot.10912.n7.nabble.com/