]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
image: Implement IH_TYPE_KERNEL_NOLOAD
authorStephen Warren <swarren@nvidia.com>
Thu, 10 Nov 2011 20:17:53 +0000 (13:17 -0700)
committerStefan Roese <sr@denx.de>
Thu, 1 Dec 2011 08:45:35 +0000 (09:45 +0100)
The legacy uImage format includes an absolute load and entry-point
address. When bootm operates on a kernel uImage in memory that isn't
loaded at the address in the image's load address, U-Boot will copy
the image to its address in the header.

Some kernel images can actually be loaded and used at any arbitrary
address. An example is an ARM Linux kernel zImage file. To represent
this capability, IH_TYPE_KERNEL_NOLOAD is implemented, which operates
just like IH_TYPE_KERNEL, except that the load address header is
ignored, and U-Boot does not copy the image to its load address, but
rather uses it in-place.

This is useful when sharing a single (uImage-wrapped) zImage across
multiple boards with different memory layouts; in this case, a specific
load address need not be picked when creating the uImage, but instead
is selected by the board-specific U-Boot environment used to load and
boot that image.

v2: Rename from IH_TYPE_KERNEL_ANYLOAD to IH_TYPE_KERNEL_NOLOAD.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Stefan Roese <sr@denx.de>
common/cmd_bootm.c
common/image.c
include/image.h
tools/default_image.c

index b073f095ba00610f978d0b4d22b6e69ee24861ae..8cafe3e67a78067fb81fd46035d09b2f4b4e4b3b 100644 (file)
@@ -272,7 +272,13 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
                return 1;
        }
 
+       if (images.os.type == IH_TYPE_KERNEL_NOLOAD) {
+               images.os.load = images.os.image_start;
+               images.ep += images.os.load;
+       }
+
        if (((images.os.type == IH_TYPE_KERNEL) ||
+            (images.os.type == IH_TYPE_KERNEL_NOLOAD) ||
             (images.os.type == IH_TYPE_MULTI)) &&
            (images.os.os == IH_OS_LINUX)) {
                /* find ramdisk */
@@ -796,7 +802,8 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify)
        }
 
        show_boot_progress(106);
-       if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL)) {
+       if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL) &&
+           !fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL_NOLOAD)) {
                puts("Not a kernel image\n");
                show_boot_progress(-106);
                return 0;
@@ -874,6 +881,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
                /* get os_data and os_len */
                switch (image_get_type(hdr)) {
                case IH_TYPE_KERNEL:
+               case IH_TYPE_KERNEL_NOLOAD:
                        *os_data = image_get_data(hdr);
                        *os_len = image_get_data_size(hdr);
                        break;
index 555d9d9d42ba01b89faafa94e83843433c298914..aacae5ac51aab01d3e10499c4e843971f1129000 100644 (file)
@@ -136,6 +136,7 @@ static const table_entry_t uimage_type[] = {
        {       IH_TYPE_FIRMWARE,   "firmware",   "Firmware",           },
        {       IH_TYPE_FLATDT,     "flat_dt",    "Flat Device Tree",   },
        {       IH_TYPE_KERNEL,     "kernel",     "Kernel Image",       },
+       {       IH_TYPE_KERNEL_NOLOAD, "kernel_noload",  "Kernel Image (no loading done)", },
        {       IH_TYPE_KWBIMAGE,   "kwbimage",   "Kirkwood Boot Image",},
        {       IH_TYPE_IMXIMAGE,   "imximage",   "Freescale i.MX Boot Image",},
        {       IH_TYPE_INVALID,    NULL,         "Invalid Image",      },
index 6a41c2e34e711450a608edde640eecf1920a48cf..466c98018fdc8f93b89cb4ebe4ad1853c6673e2c 100644 (file)
 #define IH_TYPE_UBLIMAGE       11      /* Davinci UBL Image            */
 #define IH_TYPE_OMAPIMAGE      12      /* TI OMAP Config Header Image  */
 #define IH_TYPE_AISIMAGE       13      /* TI Davinci AIS Image         */
+#define IH_TYPE_KERNEL_NOLOAD  14      /* OS Kernel Image, can run from any load address */
 
 /*
  * Compression Types
index 6ea3b462cdd76e40ccc1df3fa2cff04606e373c6..e9d072975bb8b330d5868699e73f11f18376ca95 100644 (file)
@@ -35,7 +35,8 @@ static image_header_t header;
 
 static int image_check_image_types(uint8_t type)
 {
-       if ((type > IH_TYPE_INVALID) && (type < IH_TYPE_FLATDT))
+       if (((type > IH_TYPE_INVALID) && (type < IH_TYPE_FLATDT)) ||
+           (type == IH_TYPE_KERNEL_NOLOAD))
                return EXIT_SUCCESS;
        else
                return EXIT_FAILURE;