From a81a650cac50d4eeb6290f770e362de3caec135d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Apr 2022 10:51:16 +0800 Subject: [PATCH 1/2] Signed-off-by: hughes802 --- .../board/hisilicon/hi3516dv300/hi3516dv300.c | 12 +++++++++--- u-boot-2020.01/common/image.c | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/u-boot-2020.01/board/hisilicon/hi3516dv300/hi3516dv300.c b/u-boot-2020.01/board/hisilicon/hi3516dv300/hi3516dv300.c index 1608f04899..c21eda9e3f 100755 --- a/u-boot-2020.01/board/hisilicon/hi3516dv300/hi3516dv300.c +++ b/u-boot-2020.01/board/hisilicon/hi3516dv300/hi3516dv300.c @@ -504,12 +504,12 @@ int EmmcInitParam(void) // get "boot_updater" string in misc,then s "2M(misc),3307M(system),256M(vendor),-(userdata)"; const char updaterHead[] = "mem=640M console=ttyAMA0,115200 mmz=anonymous,0,0xA8000000,384M clk_ignore_unused " "androidboot.selinux=permissive skip_initramfs " - "rootdelay=10 hardware=Hi3516DV300 default_boot_device=soc/10100000.himci.eMMC init=/init root=/dev/mmcblk0p3 " - "rootfstype=ext4 rw blkdevparts="; + "rootdelay=10 hardware=Hi3516DV300 default_boot_device=soc/10100000.himci.eMMC init=/init root=/dev/ram0 " + "blkdevparts="; const char defaultUpdaterStr[] = "mem=640M console=ttyAMA0,115200 mmz=anonymous,0,0xA8000000,384M " "clk_ignore_unused androidboot.selinux=permissive skip_initramfs rootdelay=10 hardware=Hi3516DV300 " "default_boot_device=soc/10100000.himci.eMMC init=/init " - "root=/dev/mmcblk0p3 rootfstype=ext4 rw blkdevparts=mmcblk0:1M(boot),15M(kernel),20M(updater)," + "root=/dev/ram0 blkdevparts=mmcblk0:1M(boot),15M(kernel),20M(updater)," "2M(misc),3307M(system),256M(vendor),-(userdata)"; char block2[EMMC_SECTOR_SIZE*EMMC_SECTOR_CNT]; if (BlkDevRead(block2, MISC_LOCATION*(M_1/EMMC_SECTOR_SIZE), EMMC_SECTOR_CNT) < 0) { @@ -691,8 +691,14 @@ int misc_init_r(void) ChangeBootArgs(); + // 0x80000000: boot img load addr; 0x84000000: updater img load addr + const char updater_cmdBuf[] = "mmc read 0x0 0x80000000 0x800 0x4800; mmc read 0x0 0x84000000 0x8000 0xB000; " + "bootm 0x80000000"; env_set("bootargs", g_bootArgsStr); env_set("bootcmd", cmdBuf); + if (g_isRecovery) { + env_set("bootcmd", updater_cmdBuf); + } /* auto update flag */ if (is_auto_update()) diff --git a/u-boot-2020.01/common/image.c b/u-boot-2020.01/common/image.c index 617f5f7164..c50e31bf1b 100644 --- a/u-boot-2020.01/common/image.c +++ b/u-boot-2020.01/common/image.c @@ -1205,7 +1205,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, images->fit_uname_rd = fit_uname_ramdisk; images->fit_noffset_rd = rd_noffset; - if (!EmmcInitParam()){ + if (EmmcInitParam() >= 0){ if(fit_change_bootargs(rd_data, rd_len)) printf("Error additional bootargs fail!\n"); } -- Gitee From 37d69b53406e79f2f7c51415d384eca9ef046738 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Apr 2022 10:51:16 +0800 Subject: [PATCH 2/2] Signed-off-by: hughes802 --- .../board/hisilicon/hi3516dv300/hi3516dv300.c | 12 +++++++++--- u-boot-2020.01/common/image.c | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/u-boot-2020.01/board/hisilicon/hi3516dv300/hi3516dv300.c b/u-boot-2020.01/board/hisilicon/hi3516dv300/hi3516dv300.c index 1608f04899..335629e18f 100755 --- a/u-boot-2020.01/board/hisilicon/hi3516dv300/hi3516dv300.c +++ b/u-boot-2020.01/board/hisilicon/hi3516dv300/hi3516dv300.c @@ -504,12 +504,12 @@ int EmmcInitParam(void) // get "boot_updater" string in misc,then s "2M(misc),3307M(system),256M(vendor),-(userdata)"; const char updaterHead[] = "mem=640M console=ttyAMA0,115200 mmz=anonymous,0,0xA8000000,384M clk_ignore_unused " "androidboot.selinux=permissive skip_initramfs " - "rootdelay=10 hardware=Hi3516DV300 default_boot_device=soc/10100000.himci.eMMC init=/init root=/dev/mmcblk0p3 " - "rootfstype=ext4 rw blkdevparts="; + "rootdelay=10 hardware=Hi3516DV300 default_boot_device=soc/10100000.himci.eMMC init=/init root=/dev/ram0 " + "blkdevparts="; const char defaultUpdaterStr[] = "mem=640M console=ttyAMA0,115200 mmz=anonymous,0,0xA8000000,384M " "clk_ignore_unused androidboot.selinux=permissive skip_initramfs rootdelay=10 hardware=Hi3516DV300 " "default_boot_device=soc/10100000.himci.eMMC init=/init " - "root=/dev/mmcblk0p3 rootfstype=ext4 rw blkdevparts=mmcblk0:1M(boot),15M(kernel),20M(updater)," + "root=/dev/ram0 blkdevparts=mmcblk0:1M(boot),15M(kernel),20M(updater)," "2M(misc),3307M(system),256M(vendor),-(userdata)"; char block2[EMMC_SECTOR_SIZE*EMMC_SECTOR_CNT]; if (BlkDevRead(block2, MISC_LOCATION*(M_1/EMMC_SECTOR_SIZE), EMMC_SECTOR_CNT) < 0) { @@ -691,8 +691,14 @@ int misc_init_r(void) ChangeBootArgs(); + // 0x80000000: boot img load addr; 0x84000000: updater img load addr + const char updater_cmdBuf[] = "mmc read 0x0 0x80000000 0x800 0x4800; mmc read 0x0 0x84000000 0x8000 0xB000; " + "bootm 0x80000000 0x84000000"; env_set("bootargs", g_bootArgsStr); env_set("bootcmd", cmdBuf); + if (g_isRecovery) { + env_set("bootcmd", updater_cmdBuf); + } /* auto update flag */ if (is_auto_update()) diff --git a/u-boot-2020.01/common/image.c b/u-boot-2020.01/common/image.c index 617f5f7164..c50e31bf1b 100644 --- a/u-boot-2020.01/common/image.c +++ b/u-boot-2020.01/common/image.c @@ -1205,7 +1205,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, images->fit_uname_rd = fit_uname_ramdisk; images->fit_noffset_rd = rd_noffset; - if (!EmmcInitParam()){ + if (EmmcInitParam() >= 0){ if(fit_change_bootargs(rd_data, rd_len)) printf("Error additional bootargs fail!\n"); } -- Gitee