summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoy Cho <joy.cho@hardkernel.com>2020-11-28 15:09:38 +0300
committerJoy Cho <joy.cho@hardkernel.com>2020-12-02 10:35:30 +0300
commit17a421dc6e3ccea5e71392f0f7d268ea278e27ab (patch)
tree51641c9acacc69343a69dd36c80168545c6b3a3d
parentac38b3f81d20b551eef5c230d7e87e7d5058e561 (diff)
downloadu-boot-17a421dc6e3ccea5e71392f0f7d268ea278e27ab.tar.xz
ODROID-GOA: recovery: Update image layout to support all OGA
Change-Id: Id2320ddc3916603b22521090e563c78a05417507
-rw-r--r--arch/arm/mach-rockchip/board.c43
-rw-r--r--board/rockchip/odroidgoa/odroidgoa_status.c29
-rwxr-xr-xbuild_recovery.sh66
-rw-r--r--include/configs/odroidgoa.h7
4 files changed, 97 insertions, 48 deletions
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index ce3967c00c..30c994abf4 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -308,6 +308,44 @@ void board_check_hwrev(void)
run_command("hwrev", 0);
}
+void board_set_spilayout(void)
+{
+ char *hwrev = env_get("hwrev");
+
+ /* adjust only offsets, size values are same */
+ if (!strcmp(hwrev, "v10-go3")) {
+ /* GO3 rev1.0 */
+ env_set_hex("st_dtb", 0x3068);
+
+ env_set_hex("st_logo_hardkernel", 0x3130);
+ env_set_hex("st_logo_lowbatt", 0x32C0);
+ env_set_hex("st_logo_recovery", 0x3450);
+ env_set_hex("st_logo_err", 0x35E0);
+ env_set_hex("st_logo_nosdcard", 0x3770);
+
+ env_set_hex("st_battery_0", 0x3900);
+ env_set_hex("st_battery_1", 0x3A90);
+ env_set_hex("st_battery_2", 0x3C20);
+ env_set_hex("st_battery_3", 0x3DB0);
+ env_set_hex("st_battery_fail", 0x3F40);
+ } else {
+ /* GO2 rev1.0/rev1.1 */
+ env_set_hex("st_dtb", 0x2000);
+
+ env_set_hex("st_logo_hardkernel", 0x20C8);
+ env_set_hex("st_logo_lowbatt", 0x2258);
+ env_set_hex("st_logo_recovery", 0x23E8);
+ env_set_hex("st_logo_err", 0x2578);
+ env_set_hex("st_logo_nosdcard", 0x2708);
+
+ env_set_hex("st_battery_0", 0x2898);
+ env_set_hex("st_battery_1", 0x2A28);
+ env_set_hex("st_battery_2", 0x2BB8);
+ env_set_hex("st_battery_3", 0x2D48);
+ env_set_hex("st_battery_fail", 0x2ED8);
+ }
+}
+
int init_kernel_dtb(void)
{
ulong fdt_addr;
@@ -316,6 +354,9 @@ int init_kernel_dtb(void)
/* check hw revision */
board_check_hwrev();
+ /* adjust offsets of spi flash layout */
+ board_set_spilayout();
+
fdt_addr = env_get_ulong("fdt_addr_r", 16, 0);
if (!fdt_addr) {
printf("No Found FDT Load Address.\n");
@@ -330,7 +371,7 @@ int init_kernel_dtb(void)
printf("dtb in resource read fail, try dtb in spi flash\n");
run_command("rksfc scan", 0);
run_command("rksfc dev 1", 0);
- ret = run_command("rksfc read ${fdt_addr_r} 0x2000 0xC8", 0);
+ ret = run_command("rksfc read ${fdt_addr_r} ${st_dtb} ${sz_dtb}", 0);
if (ret == CMD_RET_SUCCESS)
ret = check_fdt_header(fdt_addr);
}
diff --git a/board/rockchip/odroidgoa/odroidgoa_status.c b/board/rockchip/odroidgoa/odroidgoa_status.c
index 448e1da4c0..f8268303ad 100644
--- a/board/rockchip/odroidgoa/odroidgoa_status.c
+++ b/board/rockchip/odroidgoa/odroidgoa_status.c
@@ -21,6 +21,7 @@
#define PMUGRF_BASE 0xFF010000
extern unsigned char disp_offs;
+extern bool is_odroidgo3(void);
static const char *st_logo_modes[] = {
"st_logo_hardkernel",
@@ -31,11 +32,11 @@ static const char *st_logo_modes[] = {
};
static const char *logo_bmp_names[] = {
- "logo.bmp",
- "low_battery.bmp",
- "recovery.bmp",
- "system_error.bmp",
- "no_sdcard.bmp",
+ "logo",
+ "low_battery",
+ "recovery",
+ "system_error",
+ "no_sdcard",
};
unsigned long bmp_mem;
@@ -145,8 +146,13 @@ int odroid_display_status(int logo_mode, int logo_storage, const char *str)
printf("[%s] show_bmp Fail!\n", __func__);
break;
case LOGO_STORAGE_SDCARD:
- sprintf(cmd, "fatload mmc 1:1 %p %s", (void *)bmp_mem,
- logo_bmp_names[logo_mode]);
+ if (is_odroidgo3())
+ sprintf(cmd, "fatload mmc 1:1 %p %s_b.bmp", (void *)bmp_mem,
+ logo_bmp_names[logo_mode]);
+ else
+ sprintf(cmd, "fatload mmc 1:1 %p %s.bmp", (void *)bmp_mem,
+ logo_bmp_names[logo_mode]);
+
run_command(cmd, 0);
if (show_bmp(bmp_mem))
@@ -165,8 +171,13 @@ int odroid_display_status(int logo_mode, int logo_storage, const char *str)
if (show_bmp(bmp_mem)) {
/* then, check sd card */
- sprintf(cmd, "fatload mmc 1:1 %p %s", (void *)bmp_mem,
- logo_bmp_names[logo_mode]);
+ if (is_odroidgo3())
+ sprintf(cmd, "fatload mmc 1:1 %p %s_b.bmp", (void *)bmp_mem,
+ logo_bmp_names[logo_mode]);
+ else
+ sprintf(cmd, "fatload mmc 1:1 %p %s.bmp", (void *)bmp_mem,
+ logo_bmp_names[logo_mode]);
+
run_command(cmd, 0);
if (show_bmp(bmp_mem))
diff --git a/build_recovery.sh b/build_recovery.sh
index 8fb3abfde5..e19d532ee0 100755
--- a/build_recovery.sh
+++ b/build_recovery.sh
@@ -9,40 +9,21 @@ PWD=$(pwd)
IMAGES=./tools/images/hardkernel
OUT=./sd_fuse
MNT=${PWD}/sd_fuse/mnt
-BOARD=$1
-
-if [ -z $1 ]; then
- echo "Usage ./build_recovery.sh <board_name>"
- exit 1
-fi
pack_spi_full_image()
{
- dd if=/dev/zero of=${OUT}/spi_recovery.img bs=512 count=12392 conv=fsync,notrunc
+ gzip -k -f ${IMAGES}/*.bmp
+
+ dd if=/dev/zero of=${OUT}/spi_recovery.img bs=512 count=16592 conv=fsync,notrunc
+ # mbr, uboot and trust
dd if=${OUT}/rk3326_header_miniloader_spiboot.img of=${OUT}/spi_recovery.img bs=512 seek=0 count=2048 conv=fsync,notrunc
dd if=${OUT}/uboot_spi.img of=${OUT}/spi_recovery.img bs=512 seek=2048 count=2048 conv=fsync,notrunc
dd if=${OUT}/trust_spi.img of=${OUT}/spi_recovery.img bs=512 seek=4096 count=4096 conv=fsync,notrunc
-if [ ${BOARD} = "odroidgo3" ]; then
- dd if=./arch/arm/dts/odroidgo3-kernel.dtb of=${OUT}/spi_recovery.img bs=512 seek=8192 count=200 conv=fsync,notrunc
-else
+ # ODROID-GO2 dtb
dd if=./arch/arm/dts/odroidgo2-kernel-v11.dtb of=${OUT}/spi_recovery.img bs=512 seek=8192 count=200 conv=fsync,notrunc
-fi
- gzip -k -f ${IMAGES}/*.bmp
-if [ ${BOARD} = "odroidgo3" ]; then
- dd if=${IMAGES}/logo_hardkernel_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=8392 conv=fsync,notrunc
- dd if=${IMAGES}/low_battery_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=8792 conv=fsync,notrunc
- dd if=${IMAGES}/recovery_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=9192 conv=fsync,notrunc
- dd if=${IMAGES}/system_error_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=9592 conv=fsync,notrunc
- dd if=${IMAGES}/no_sdcard_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=9992 conv=fsync,notrunc
-
- dd if=${IMAGES}/battery_0_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=10392 conv=fsync,notrunc
- dd if=${IMAGES}/battery_1_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=10792 conv=fsync,notrunc
- dd if=${IMAGES}/battery_2_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=11192 conv=fsync,notrunc
- dd if=${IMAGES}/battery_3_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=11592 conv=fsync,notrunc
- dd if=${IMAGES}/battery_fail_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=11992 conv=fsync,notrunc
-else
+ # ODROID-GO2 bmp images
dd if=${IMAGES}/logo_hardkernel.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=8392 conv=fsync,notrunc
dd if=${IMAGES}/low_battery.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=8792 conv=fsync,notrunc
dd if=${IMAGES}/recovery.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=9192 conv=fsync,notrunc
@@ -54,7 +35,22 @@ else
dd if=${IMAGES}/battery_2.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=11192 conv=fsync,notrunc
dd if=${IMAGES}/battery_3.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=11592 conv=fsync,notrunc
dd if=${IMAGES}/battery_fail.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=11992 conv=fsync,notrunc
-fi
+
+ # ODROID-GO3 dtb
+ dd if=./arch/arm/dts/odroidgo3-kernel.dtb of=${OUT}/spi_recovery.img bs=512 seek=12392 count=200 conv=fsync,notrunc
+ # ODROID-GO3 bmp images
+ dd if=${IMAGES}/logo_hardkernel_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=12592 conv=fsync,notrunc
+ dd if=${IMAGES}/low_battery_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=12992 conv=fsync,notrunc
+ dd if=${IMAGES}/recovery_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=13392 conv=fsync,notrunc
+ dd if=${IMAGES}/system_error_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=13792 conv=fsync,notrunc
+ dd if=${IMAGES}/no_sdcard_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=14192 conv=fsync,notrunc
+
+ dd if=${IMAGES}/battery_0_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=14592 conv=fsync,notrunc
+ dd if=${IMAGES}/battery_1_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=14992 conv=fsync,notrunc
+ dd if=${IMAGES}/battery_2_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=15392 conv=fsync,notrunc
+ dd if=${IMAGES}/battery_3_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=15792 conv=fsync,notrunc
+ dd if=${IMAGES}/battery_fail_b.bmp.gz of=${OUT}/spi_recovery.img bs=512 seek=16192 conv=fsync,notrunc
+
rm ${IMAGES}/*.bmp.gz
md5sum ${OUT}/spi_recovery.img > ${OUT}/spi_recovery.img.md5sum
@@ -71,20 +67,22 @@ pack_recovery_sdcard_img()
sudo mount ${OUT}/vfat.fs ${MNT}
sudo cp ${OUT}/spi_recovery.img* ${MNT}
-if [ ${BOARD} = "odroidgo3" ]; then
- sudo cp ${IMAGES}/recovery_b.bmp ${MNT}/recovery.bmp
- sudo cp ${IMAGES}/system_error_b.bmp ${MNT}/system_error.bmp
- sudo cp ${IMAGES}/no_sdcard_b.bmp ${MNT}/no_sdcard.bmp
- sudo cp ${IMAGES}/low_battery_b.bmp ${MNT}/low_battery.bmp
- sudo cp ./arch/arm/dts/odroidgo3-kernel.dtb ${MNT}/rk3326-odroidgo3-linux.dtb
-else
+
+ # ODROID-GO2 rev1.0/rev1.1
sudo cp ${IMAGES}/recovery.bmp ${MNT}
sudo cp ${IMAGES}/system_error.bmp ${MNT}
sudo cp ${IMAGES}/no_sdcard.bmp ${MNT}
sudo cp ${IMAGES}/low_battery.bmp ${MNT}
sudo cp ./arch/arm/dts/odroidgo2-kernel.dtb ${MNT}/rk3326-odroidgo2-linux.dtb
sudo cp ./arch/arm/dts/odroidgo2-kernel-v11.dtb ${MNT}/rk3326-odroidgo2-linux-v11.dtb
-fi
+
+ # ODROID-GO3 rev1.0
+ sudo cp ${IMAGES}/recovery_b.bmp ${MNT}
+ sudo cp ${IMAGES}/system_error_b.bmp ${MNT}
+ sudo cp ${IMAGES}/no_sdcard_b.bmp ${MNT}
+ sudo cp ${IMAGES}/low_battery_b.bmp ${MNT}
+ sudo cp ./arch/arm/dts/odroidgo3-kernel.dtb ${MNT}/rk3326-odroidgo3-linux.dtb
+
sync
sudo umount ${MNT}
diff --git a/include/configs/odroidgoa.h b/include/configs/odroidgoa.h
index 00b7a89c27..44789998d6 100644
--- a/include/configs/odroidgoa.h
+++ b/include/configs/odroidgoa.h
@@ -30,8 +30,8 @@
"devnum=1\0"
#endif
-/* FIXME */
-/* default env of spi flash layout */
+/* default env of spi flash layout,
+ * set active offsets in mach-rockchip/board.c */
#define SPI_FLASH_LAYOUT \
"st_boot1=0x0\0" \
"sz_boot1=0x800\0" \
@@ -52,7 +52,7 @@
"st_battery_2=0x2BB8\0" \
"st_battery_3=0x2D48 \0" \
"st_battery_fail=0x2ED8\0" \
- "sz_total=0x3068\0"
+ "sz_total=0x40D0\0"
#define ROCKCHIP_DEVICE_SETTINGS \
"stdout=serial,vidconsole\0" \
@@ -67,7 +67,6 @@
#define CONFIG_BOOTCOMMAND RKIMG_BOOTCOMMAND
#endif
-/* FIXME */
#undef CONFIG_EXTRA_ENV_SETTINGS
#define CONFIG_EXTRA_ENV_SETTINGS \
"fdt_addr_r=0x01f00000\0" \