From 995d9676c88617a34c89472c6770a4e52a018c78 Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Thu, 9 Feb 2012 15:23:58 +0000 Subject: [PATCH] ArmPkg/BdsLib: Added support to start uImage Detect if there is a u-boot header (by checking the signature) and skip it. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12993 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPkg/Library/BdsLib/BdsLinuxLoader.c | 10 ++++++++-- ArmPkg/Library/BdsLib/BdsLinuxLoader.h | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ArmPkg/Library/BdsLib/BdsLinuxLoader.c b/ArmPkg/Library/BdsLib/BdsLinuxLoader.c index 3ff67f9b12..5c24366e45 100644 --- a/ArmPkg/Library/BdsLib/BdsLinuxLoader.c +++ b/ArmPkg/Library/BdsLib/BdsLinuxLoader.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011, ARM Limited. All rights reserved. +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -75,6 +75,12 @@ StartLinux ( LinuxKernel = (LINUX_KERNEL)(UINTN)LinuxImage; } + // Check if the Linux Image is a uImage + if (*(UINT32*)LinuxKernel == LINUX_UIMAGE_SIGNATURE) { + // Assume the Image Entry Point is just after the uImage header (64-byte size) + LinuxKernel = (LINUX_KERNEL)((UINTN)LinuxKernel + 64); + } + //TODO: Check there is no overlapping between kernel and Atag // @@ -96,7 +102,7 @@ StartLinux ( // Outside BootServices, so can't use Print(); DEBUG((EFI_D_ERROR, "\nStarting the kernel:\n\n")); - // jump to kernel with register set + // Jump to kernel with register set LinuxKernel ((UINTN)0, MachineType, (UINTN)KernelParamsAddress); // Kernel should never exit diff --git a/ArmPkg/Library/BdsLib/BdsLinuxLoader.h b/ArmPkg/Library/BdsLib/BdsLinuxLoader.h index e951e2a4be..8d58ce103a 100644 --- a/ArmPkg/Library/BdsLib/BdsLinuxLoader.h +++ b/ArmPkg/Library/BdsLib/BdsLinuxLoader.h @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011, ARM Limited. All rights reserved. +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -15,6 +15,8 @@ #ifndef __BDSLINUXLOADER_H #define __BDSLINUXLOADER_H +#define LINUX_UIMAGE_SIGNATURE 0x56190527 + #define LINUX_ATAG_MAX_OFFSET (PcdGet32(PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxAtagMaxOffset)) #define LINUX_KERNEL_MAX_OFFSET (PcdGet32(PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxKernelMaxOffset))