diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index 9de0332d9c6..2689533294f 100755 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -96,12 +96,9 @@ void set_board_info(void) #if defined(CONFIG_TARGET_ODROID_XU4) || defined(CONFIG_TARGET_ODROID_XU3) /* save board_name for select dtb */ - if (!strncmp("xu3-lite" , bdtype, 8)) - setenv("board_name", "xu3l"); - else if (!strncmp("xu3", bdtype, 3)) - setenv("board_name", "xu3"); - else - setenv("board_name", "xu4"); + setenv("board_name", "xu4"); + if (!strncmp("xu3", bdtype, 3)) + setenv("board_name", bdtype); /* save board_id_value (adc value) */ { diff --git a/cmd/cfgload.c b/cmd/cfgload.c index dae4f6f10bd..e05187858f2 100755 --- a/cmd/cfgload.c +++ b/cmd/cfgload.c @@ -9,139 +9,48 @@ #include #include #include -#include /* isalpha, isdigit */ #include -#ifdef CONFIG_SYS_HUSH_PARSER -#include -#endif - -#if defined(CONFIG_TARGET_ODROID_XU4) -#define BOOTINI_MAGIC "ODROIDXU-UBOOT-CONFIG" -#else -#error 'BOOTINI_MAGIC' is missing!!! -#endif - -#define SZ_BOOTINI SZ_64K - -/* Nothing to proceed with zero size string or comment. - * - * FIXME: Do we really need to strip the line start with '#' or ';', - * since any U-boot command does not start with punctuation character. - */ -static int valid_command(const char* p) -{ - char *q; - - for (q = (char*)p; *q; q++) { - if (isblank(*q)) continue; - if (isalnum(*q)) return 1; - if (ispunct(*q)) - return (*q != '#') && (*q != ';'); - } - - return !(p == q); -} - -/* Read boot.ini from FAT partition - */ -static char* read_cfgload(void) -{ - char msg[128] = { 0, }; - unsigned long filesize; - char *p; - - p = (char *)simple_strtoul(getenv("loadaddr"), NULL, 16); - if (NULL == p) { - p = (char *)CONFIG_SYS_LOAD_ADDR; - sprintf(msg, "%x", CONFIG_SYS_LOAD_ADDR); - setenv("loadaddr", msg); - } - - setenv("filesize", "0"); - sprintf(msg, "cfgload addr = 0x%08X, Loading boot.ini from ", - simple_strtoul(getenv("loadaddr"), NULL, 16)); - - setenv("msgload", msg); - run_command("if fatload mmc 0:1 ${loadaddr} boot.ini;" \ - " then echo ${msgload} FAT;" \ - " else if ext4load mmc 0:1 ${loadaddr} /boot.ini;" \ - " then echo ${msgload} ext4 0:1 /boot.ini;" \ - " else if ext4load mmc 0:1 ${loadaddr} /boot/boot.ini;" \ - " then echo ${msgload} ext4 0:1 /boot/boot.ini;" \ - " else if ext4load mmc 0:2 ${loadaddr} /boot/boot.ini;" \ - " then echo ${msgload} ext4 0:2 /boot.ini;" \ - " else if ext4load mmc 0:2 ${loadaddr} /boot.ini;" \ - " then echo ${msgload} ext4 0:2 /boot/boot.ini;" \ - " fi;fi;fi;fi;fi;", 0); - - filesize = getenv_ulong("filesize", 16, 0); - if (0 == filesize) { - printf("cfgload: no boot.ini or empty file\n"); - return NULL; - } - - if (filesize > SZ_BOOTINI) { - printf("boot.ini: 'boot.ini' exceeds %d, size=%ld\n", - SZ_BOOTINI, filesize); - return NULL; - } - - /* Terminate the read buffer with '\0' to be treated as string */ - *(char *)(p + filesize) = '\0'; - - /* Scan MAGIC string, readed boot.ini must start with exact magic string. - * Otherwise, we will not proceed at all. - */ - while (*p) { - char *s = strsep(&p, "\n"); - if (!valid_command(s)) - continue; - - /* MAGIC string is discovered, return the buffer address of next to - * proceed the commands. - */ - if (!strncmp(s, BOOTINI_MAGIC, sizeof(BOOTINI_MAGIC))) - return memcpy(malloc(filesize), p, filesize); - } - - printf("cfgload: MAGIC NAME, %s, is not found!!\n", BOOTINI_MAGIC); - - return NULL; -} - static int do_load_cfgload(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) { - char *p; - char *cmd; - - p = read_cfgload(); - if (NULL == p) - return 0; - - printf("cfgload: applying boot.ini...\n"); - - while (p) { - cmd = strsep(&p, "\n"); - if (!valid_command(cmd)) - continue; - - printf("cfgload: %s\n", cmd); + int i, n, devno = 0; + char* scripts[] = { + "/boot.ini", + "/boot/boot.ini", + "/boot.scr", + }; + + ulong addr; + char cmd[1024]; + + if (argc < 2) { + addr = CONFIG_SYS_LOAD_ADDR; + debug ("* cfgload: default load address = 0x%08lx\n", addr); + } else { + addr = simple_strtoul(argv[1], NULL, 16); + debug ("* cfgload: cmdline image address = 0x%08lx\n", addr); + } -#ifndef CONFIG_SYS_HUSH_PARSER - run_command(cmd, 0); -#else - parse_string_outer(cmd, FLAG_PARSE_SEMICOLON - | FLAG_EXIT_FROM_LOOP); -#endif + setenv("devtype", "mmc"); + setenv("devnum", simple_itoa(devno)); + setenv("devno", simple_itoa(devno)); + + for (i = 1; i <= 2; i++) { + setenv("partition", simple_itoa(i)); + for (n = 0; n < ARRAY_SIZE(scripts); n++) { + snprintf(cmd, sizeof(cmd), + "load mmc %d:%d 0x%08lx %s; source 0x%08lx", + devno, i, addr, scripts[n], addr); + run_command(cmd, 0); + } } - return 0; + return 1; } U_BOOT_CMD( - cfgload, 1, 0, do_load_cfgload, + cfgload, 2, 0, do_load_cfgload, "read 'boot.ini' from FAT partiton", "\n" " - read boot.ini from the first partiton treated as FAT partiton" diff --git a/cmd/source.c b/cmd/source.c index db7ab7e5f40..da23a044a22 100644 --- a/cmd/source.c +++ b/cmd/source.c @@ -26,6 +26,25 @@ #include #endif +#if defined(CONFIG_TARGET_ODROID_XU3) || defined(CONFIG_TARGET_ODROID_XU4) +#include + +static +int check_odroid_script(ulong addr, char *product) +{ + int i; + char *buf; + char magic[32]; + int size = snprintf(magic, sizeof(magic), "%s-uboot-config", product); + + buf = map_sysmem(addr, 0); + if (strncasecmp(magic, buf, size)) + return -EINVAL; + + return size; +} +#endif + int source (ulong addr, const char *fit_uname) { @@ -42,6 +61,9 @@ source (ulong addr, const char *fit_uname) const void *fit_data; size_t fit_len; #endif +#if defined(CONFIG_TARGET_ODROID_XU3) || defined(CONFIG_TARGET_ODROID_XU4) + int size; +#endif verify = getenv_yesno ("verify"); @@ -133,8 +155,19 @@ source (ulong addr, const char *fit_uname) break; #endif default: +#if defined(CONFIG_TARGET_ODROID_XU3) || defined(CONFIG_TARGET_ODROID_XU4) + size = check_odroid_script(addr, "ODROIDXU"); + if (size > 0) { + data = (u32*)(addr + size); + len = simple_strtoul(getenv("filesize"), NULL, 16) - size; + } else { + puts ("Wrong image format for \"source\" command\n"); + return 1; + } +#else puts ("Wrong image format for \"source\" command\n"); return 1; +#endif } debug ("** Script length: %ld\n", len); diff --git a/configs/odroid-xu3_defconfig b/configs/odroid-xu3_defconfig index dab4cc14433..2b3a94d71a1 100644 --- a/configs/odroid-xu3_defconfig +++ b/configs/odroid-xu3_defconfig @@ -47,3 +47,4 @@ CONFIG_G_DNL_VENDOR_NUM=0x04e8 CONFIG_G_DNL_PRODUCT_NUM=0x6601 CONFIG_VIDEO_BRIDGE=y CONFIG_ERRNO_STR=y +CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/odroid-xu4_defconfig b/configs/odroid-xu4_defconfig index 9f4cae39c54..2e6ae1f9598 100644 --- a/configs/odroid-xu4_defconfig +++ b/configs/odroid-xu4_defconfig @@ -913,7 +913,7 @@ CONFIG_MD5=y # CONFIG_LZ4 is not set CONFIG_ERRNO_STR=y CONFIG_OF_LIBFDT=y -# CONFIG_OF_LIBFDT_OVERLAY is not set +CONFIG_OF_LIBFDT_OVERLAY=y # CONFIG_SPL_OF_LIBFDT is not set # CONFIG_FDT_FIXUP_PARTITIONS is not set diff --git a/include/configs/odroid_xu3.h b/include/configs/odroid_xu3.h index 40b48f70abf..210e7af579f 100644 --- a/include/configs/odroid_xu3.h +++ b/include/configs/odroid_xu3.h @@ -125,4 +125,5 @@ "dfu_alt_system="CONFIG_DFU_ALT_SYSTEM \ "dfu_alt_info=Autoset by THOR/DFU command run.\0" +#define CONFIG_CMD_INI #endif /* __CONFIG_H */ diff --git a/include/configs/odroid_xu4.h b/include/configs/odroid_xu4.h index 29ddaea2121..97c4308fad6 100755 --- a/include/configs/odroid_xu4.h +++ b/include/configs/odroid_xu4.h @@ -251,4 +251,6 @@ "hdmi_phy_res=720p60hz edid=0, hpd=1 disable_vu7=false " \ "touch_invert_x=false touch_invert_y=false" + +#define CONFIG_CMD_INI #endif /* __CONFIG_H */ diff --git a/scripts/check-config.sh b/scripts/check-config.sh index 97e52dce83d..f117e4bfe9c 100755 --- a/scripts/check-config.sh +++ b/scripts/check-config.sh @@ -37,14 +37,13 @@ cat `find ${srctree} -name "Kconfig*"` |sed -n \ -e 's/^menuconfig \([A-Za-z0-9_]*\).*$/CONFIG_\1/p' |sort |uniq > ${ok} comm -23 ${suspects} ${ok} >${new_adhoc} if [ -s ${new_adhoc} ]; then - echo >&2 "Error: You must add new CONFIG options using Kconfig" + echo >&2 "Warning: You must add new CONFIG options using Kconfig" echo >&2 "The following new ad-hoc CONFIG options were detected:" cat >&2 ${new_adhoc} echo >&2 echo >&2 "Please add these via Kconfig instead. Find a suitable Kconfig" echo >&2 "file and add a 'config' or 'menuconfig' option." # Don't delete the temporary files in case they are useful - exit 1 else rm ${suspects} ${ok} ${new_adhoc} fi diff --git a/sd_fuse/u-boot.bin.hardkernel b/sd_fuse/u-boot.bin.hardkernel index a41fd73dbb5..e89a18ed1a5 100755 Binary files a/sd_fuse/u-boot.bin.hardkernel and b/sd_fuse/u-boot.bin.hardkernel differ