summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke go <sangch.go@gmail.com>2021-07-19 11:03:25 +0300
committerDongjin Kim <tobetter@gmail.com>2021-12-11 12:24:03 +0300
commitdde526ccf457d8fba53b00a035ec22df155f9e54 (patch)
treee21a73837cd8f9210ed9298dee2bdfe979bd7d7a
parent1bac869447532c26f53e5e4e2ea930a8922fa50f (diff)
downloadu-boot-dde526ccf457d8fba53b00a035ec22df155f9e54.tar.xz
ODROID-COMMON: add setbootdev command.
- On the rockchip chip, boot device discriptor is fixed on boot time. But ODROID-M1 have to change the boot device discriptor. So add new command to change boot device discriptor, 'setbootdev'. Change-Id: I60065e0e69503c03b32f52de1d2f4ec515e1381f
-rw-r--r--cmd/Makefile2
-rw-r--r--cmd/setbootdev.c27
2 files changed, 29 insertions, 0 deletions
diff --git a/cmd/Makefile b/cmd/Makefile
index 6c481810a9..ed11613d8e 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -178,6 +178,8 @@ obj-$(CONFIG_CMD_BLOB) += blob.o
obj-$(CONFIG_ARCH_ROCKCHIP) += rkimgtest.o
obj-$(CONFIG_CMD_ATAGS) += atags.o
+obj-$(CONFIG_TARGET_ODROID_M1) += setbootdev.o
+
endif # !CONFIG_SPL_BUILD
# core command
diff --git a/cmd/setbootdev.c b/cmd/setbootdev.c
new file mode 100644
index 0000000000..8b49fb340f
--- /dev/null
+++ b/cmd/setbootdev.c
@@ -0,0 +1,27 @@
+#include <common.h>
+#include <boot_rkimg.h>
+
+static int do_setbootdev(cmd_tbl_t *cmdtp, int flag,
+ int argc, char *const argv[])
+{
+ struct blk_desc *dev_desc;
+
+ if (argc != 3)
+ return CMD_RET_USAGE;
+
+ dev_desc = blk_get_dev(argv[1], simple_strtoul(argv[2], NULL, 16));
+ if (!dev_desc) {
+ printf("%s: dev_desc is NULL.\n", __func__);
+ return CMD_RET_FAILURE;
+ }
+
+ rockchip_set_bootdev(dev_desc);
+
+ return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(
+ setbootdev, 3, 0, do_setbootdev,
+ "Set bootting device descriptor",
+ "<devtype> <devnum>"
+);