summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-02-08 08:26:35 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-02-08 08:26:35 +0100
commit129fb7d893a067232b28a471c4d24a0638404c95 (patch)
tree7c242c842f7ec523d071a6baa3a2cc03e042206f /arch
parente229ce086c780d27a08227c938dbba9fcfb75bc0 (diff)
parent436481a993e8a18b08f96656245a9bf96bebed10 (diff)
downloadbarebox-129fb7d893a067232b28a471c4d24a0638404c95.tar.gz
barebox-129fb7d893a067232b28a471c4d24a0638404c95.tar.xz
Merge branch 'for-next/fit'
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/crypto/sha1_glue.c1
-rw-r--r--arch/arm/crypto/sha256_glue.c2
-rw-r--r--arch/arm/lib/bootm.c52
-rw-r--r--arch/arm/mach-omap/omap_generic.c5
-rw-r--r--arch/blackfin/lib/blackfin_linux.c3
-rw-r--r--arch/efi/efi/efi-image.c9
-rw-r--r--arch/mips/lib/bootm.c6
-rw-r--r--arch/nios2/lib/bootm.c3
-rw-r--r--arch/ppc/lib/ppclinux.c3
9 files changed, 50 insertions, 34 deletions
diff --git a/arch/arm/crypto/sha1_glue.c b/arch/arm/crypto/sha1_glue.c
index 176aa9ec69..57cd9d1014 100644
--- a/arch/arm/crypto/sha1_glue.c
+++ b/arch/arm/crypto/sha1_glue.c
@@ -119,6 +119,7 @@ static struct digest_algo m = {
.name = "sha1",
.driver_name = "sha1-asm",
.priority = 150,
+ .algo = HASH_ALGO_SHA1,
},
.init = sha1_init,
diff --git a/arch/arm/crypto/sha256_glue.c b/arch/arm/crypto/sha256_glue.c
index f8086f6ac7..e649609a8e 100644
--- a/arch/arm/crypto/sha256_glue.c
+++ b/arch/arm/crypto/sha256_glue.c
@@ -173,6 +173,7 @@ static struct digest_algo sha224 = {
.name = "sha224",
.driver_name = "sha224-asm",
.priority = 150,
+ .algo = HASH_ALGO_SHA224,
},
.length = SHA224_DIGEST_SIZE,
@@ -195,6 +196,7 @@ static struct digest_algo sha256 = {
.name = "sha256",
.driver_name = "sha256-asm",
.priority = 150,
+ .algo = HASH_ALGO_SHA256,
},
.length = SHA256_DIGEST_SIZE,
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 7bb9b43656..1913d5f97a 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -86,9 +86,11 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int
}
}
- ret = bootm_load_initrd(data, initrd_start);
- if (ret)
- return ret;
+ if (bootm_has_initrd(data)) {
+ ret = bootm_load_initrd(data, initrd_start);
+ if (ret)
+ return ret;
+ }
if (data->initrd_res) {
initrd_start = data->initrd_res->start;
@@ -110,6 +112,9 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int
printf("...\n");
}
+ if (data->dryrun)
+ return 0;
+
start_linux((void *)kernel, swap, initrd_start, initrd_size, data->oftree);
restart_machine();
@@ -135,7 +140,7 @@ static int do_bootm_linux(struct image_data *data)
* relocate itself before decompression.
*/
load_address = mem_start + PAGE_ALIGN(
- uimage_get_size(data->os, data->os_num) * 4);
+ bootm_get_os_size(data) * 4);
if (bootm_verbose(data))
printf("no OS load address, defaulting to 0x%08lx\n",
load_address);
@@ -223,6 +228,7 @@ static int do_bootz_linux_fdt(int fd, struct image_data *data)
ret = -EINVAL;
goto err_free;
}
+ free(oftree);
} else {
data->oftree = oftree;
}
@@ -354,37 +360,9 @@ static struct image_handler zimage_handler = {
.filetype = filetype_arm_zimage,
};
-static int do_bootm_barebox(struct image_data *data)
-{
- void *barebox;
-
- barebox = read_file(data->os_file, NULL);
- if (!barebox)
- return -EINVAL;
-
- if (IS_ENABLED(CONFIG_OFTREE) && data->of_root_node) {
- data->oftree = of_get_fixed_tree(data->of_root_node);
- fdt_add_reserve_map(data->oftree);
- of_print_cmdline(data->of_root_node);
- if (bootm_verbose(data) > 1)
- of_print_nodes(data->of_root_node, 0);
- }
-
- if (bootm_verbose(data)) {
- printf("\nStarting barebox at 0x%p", barebox);
- if (data->oftree)
- printf(", oftree at 0x%p", data->oftree);
- printf("...\n");
- }
-
- start_linux(barebox, 0, 0, 0, data->oftree);
-
- restart_machine();
-}
-
static struct image_handler barebox_handler = {
.name = "ARM barebox",
- .bootm = do_bootm_barebox,
+ .bootm = do_bootm_linux,
.filetype = filetype_arm_barebox,
};
@@ -553,6 +531,12 @@ BAREBOX_MAGICVAR(aimage_noverwrite_bootargs, "Disable overwrite of the bootargs
BAREBOX_MAGICVAR(aimage_noverwrite_tags, "Disable overwrite of the tags addr with the one present in aimage");
#endif
+static struct image_handler arm_fit_handler = {
+ .name = "FIT image",
+ .bootm = do_bootm_linux,
+ .filetype = filetype_oftree,
+};
+
static struct binfmt_hook binfmt_aimage_hook = {
.type = filetype_aimage,
.exec = "bootm",
@@ -578,6 +562,8 @@ static int armlinux_register_image_handler(void)
register_image_handler(&aimage_handler);
binfmt_register(&binfmt_aimage_hook);
}
+ if (IS_BUILTIN(CONFIG_CMD_BOOTM_FITIMAGE))
+ register_image_handler(&arm_fit_handler);
binfmt_register(&binfmt_arm_zimage_hook);
binfmt_register(&binfmt_barebox_hook);
diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c
index 4e26c6ba0b..34ed94007e 100644
--- a/arch/arm/mach-omap/omap_generic.c
+++ b/arch/arm/mach-omap/omap_generic.c
@@ -79,6 +79,11 @@ static int do_bootm_omap_barebox(struct image_data *data)
if (!barebox)
return -EINVAL;
+ if (data->dryrun) {
+ free(barebox);
+ return 0;
+ }
+
omap_start_barebox(barebox);
}
diff --git a/arch/blackfin/lib/blackfin_linux.c b/arch/blackfin/lib/blackfin_linux.c
index 2561a7e152..da2f78bcb5 100644
--- a/arch/blackfin/lib/blackfin_linux.c
+++ b/arch/blackfin/lib/blackfin_linux.c
@@ -50,6 +50,9 @@ static int do_bootm_linux(struct image_data *idata)
appl = (void *)(idata->os_address + idata->os_entry);
printf("Starting Kernel at 0x%p\n", appl);
+ if (idata->dryrun)
+ return 0;
+
icache_disable();
strncpy(cmdlinedest, cmdline, 0x1000);
diff --git a/arch/efi/efi/efi-image.c b/arch/efi/efi/efi-image.c
index b6437f4078..c78043b0de 100644
--- a/arch/efi/efi/efi-image.c
+++ b/arch/efi/efi/efi-image.c
@@ -190,7 +190,7 @@ static inline void linux_efi_handover(efi_handle_t handle,
static int do_bootm_efi(struct image_data *data)
{
void *tmp;
- void *initrd;
+ void *initrd = NULL;
size_t size;
efi_handle_t handle;
int ret;
@@ -244,6 +244,13 @@ static int do_bootm_efi(struct image_data *data)
printf("...\n");
}
+ if (data->dryrun) {
+ BS->unload_image(handle);
+ free(boot_header);
+ free(initrd);
+ return 0;
+ }
+
efi_set_variable_usec("LoaderTimeExecUSec", &efi_systemd_vendor_guid,
get_time_ns()/1000);
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 84f72f5ac0..6702372333 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -1,6 +1,7 @@
#include <boot.h>
#include <common.h>
#include <libfile.h>
+#include <malloc.h>
#include <init.h>
#include <fs.h>
#include <errno.h>
@@ -17,6 +18,11 @@ static int do_bootm_barebox(struct image_data *data)
if (!barebox)
return -EINVAL;
+ if (data->dryrun) {
+ free(barebox);
+ return 0;
+ }
+
shutdown_barebox();
barebox();
diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c
index 77da119bde..ac70330729 100644
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
@@ -42,6 +42,9 @@ static int do_bootm_linux(struct image_data *idata)
if (ret)
return ret;
+ if (idata->dryrun)
+ return 0;
+
kernel = (void *)(idata->os_address + idata->os_entry);
/* kernel parameters passing
diff --git a/arch/ppc/lib/ppclinux.c b/arch/ppc/lib/ppclinux.c
index 409c0cf261..a36682caf2 100644
--- a/arch/ppc/lib/ppclinux.c
+++ b/arch/ppc/lib/ppclinux.c
@@ -60,6 +60,9 @@ static int do_bootm_linux(struct image_data *data)
return -EINVAL;
}
+ if (data->dryrun)
+ return 0;
+
/* Relocate the device tree if outside the initial
* Linux mapped TLB.
*/