summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/Kconfig22
-rw-r--r--boot/android_ab.c1
-rw-r--r--boot/boot_fit.c1
-rw-r--r--boot/bootdev-uclass.c1
-rw-r--r--boot/bootflow.c1
-rw-r--r--boot/bootflow_menu.c8
-rw-r--r--boot/bootm.c2
-rw-r--r--boot/bootm_os.c1
-rw-r--r--boot/bootmeth-uclass.c1
-rw-r--r--boot/bootmeth_cros.c1
-rw-r--r--boot/bootmeth_efi.c61
-rw-r--r--boot/bootmeth_efi_mgr.c1
-rw-r--r--boot/bootmeth_extlinux.c1
-rw-r--r--boot/bootmeth_pxe.c1
-rw-r--r--boot/bootmeth_qfw.c1
-rw-r--r--boot/bootmeth_sandbox.c1
-rw-r--r--boot/bootmeth_script.c1
-rw-r--r--boot/bootretry.c3
-rw-r--r--boot/bootstd-uclass.c1
-rw-r--r--boot/cedit.c1
-rw-r--r--boot/common_fit.c1
-rw-r--r--boot/expo.c1
-rw-r--r--boot/expo_build.c1
-rw-r--r--boot/fdt_simplefb.c1
-rw-r--r--boot/fdt_support.c54
-rw-r--r--boot/image-android-dt.c1
-rw-r--r--boot/image-android.c18
-rw-r--r--boot/image-board.c15
-rw-r--r--boot/image-cipher.c1
-rw-r--r--boot/image-fdt.c1
-rw-r--r--boot/image-fit-sig.c1
-rw-r--r--boot/image-fit.c5
-rw-r--r--boot/image-pre-load.c1
-rw-r--r--boot/image-sig.c1
-rw-r--r--boot/image.c7
-rw-r--r--boot/pxe_utils.c50
-rw-r--r--boot/scene.c1
-rw-r--r--boot/scene_menu.c1
-rw-r--r--boot/scene_textline.c4
-rw-r--r--boot/vbe.c1
-rw-r--r--boot/vbe_request.c1
-rw-r--r--boot/vbe_simple.c1
-rw-r--r--boot/vbe_simple_fw.c1
-rw-r--r--boot/vbe_simple_os.c1
44 files changed, 112 insertions, 169 deletions
diff --git a/boot/Kconfig b/boot/Kconfig
index 4c9d2c0f79a..11175fb7bb2 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -423,7 +423,7 @@ config SPL_BOOTSTD
depends on SPL && SPL_DM && SPL_OF_CONTROL && SPL_BLK
default y if VPL
help
- This enables standard boot in SPL. This is neeeded so that VBE
+ This enables standard boot in SPL. This is needed so that VBE
(Verified Boot for Embedded) can be used, since it depends on standard
boot. It is enabled by default since the main purpose of VPL is to
handle the firmware part of VBE.
@@ -433,7 +433,7 @@ config VPL_BOOTSTD
depends on VPL && VPL_DM && VPL_OF_CONTROL && VPL_BLK
default y
help
- This enables standard boot in SPL. This is neeeded so that VBE
+ This enables standard boot in SPL. This is needed so that VBE
(Verified Boot for Embedded) can be used, since it depends on standard
boot. It is enabled by default since the main purpose of VPL is to
handle the firmware part of VBE.
@@ -449,7 +449,7 @@ config BOOTSTD_FULL
- bootdev, bootmeth commands
- extra features in the bootflow command
- support for selecting the ordering of bootmeths ("bootmeth order")
- - support for selecting the ordering of bootdevs using the devicetree
+ - support for selecting the ordering of bootdevs using the Device Tree
as well as the "boot_targets" environment variable
config BOOTSTD_DEFAULTS
@@ -481,7 +481,7 @@ config BOOTSTD_PROG
default y
help
Enable this to provide a board_run_command() function which can boot
- a systen without using commands. If the boot fails, then U-Boot will
+ a system without using commands. If the boot fails, then U-Boot will
panic.
Note: This currently has many limitations and is not a useful booting
@@ -517,7 +517,7 @@ config BOOTMETH_EXTLINUX
bootdevs look for a 'extlinux/extlinux.conf' on each filesystem
they scan.
- The specification for this filed is here:
+ The specification for this file is here:
https://uapi-group.org/specifications/specs/boot_loader_specification/
@@ -576,7 +576,7 @@ config BOOTMETH_VBE
select EVENT
help
Enables support for VBE boot. This is a standard boot method which
- supports selection of various firmware components, seleciton of an OS to
+ supports selection of various firmware components, selection of an OS to
boot as well as updating these using fwupd.
config BOOTMETH_DISTRO
@@ -593,7 +593,7 @@ config SPL_BOOTMETH_VBE
default y if VPL
help
Enables support for VBE boot. This is a standard boot method which
- supports selection of various firmware components, seleciton of an OS to
+ supports selection of various firmware components, selection of an OS to
boot as well as updating these using fwupd.
config VPL_BOOTMETH_VBE
@@ -603,7 +603,7 @@ config VPL_BOOTMETH_VBE
default y
help
Enables support for VBE boot. This is a standard boot method which
- supports selection of various firmware components, seleciton of an OS to
+ supports selection of various firmware components, selection of an OS to
boot as well as updating these using fwupd.
if BOOTMETH_VBE
@@ -752,7 +752,7 @@ if MEASURED_BOOT
bool "Measure the devicetree image"
default y if MEASURED_BOOT
help
- On some platforms, the devicetree is not static as it may contain
+ On some platforms, the Device Tree is not static as it may contain
random MAC addresses or other such data that changes each boot.
Therefore, it should not be measured into the TPM. In that case,
disable the measurement here.
@@ -1307,7 +1307,7 @@ config AUTOBOOT_PROMPT
Note that this define is used as the (only) argument to a
printf() call, so it may contain '%' format specifications,
- provided that it also includes, sepearated by commas exactly
+ provided that it also includes, separated by commas exactly
like in a printf statement, the required arguments. It is
the responsibility of the user to select only such arguments
that are valid in the given context.
@@ -1406,7 +1406,7 @@ config AUTOBOOT_STOP_STR_SHA256
help
This option adds the feature to only stop the autobooting,
and therefore boot into the U-Boot prompt, when the input
- string / password matches a values that is encypted via
+ string / password matches a values that is encrypted via
a SHA256 hash and saved in the environment variable
"bootstopkeysha256". If the value in that variable
includes a ":", the portion prior to the ":" will be treated
diff --git a/boot/android_ab.c b/boot/android_ab.c
index 1e5aa81b750..143f373aae9 100644
--- a/boot/android_ab.c
+++ b/boot/android_ab.c
@@ -2,7 +2,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*/
-#include <common.h>
#include <android_ab.h>
#include <android_bootloader_message.h>
#include <blk.h>
diff --git a/boot/boot_fit.c b/boot/boot_fit.c
index 9d394126563..4dcaf95c6ae 100644
--- a/boot/boot_fit.c
+++ b/boot/boot_fit.c
@@ -7,7 +7,6 @@
*/
#include <boot_fit.h>
-#include <common.h>
#include <errno.h>
#include <image.h>
#include <log.h>
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index 46815ea2fdb..7c7bba088c9 100644
--- a/boot/bootdev-uclass.c
+++ b/boot/bootdev-uclass.c
@@ -6,7 +6,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <dm.h>
#include <bootdev.h>
#include <bootflow.h>
diff --git a/boot/bootflow.c b/boot/bootflow.c
index 68bf99329ab..9aa3179c388 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -6,7 +6,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <bootdev.h>
#include <bootflow.h>
#include <bootmeth.h>
diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c
index 16f9cd8f8ca..9d0dc352f97 100644
--- a/boot/bootflow_menu.c
+++ b/boot/bootflow_menu.c
@@ -8,8 +8,8 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <bootflow.h>
+#include <bootmeth.h>
#include <bootstd.h>
#include <cli.h>
#include <dm.h>
@@ -77,6 +77,7 @@ int bootflow_menu_new(struct expo **expp)
last_bootdev = NULL;
for (ret = bootflow_first_glob(&bflow), i = 0; !ret && i < 36;
ret = bootflow_next_glob(&bflow), i++) {
+ struct bootmeth_uc_plat *ucp;
char str[2], *label, *key;
uint preview_id;
bool add_gap;
@@ -84,6 +85,11 @@ int bootflow_menu_new(struct expo **expp)
if (bflow->state != BOOTFLOWST_READY)
continue;
+ /* No media to show for BOOTMETHF_GLOBAL bootmeths */
+ ucp = dev_get_uclass_plat(bflow->method);
+ if (ucp->flags & BOOTMETHF_GLOBAL)
+ continue;
+
*str = i < 10 ? '0' + i : 'A' + i - 10;
str[1] = '\0';
key = strdup(str);
diff --git a/boot/bootm.c b/boot/bootm.c
index 9879e1bba4e..376d63aafc9 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -5,7 +5,6 @@
*/
#ifndef USE_HOSTCC
-#include <common.h>
#include <bootm.h>
#include <bootstage.h>
#include <cli.h>
@@ -25,6 +24,7 @@
#include <asm/io.h>
#include <linux/sizes.h>
#include <tpm-v2.h>
+#include <tpm_tcg2.h>
#if defined(CONFIG_CMD_USB)
#include <usb.h>
#endif
diff --git a/boot/bootm_os.c b/boot/bootm_os.c
index ccde72d22c1..15297ddb530 100644
--- a/boot/bootm_os.c
+++ b/boot/bootm_os.c
@@ -4,7 +4,6 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
-#include <common.h>
#include <bootm.h>
#include <bootstage.h>
#include <cpu_func.h>
diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c
index 1d157d54dbd..c0abadef97c 100644
--- a/boot/bootmeth-uclass.c
+++ b/boot/bootmeth-uclass.c
@@ -6,7 +6,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <blk.h>
#include <bootflow.h>
#include <bootmeth.h>
diff --git a/boot/bootmeth_cros.c b/boot/bootmeth_cros.c
index f015f2e1c75..645b8bed102 100644
--- a/boot/bootmeth_cros.c
+++ b/boot/bootmeth_cros.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <blk.h>
#include <bootdev.h>
#include <bootflow.h>
diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index aebc5207fc0..5a4c125835a 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <bootdev.h>
#include <bootflow.h>
#include <bootmeth.h>
@@ -144,62 +143,6 @@ static int distro_efi_check(struct udevice *dev, struct bootflow_iter *iter)
return 0;
}
-/**
- * distro_efi_get_fdt_name() - Get the filename for reading the .dtb file
- *
- * @fname: Place to put filename
- * @size: Max size of filename
- * @seq: Sequence number, to cycle through options (0=first)
- * Returns: 0 on success, -ENOENT if the "fdtfile" env var does not exist,
- * -EINVAL if there are no more options, -EALREADY if the control FDT should be
- * used
- */
-static int distro_efi_get_fdt_name(char *fname, int size, int seq)
-{
- const char *fdt_fname;
- const char *prefix;
-
- /* select the prefix */
- switch (seq) {
- case 0:
- /* this is the default */
- prefix = "/dtb";
- break;
- case 1:
- prefix = "";
- break;
- case 2:
- prefix = "/dtb/current";
- break;
- default:
- return log_msg_ret("pref", -EINVAL);
- }
-
- fdt_fname = env_get("fdtfile");
- if (fdt_fname) {
- snprintf(fname, size, "%s/%s", prefix, fdt_fname);
- log_debug("Using device tree: %s\n", fname);
- } else if (IS_ENABLED(CONFIG_OF_HAS_PRIOR_STAGE)) {
- strcpy(fname, "<prior>");
- return log_msg_ret("pref", -EALREADY);
- /* Use this fallback only for 32-bit ARM */
- } else if (IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_ARM64)) {
- const char *soc = env_get("soc");
- const char *board = env_get("board");
- const char *boardver = env_get("boardver");
-
- /* cf the code in label_boot() which seems very complex */
- snprintf(fname, size, "%s/%s%s%s%s.dtb", prefix,
- soc ? soc : "", soc ? "-" : "", board ? board : "",
- boardver ? boardver : "");
- log_debug("Using default device tree: %s\n", fname);
- } else {
- return log_msg_ret("env", -ENOENT);
- }
-
- return 0;
-}
-
/*
* distro_efi_try_bootflow_files() - Check that files are present
*
@@ -241,7 +184,7 @@ static int distro_efi_try_bootflow_files(struct udevice *dev,
ret = -ENOENT;
*fname = '\0';
for (seq = 0; ret == -ENOENT; seq++) {
- ret = distro_efi_get_fdt_name(fname, sizeof(fname), seq);
+ ret = efi_get_distro_fdt_name(fname, sizeof(fname), seq);
if (ret == -EALREADY)
bflow->flags = BOOTFLOWF_USE_PRIOR_FDT;
if (!ret) {
@@ -340,7 +283,7 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow)
sprintf(file_addr, "%lx", fdt_addr);
/* We only allow the first prefix with PXE */
- ret = distro_efi_get_fdt_name(fname, sizeof(fname), 0);
+ ret = efi_get_distro_fdt_name(fname, sizeof(fname), 0);
if (ret)
return log_msg_ret("nam", ret);
diff --git a/boot/bootmeth_efi_mgr.c b/boot/bootmeth_efi_mgr.c
index b7d429f2c3d..23ae1e610ac 100644
--- a/boot/bootmeth_efi_mgr.c
+++ b/boot/bootmeth_efi_mgr.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <bootdev.h>
#include <bootflow.h>
#include <bootmeth.h>
diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c
index ae0ad1d53e3..9b55686948f 100644
--- a/boot/bootmeth_extlinux.c
+++ b/boot/bootmeth_extlinux.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <bootdev.h>
#include <bootflow.h>
#include <bootmeth.h>
diff --git a/boot/bootmeth_pxe.c b/boot/bootmeth_pxe.c
index 70f693aa239..03d2589c264 100644
--- a/boot/bootmeth_pxe.c
+++ b/boot/bootmeth_pxe.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <bootdev.h>
#include <bootflow.h>
#include <bootmeth.h>
diff --git a/boot/bootmeth_qfw.c b/boot/bootmeth_qfw.c
index 8ebbc3ebcd5..dfaa944594e 100644
--- a/boot/bootmeth_qfw.c
+++ b/boot/bootmeth_qfw.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <command.h>
#include <bootdev.h>
#include <bootflow.h>
diff --git a/boot/bootmeth_sandbox.c b/boot/bootmeth_sandbox.c
index aabc57e635a..0bc8f688e30 100644
--- a/boot/bootmeth_sandbox.c
+++ b/boot/bootmeth_sandbox.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <bootdev.h>
#include <bootflow.h>
#include <bootmeth.h>
diff --git a/boot/bootmeth_script.c b/boot/bootmeth_script.c
index 06340e43d2d..0e05d28d4d9 100644
--- a/boot/bootmeth_script.c
+++ b/boot/bootmeth_script.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <blk.h>
#include <bootflow.h>
#include <bootmeth.h>
diff --git a/boot/bootretry.c b/boot/bootretry.c
index 8d850df9d48..587b2de7d6b 100644
--- a/boot/bootretry.c
+++ b/boot/bootretry.c
@@ -4,12 +4,13 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
-#include <common.h>
+#include <stdio.h>
#include <bootretry.h>
#include <cli.h>
#include <env.h>
#include <errno.h>
#include <time.h>
+#include <vsprintf.h>
#include <watchdog.h>
static uint64_t endtime; /* must be set, default is instant timeout */
diff --git a/boot/bootstd-uclass.c b/boot/bootstd-uclass.c
index 81555d341e3..5de8efce19a 100644
--- a/boot/bootstd-uclass.c
+++ b/boot/bootstd-uclass.c
@@ -6,7 +6,6 @@
* Written by Simon Glass <sjg@chromium.org>
*/
-#include <common.h>
#include <bootflow.h>
#include <bootstd.h>
#include <dm.h>
diff --git a/boot/cedit.c b/boot/cedit.c
index 8c654dba6dc..c29a2be14ce 100644
--- a/boot/cedit.c
+++ b/boot/cedit.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY LOGC_EXPO
-#include <common.h>
#include <abuf.h>
#include <cedit.h>
#include <cli.h>
diff --git a/boot/common_fit.c b/boot/common_fit.c
index cde2dc45e90..a2f9b8d83c3 100644
--- a/boot/common_fit.c
+++ b/boot/common_fit.c
@@ -4,7 +4,6 @@
* Written by Simon Glass <sjg@chromium.org>
*/
-#include <common.h>
#include <errno.h>
#include <image.h>
#include <log.h>
diff --git a/boot/expo.c b/boot/expo.c
index cadb6a0ad6e..ed01483f1d3 100644
--- a/boot/expo.c
+++ b/boot/expo.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY LOGC_EXPO
-#include <common.h>
#include <dm.h>
#include <expo.h>
#include <malloc.h>
diff --git a/boot/expo_build.c b/boot/expo_build.c
index 04d88a2c308..a4df798adeb 100644
--- a/boot/expo_build.c
+++ b/boot/expo_build.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY LOGC_EXPO
-#include <common.h>
#include <expo.h>
#include <fdtdec.h>
#include <log.h>
diff --git a/boot/fdt_simplefb.c b/boot/fdt_simplefb.c
index 837920bd3a3..53415548459 100644
--- a/boot/fdt_simplefb.c
+++ b/boot/fdt_simplefb.c
@@ -6,7 +6,6 @@
* Stephen Warren <swarren@wwwdotorg.org>
*/
-#include <common.h>
#include <dm.h>
#include <fdt_support.h>
#include <asm/global_data.h>
diff --git a/boot/fdt_support.c b/boot/fdt_support.c
index 2bd80a9dfb1..2392027d40b 100644
--- a/boot/fdt_support.c
+++ b/boot/fdt_support.c
@@ -6,13 +6,15 @@
* Copyright 2010-2011 Freescale Semiconductor, Inc.
*/
-#include <common.h>
+#include <dm.h>
#include <abuf.h>
#include <env.h>
#include <log.h>
#include <mapmem.h>
#include <net.h>
+#include <rng.h>
#include <stdio_dev.h>
+#include <dm/device_compat.h>
#include <dm/ofnode.h>
#include <linux/ctype.h>
#include <linux/types.h>
@@ -274,6 +276,47 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
return 0;
}
+int fdt_kaslrseed(void *fdt, bool overwrite)
+{
+ int len, err, nodeoffset;
+ struct udevice *dev;
+ const u64 *orig;
+ u64 data = 0;
+
+ err = fdt_check_header(fdt);
+ if (err < 0)
+ return err;
+
+ /* find or create "/chosen" node. */
+ nodeoffset = fdt_find_or_add_subnode(fdt, 0, "chosen");
+ if (nodeoffset < 0)
+ return nodeoffset;
+
+ /* return without error if we are not overwriting and existing non-zero node */
+ orig = fdt_getprop(fdt, nodeoffset, "kaslr-seed", &len);
+ if (orig && len == sizeof(*orig))
+ data = fdt64_to_cpu(*orig);
+ if (data && !overwrite) {
+ debug("not overwriting existing kaslr-seed\n");
+ return 0;
+ }
+ err = uclass_get_device(UCLASS_RNG, 0, &dev);
+ if (err) {
+ printf("No RNG device\n");
+ return err;
+ }
+ err = dm_rng_read(dev, &data, sizeof(data));
+ if (err) {
+ dev_err(dev, "dm_rng_read failed: %d\n", err);
+ return err;
+ }
+ err = fdt_setprop(fdt, nodeoffset, "kaslr-seed", &data, sizeof(data));
+ if (err < 0)
+ printf("WARNING: could not set kaslr-seed %s.\n", fdt_strerror(err));
+
+ return err;
+}
+
/**
* board_fdt_chosen_bootargs - boards may override this function to use
* alternative kernel command line arguments
@@ -301,6 +344,15 @@ int fdt_chosen(void *fdt)
if (nodeoffset < 0)
return nodeoffset;
+ /* if DM_RNG enabled automatically inject kaslr-seed node unless:
+ * CONFIG_MEASURED_BOOT enabled: as dt modifications break measured boot
+ * CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT enabled: as that implementation does not use dm yet
+ */
+ if (IS_ENABLED(CONFIG_DM_RNG) &&
+ !IS_ENABLED(CONFIG_MEASURED_BOOT) &&
+ !IS_ENABLED(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT))
+ fdt_kaslrseed(fdt, false);
+
if (IS_ENABLED(CONFIG_BOARD_RNG_SEED) && !board_rng_seed(&buf)) {
err = fdt_setprop(fdt, nodeoffset, "rng-seed",
abuf_data(&buf), abuf_size(&buf));
diff --git a/boot/image-android-dt.c b/boot/image-android-dt.c
index fb014190d44..3b25018c2e7 100644
--- a/boot/image-android-dt.c
+++ b/boot/image-android-dt.c
@@ -6,7 +6,6 @@
#include <image-android-dt.h>
#include <dt_table.h>
-#include <common.h>
#include <linux/libfdt.h>
#include <mapmem.h>
diff --git a/boot/image-android.c b/boot/image-android.c
index 88e40bc7ec6..ee626972c11 100644
--- a/boot/image-android.c
+++ b/boot/image-android.c
@@ -3,7 +3,6 @@
* Copyright (c) 2011 Sebastian Andrzej Siewior <bigeasy@linutronix.de>
*/
-#include <common.h>
#include <env.h>
#include <image.h>
#include <image-android-dt.h>
@@ -64,7 +63,6 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3
data->kcmdline = hdr->cmdline;
data->header_version = hdr->header_version;
- data->ramdisk_ptr = env_get_ulong("ramdisk_addr_r", 16, 0);
/*
* The header takes a full page, the remaining components are aligned
@@ -75,6 +73,7 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3
data->kernel_ptr = end;
data->kernel_size = hdr->kernel_size;
end += ALIGN(hdr->kernel_size, ANDR_GKI_PAGE_SIZE);
+ data->ramdisk_ptr = end;
data->ramdisk_size = hdr->ramdisk_size;
data->boot_ramdisk_size = hdr->ramdisk_size;
end += ALIGN(hdr->ramdisk_size, ANDR_GKI_PAGE_SIZE);
@@ -394,25 +393,24 @@ int android_image_get_ramdisk(const void *hdr, const void *vendor_boot_img,
return -1;
}
if (img_data.header_version > 2) {
- ramdisk_ptr = img_data.ramdisk_ptr;
+ ramdisk_ptr = img_data.ramdisk_addr;
memcpy((void *)(ramdisk_ptr), (void *)img_data.vendor_ramdisk_ptr,
img_data.vendor_ramdisk_size);
- memcpy((void *)(ramdisk_ptr + img_data.vendor_ramdisk_size),
- (void *)img_data.ramdisk_ptr,
+ ramdisk_ptr += img_data.vendor_ramdisk_size;
+ memcpy((void *)(ramdisk_ptr), (void *)img_data.ramdisk_ptr,
img_data.boot_ramdisk_size);
+ ramdisk_ptr += img_data.boot_ramdisk_size;
if (img_data.bootconfig_size) {
memcpy((void *)
- (ramdisk_ptr + img_data.vendor_ramdisk_size +
- img_data.boot_ramdisk_size),
- (void *)img_data.bootconfig_addr,
+ (ramdisk_ptr), (void *)img_data.bootconfig_addr,
img_data.bootconfig_size);
}
}
printf("RAM disk load addr 0x%08lx size %u KiB\n",
- img_data.ramdisk_ptr, DIV_ROUND_UP(img_data.ramdisk_size, 1024));
+ img_data.ramdisk_addr, DIV_ROUND_UP(img_data.ramdisk_size, 1024));
- *rd_data = img_data.ramdisk_ptr;
+ *rd_data = img_data.ramdisk_addr;
*rd_len = img_data.ramdisk_size;
return 0;
diff --git a/boot/image-board.c b/boot/image-board.c
index 09b6e4e0bdc..f2124013046 100644
--- a/boot/image-board.c
+++ b/boot/image-board.c
@@ -8,7 +8,7 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
-#include <common.h>
+#include <config.h>
#include <bootstage.h>
#include <cpu_func.h>
#include <display_options.h>
@@ -406,13 +406,20 @@ static int select_ramdisk(struct bootm_headers *images, const char *select, u8 a
if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE)) {
int ret;
if (IS_ENABLED(CONFIG_CMD_ABOOTIMG)) {
- void *boot_img = map_sysmem(get_abootimg_addr(), 0);
+ ulong boot_img = get_abootimg_addr();
+ ulong init_boot_img = get_ainit_bootimg_addr();
void *vendor_boot_img = map_sysmem(get_avendor_bootimg_addr(), 0);
+ void *ramdisk_img;
- ret = android_image_get_ramdisk(boot_img, vendor_boot_img,
+ if (init_boot_img == -1)
+ ramdisk_img = map_sysmem(boot_img, 0);
+ else
+ ramdisk_img = map_sysmem(init_boot_img, 0);
+
+ ret = android_image_get_ramdisk(ramdisk_img, vendor_boot_img,
rd_datap, rd_lenp);
unmap_sysmem(vendor_boot_img);
- unmap_sysmem(boot_img);
+ unmap_sysmem(ramdisk_img);
} else {
void *ptr = map_sysmem(images->os.start, 0);
diff --git a/boot/image-cipher.c b/boot/image-cipher.c
index b9061489396..9d389f26cea 100644
--- a/boot/image-cipher.c
+++ b/boot/image-cipher.c
@@ -7,7 +7,6 @@
#include "mkimage.h"
#include <time.h>
#else
-#include <common.h>
#include <malloc.h>
#include <asm/global_data.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/boot/image-fdt.c b/boot/image-fdt.c
index f09716cba30..56dd7687f51 100644
--- a/boot/image-fdt.c
+++ b/boot/image-fdt.c
@@ -8,7 +8,6 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
-#include <common.h>
#include <command.h>
#include <fdt_support.h>
#include <fdtdec.h>
diff --git a/boot/image-fit-sig.c b/boot/image-fit-sig.c
index 12369896fe3..fe328df4a85 100644
--- a/boot/image-fit-sig.c
+++ b/boot/image-fit-sig.c
@@ -7,7 +7,6 @@
#include "mkimage.h"
#include <time.h>
#else
-#include <common.h>
#include <log.h>
#include <malloc.h>
#include <asm/global_data.h>
diff --git a/boot/image-fit.c b/boot/image-fit.c
index 89e377563ce..f6464bcf620 100644
--- a/boot/image-fit.c
+++ b/boot/image-fit.c
@@ -19,7 +19,6 @@
#else
#include <linux/compiler.h>
#include <linux/sizes.h>
-#include <common.h>
#include <errno.h>
#include <log.h>
#include <mapmem.h>
@@ -38,10 +37,6 @@ DECLARE_GLOBAL_DATA_PTR;
#include <image.h>
#include <bootstage.h>
#include <u-boot/crc.h>
-#include <u-boot/md5.h>
-#include <u-boot/sha1.h>
-#include <u-boot/sha256.h>
-#include <u-boot/sha512.h>
/*****************************************************************************/
/* New uImage format routines */
diff --git a/boot/image-pre-load.c b/boot/image-pre-load.c
index b504ab42a54..cc19017404c 100644
--- a/boot/image-pre-load.c
+++ b/boot/image-pre-load.c
@@ -3,7 +3,6 @@
* Copyright (C) 2021 Philippe Reynes <philippe.reynes@softathome.com>
*/
-#include <common.h>
#include <asm/global_data.h>
DECLARE_GLOBAL_DATA_PTR;
#include <image.h>
diff --git a/boot/image-sig.c b/boot/image-sig.c
index 0421a61b040..6bc74866eae 100644
--- a/boot/image-sig.c
+++ b/boot/image-sig.c
@@ -3,7 +3,6 @@
* Copyright (c) 2013, Google Inc.
*/
-#include <common.h>
#include <log.h>
#include <malloc.h>
#include <asm/global_data.h>
diff --git a/boot/image.c b/boot/image.c
index 073931cd7a3..fc774d605d1 100644
--- a/boot/image.c
+++ b/boot/image.c
@@ -7,7 +7,6 @@
*/
#ifndef USE_HOSTCC
-#include <common.h>
#include <env.h>
#include <display_options.h>
#include <init.h>
@@ -26,8 +25,6 @@
#endif
#include <asm/global_data.h>
-#include <u-boot/md5.h>
-#include <u-boot/sha1.h>
#include <linux/errno.h>
#include <asm/io.h>
@@ -531,10 +528,10 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
printf("Unimplemented compression type %d\n", comp);
return ret;
}
- if (ret)
- return ret;
*load_end = load + image_len;
+ if (ret)
+ return ret;
return 0;
}
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 5c1c962ff4c..53d6cf700b2 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -4,7 +4,8 @@
* Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
*/
-#include <common.h>
+#define LOG_CATEGORY LOGC_BOOT
+
#include <command.h>
#include <dm.h>
#include <env.h>
@@ -324,10 +325,6 @@ static void label_boot_kaslrseed(void)
#if CONFIG_IS_ENABLED(DM_RNG)
ulong fdt_addr;
struct fdt_header *working_fdt;
- size_t n = 0x8;
- struct udevice *dev;
- u64 *buf;
- int nodeoffset;
int err;
/* Get the main fdt and map it */
@@ -343,35 +340,7 @@ static void label_boot_kaslrseed(void)
if (err <= 0)
return;
- if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) {
- printf("No RNG device\n");
- return;
- }
-
- nodeoffset = fdt_find_or_add_subnode(working_fdt, 0, "chosen");
- if (nodeoffset < 0) {
- printf("Reading chosen node failed\n");
- return;
- }
-
- buf = malloc(n);
- if (!buf) {
- printf("Out of memory\n");
- return;
- }
-
- if (dm_rng_read(dev, buf, n)) {
- printf("Reading RNG failed\n");
- goto err;
- }
-
- err = fdt_setprop(working_fdt, nodeoffset, "kaslr-seed", buf, sizeof(buf));
- if (err < 0) {
- printf("Unable to set kaslr-seed on chosen node: %s\n", fdt_strerror(err));
- goto err;
- }
-err:
- free(buf);
+ fdt_kaslrseed(working_fdt, true);
#endif
return;
}
@@ -763,17 +732,22 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
/* Try bootm for legacy and FIT format image */
if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID &&
- IS_ENABLED(CONFIG_CMD_BOOTM))
+ IS_ENABLED(CONFIG_CMD_BOOTM)) {
+ log_debug("using bootm\n");
do_bootm(ctx->cmdtp, 0, bootm_argc, bootm_argv);
/* Try booting an AArch64 Linux kernel image */
- else if (IS_ENABLED(CONFIG_CMD_BOOTI))
+ } else if (IS_ENABLED(CONFIG_CMD_BOOTI)) {
+ log_debug("using booti\n");
do_booti(ctx->cmdtp, 0, bootm_argc, bootm_argv);
/* Try booting a Image */
- else if (IS_ENABLED(CONFIG_CMD_BOOTZ))
+ } else if (IS_ENABLED(CONFIG_CMD_BOOTZ)) {
+ log_debug("using bootz\n");
do_bootz(ctx->cmdtp, 0, bootm_argc, bootm_argv);
/* Try booting an x86_64 Linux kernel image */
- else if (IS_ENABLED(CONFIG_CMD_ZBOOT))
+ } else if (IS_ENABLED(CONFIG_CMD_ZBOOT)) {
+ log_debug("using zboot\n");
do_zboot_parent(ctx->cmdtp, 0, zboot_argc, zboot_argv, NULL);
+ }
unmap_sysmem(buf);
diff --git a/boot/scene.c b/boot/scene.c
index d4dfb49ada1..ac976aa26bb 100644
--- a/boot/scene.c
+++ b/boot/scene.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY LOGC_EXPO
-#include <common.h>
#include <dm.h>
#include <expo.h>
#include <malloc.h>
diff --git a/boot/scene_menu.c b/boot/scene_menu.c
index 63994165efb..80bd7457cb1 100644
--- a/boot/scene_menu.c
+++ b/boot/scene_menu.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY LOGC_EXPO
-#include <common.h>
#include <dm.h>
#include <expo.h>
#include <malloc.h>
diff --git a/boot/scene_textline.c b/boot/scene_textline.c
index 6ea072a1c26..bba8663b98d 100644
--- a/boot/scene_textline.c
+++ b/boot/scene_textline.c
@@ -8,10 +8,12 @@
#define LOG_CATEGORY LOGC_EXPO
-#include <common.h>
#include <expo.h>
#include <menu.h>
+#include <log.h>
#include <video_console.h>
+#include <linux/errno.h>
+#include <linux/string.h>
#include "scene_internal.h"
int scene_textline(struct scene *scn, const char *name, uint id, uint max_chars,
diff --git a/boot/vbe.c b/boot/vbe.c
index 52b32830037..00673de7ee2 100644
--- a/boot/vbe.c
+++ b/boot/vbe.c
@@ -6,7 +6,6 @@
* Written by Simon Glass <sjg@chromium.org>
*/
-#include <common.h>
#include <bootmeth.h>
#include <bootstd.h>
#include <dm.h>
diff --git a/boot/vbe_request.c b/boot/vbe_request.c
index 0293ac6c869..a1350c1a706 100644
--- a/boot/vbe_request.c
+++ b/boot/vbe_request.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY LOGC_BOOT
-#include <common.h>
#include <dm.h>
#include <event.h>
#include <image.h>
diff --git a/boot/vbe_simple.c b/boot/vbe_simple.c
index 12682abd399..189e86d2a22 100644
--- a/boot/vbe_simple.c
+++ b/boot/vbe_simple.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY LOGC_BOOT
-#include <common.h>
#include <bootdev.h>
#include <bootflow.h>
#include <bootmeth.h>
diff --git a/boot/vbe_simple_fw.c b/boot/vbe_simple_fw.c
index d59a704ddba..4d6da9490a7 100644
--- a/boot/vbe_simple_fw.c
+++ b/boot/vbe_simple_fw.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY LOGC_BOOT
-#include <common.h>
#include <bloblist.h>
#include <bootdev.h>
#include <bootflow.h>
diff --git a/boot/vbe_simple_os.c b/boot/vbe_simple_os.c
index 84626cdeaf2..b4126d8d2d0 100644
--- a/boot/vbe_simple_os.c
+++ b/boot/vbe_simple_os.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY LOGC_BOOT
-#include <common.h>
#include <dm.h>
#include <bootflow.h>
#include <vbe.h>