summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-01-15 09:05:37 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-01-26 22:45:36 +0100
commit3f0835e0741c80305faf638aaf174ac9d235e83e (patch)
tree1e8febe8e4c5b09ab34c05ecbce1fdbb34098edd
parent80f6d5db3041f2ae1109f3f811cf48e4f25142e4 (diff)
downloadbarebox-3f0835e0741c80305faf638aaf174ac9d235e83e.tar.gz
barebox-3f0835e0741c80305faf638aaf174ac9d235e83e.tar.xz
bootm: Push dryrun to handlers
We can make the dryrun option more useful by calling into the handlers. With this we can detect more cases that can go wrong during boot. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/lib/bootm.c3
-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
-rw-r--r--commands/bootm.c3
-rw-r--r--common/bootm.c6
9 files changed, 34 insertions, 7 deletions
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 010b668e68..eef906a36b 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -110,6 +110,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();
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.
*/
diff --git a/commands/bootm.c b/commands/bootm.c
index 75849a1bac..063da62177 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -133,9 +133,6 @@ static int do_bootm(int argc, char *argv[])
goto err_out;
}
- if (data.dryrun)
- printf("Dryrun. Aborted\n");
-
err_out:
return ret ? 1 : 0;
}
diff --git a/common/bootm.c b/common/bootm.c
index f8d9330e2e..7f6533b3d1 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -526,10 +526,10 @@ int bootm_boot(struct bootm_data *bootm_data)
printf("Passing control to %s handler\n", handler->name);
}
+ ret = handler->bootm(data);
if (data->dryrun)
- ret = 0;
- else
- ret = handler->bootm(data);
+ printf("Dryrun. Aborted\n");
+
err_out:
if (data->os_res)
release_sdram_region(data->os_res);