[U-Boot] [PATCH 2/6] sandbox: Add support for bootz
Simon Glass
sjg at chromium.org
Fri Feb 20 20:23:01 CET 2015
Hi Sjoerd,
On 19 February 2015 at 15:41, Sjoerd Simons
<sjoerd.simons at collabora.co.uk> wrote:
> Add dummy bootz_setup implementation allowing the u-boot sandbox to run
> bootz. This recognizes both ARM and x86 zImages to validate a valid
> zImage was loaded.
>
> Signed-off-by: Sjoerd Simons <sjoerd.simons at collabora.co.uk>
> ---
> arch/sandbox/cpu/cpu.c | 20 ++++++++++++++++++++
Can you please split the do_bootm_linux() code out into
arch/sandbox/lib/bootm, and add your patch there?
> 1 file changed, 20 insertions(+)
>
> diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
> index 1aa397c..c71fb86 100644
> --- a/arch/sandbox/cpu/cpu.c
> +++ b/arch/sandbox/cpu/cpu.c
> @@ -7,6 +7,7 @@
> #include <dm/root.h>
> #include <os.h>
> #include <asm/state.h>
> +#include <asm/io.h>
>
> DECLARE_GLOBAL_DATA_PTR;
>
> @@ -40,6 +41,25 @@ unsigned long __attribute__((no_instrument_function)) timer_get_us(void)
> return os_get_nsec() / 1000;
> }
>
> +int bootz_setup(ulong image, ulong *start, ulong *end)
> +{
> + uint8_t *zimage = (uint8_t *)map_sysmem(image, 0);
Do you need the cast?
> + uint8_t arm_magic[] = { 0x18, 0x28, 0x6f, 0x01 };
> +
> + if (memcmp(zimage + 0x202, "HdrS", 4) == 0) {
> + printf ("setting up x86 zImage\n");
> + } else if (memcmp (zimage + 0x24, arm_magic, 4) == 0) {
> + printf ("setting up ARM zImage\n");
> + } else {
The indentation and code style looks wrong here. Did you run patman?
> + printf ("Unrecognized zImage\n");
> + return 1;
> + }
> +
> + *start = 0xdead;
> + *end = 0xbeef;
> + return 0;
> +}
> +
> int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
> {
> if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
> --
> 2.1.4
>
Regards,
Simon
More information about the U-Boot
mailing list