X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=common%2Fbootm_os.c;h=f3021358686a00c36f0cf5356c87be33677a4aa6;hb=fd3d1212a2cbbcde848dc109d4c2bbfb759f9d4e;hp=d9e6e937f7ca627852d595ff23496b8d5af86fce;hpb=5b8e76c35ec312a3f73126bd1a2d2c0965b98a9f;p=platform%2Fkernel%2Fu-boot.git diff --git a/common/bootm_os.c b/common/bootm_os.c index d9e6e93..f302135 100644 --- a/common/bootm_os.c +++ b/common/bootm_os.c @@ -1,16 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2000-2009 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier: GPL-2.0+ */ #include #include #include -#include +#include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -21,9 +21,9 @@ static int do_bootm_standalone(int flag, int argc, char * const argv[], int (*appl)(int, char *const[]); /* Don't start if "autostart" is set to "no" */ - s = getenv("autostart"); + s = env_get("autostart"); if ((s != NULL) && !strcmp(s, "no")) { - setenv_hex("filesize", images->os.image_len); + env_set_hex("filesize", images->os.image_len); return 0; } appl = (int (*)(int, char * const []))images->ep; @@ -96,7 +96,7 @@ static int do_bootm_netbsd(int flag, int argc, char * const argv[], cmdline = malloc(len); copy_args(cmdline, argc, argv, ' '); } else { - cmdline = getenv("bootargs"); + cmdline = env_get("bootargs"); if (cmdline == NULL) cmdline = ""; } @@ -227,14 +227,14 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[], #endif /* See README.plan9 */ - s = getenv("confaddr"); + s = env_get("confaddr"); if (s != NULL) { char *confaddr = (char *)simple_strtoul(s, NULL, 16); if (argc > 0) { copy_args(confaddr, argc, argv, '\n'); } else { - s = getenv("bootargs"); + s = env_get("bootargs"); if (s != NULL) strcpy(confaddr, s); } @@ -276,9 +276,12 @@ void do_bootvx_fdt(bootm_headers_t *images) if (ret) return; + /* Update ethernet nodes */ + fdt_fixup_ethernet(*of_flat_tree); + ret = fdt_add_subnode(*of_flat_tree, 0, "chosen"); if ((ret >= 0 || ret == -FDT_ERR_EXISTS)) { - bootline = getenv("bootargs"); + bootline = env_get("bootargs"); if (bootline) { ret = fdt_find_and_setprop(*of_flat_tree, "/chosen", "bootargs", @@ -430,6 +433,34 @@ static int do_bootm_openrtos(int flag, int argc, char * const argv[], } #endif +#ifdef CONFIG_BOOTM_OPTEE +static int do_bootm_tee(int flag, int argc, char * const argv[], + bootm_headers_t *images) +{ + int ret; + + /* Verify OS type */ + if (images->os.os != IH_OS_TEE) { + return 1; + }; + + /* Validate OPTEE header */ + ret = optee_verify_bootm_image(images->os.image_start, + images->os.load, + images->os.image_len); + if (ret) + return ret; + + /* Locate FDT etc */ + ret = bootm_find_images(flag, argc, argv); + if (ret) + return ret; + + /* From here we can run the regular linux boot path */ + return do_bootm_linux(flag, argc, argv, images); +} +#endif + static boot_os_fn *boot_os[] = { [IH_OS_U_BOOT] = do_bootm_standalone, #ifdef CONFIG_BOOTM_LINUX @@ -463,6 +494,9 @@ static boot_os_fn *boot_os[] = { #ifdef CONFIG_BOOTM_OPENRTOS [IH_OS_OPENRTOS] = do_bootm_openrtos, #endif +#ifdef CONFIG_BOOTM_OPTEE + [IH_OS_TEE] = do_bootm_tee, +#endif }; /* Allow for arch specific config before we boot */ @@ -471,10 +505,17 @@ __weak void arch_preboot_os(void) /* please define platform specific arch_preboot_os() */ } +/* Allow for board specific config before we boot */ +__weak void board_preboot_os(void) +{ + /* please define board specific board_preboot_os() */ +} + int boot_selected_os(int argc, char * const argv[], int state, bootm_headers_t *images, boot_os_fn *boot_fn) { arch_preboot_os(); + board_preboot_os(); boot_fn(state, argc, argv, images); /* Stand-alone may return when 'autostart' is 'no' */