Commit b9b50e89d317c58becd0e2d7fac2e21e3a81dd0a

Authored by Stephen Warren
Committed by Stefan Roese
1 parent a63d965275

image: Implement IH_TYPE_KERNEL_NOLOAD

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>

Showing 4 changed files with 13 additions and 2 deletions Side-by-side Diff

... ... @@ -272,7 +272,13 @@
272 272 return 1;
273 273 }
274 274  
  275 + if (images.os.type == IH_TYPE_KERNEL_NOLOAD) {
  276 + images.os.load = images.os.image_start;
  277 + images.ep += images.os.load;
  278 + }
  279 +
275 280 if (((images.os.type == IH_TYPE_KERNEL) ||
  281 + (images.os.type == IH_TYPE_KERNEL_NOLOAD) ||
276 282 (images.os.type == IH_TYPE_MULTI)) &&
277 283 (images.os.os == IH_OS_LINUX)) {
278 284 /* find ramdisk */
... ... @@ -796,7 +802,8 @@
796 802 }
797 803  
798 804 show_boot_progress(106);
799   - if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL)) {
  805 + if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL) &&
  806 + !fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL_NOLOAD)) {
800 807 puts("Not a kernel image\n");
801 808 show_boot_progress(-106);
802 809 return 0;
... ... @@ -874,6 +881,7 @@
874 881 /* get os_data and os_len */
875 882 switch (image_get_type(hdr)) {
876 883 case IH_TYPE_KERNEL:
  884 + case IH_TYPE_KERNEL_NOLOAD:
877 885 *os_data = image_get_data(hdr);
878 886 *os_len = image_get_data_size(hdr);
879 887 break;
... ... @@ -136,6 +136,7 @@
136 136 { IH_TYPE_FIRMWARE, "firmware", "Firmware", },
137 137 { IH_TYPE_FLATDT, "flat_dt", "Flat Device Tree", },
138 138 { IH_TYPE_KERNEL, "kernel", "Kernel Image", },
  139 + { IH_TYPE_KERNEL_NOLOAD, "kernel_noload", "Kernel Image (no loading done)", },
139 140 { IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",},
140 141 { IH_TYPE_IMXIMAGE, "imximage", "Freescale i.MX Boot Image",},
141 142 { IH_TYPE_INVALID, NULL, "Invalid Image", },
... ... @@ -162,6 +162,7 @@
162 162 #define IH_TYPE_UBLIMAGE 11 /* Davinci UBL Image */
163 163 #define IH_TYPE_OMAPIMAGE 12 /* TI OMAP Config Header Image */
164 164 #define IH_TYPE_AISIMAGE 13 /* TI Davinci AIS Image */
  165 +#define IH_TYPE_KERNEL_NOLOAD 14 /* OS Kernel Image, can run from any load address */
165 166  
166 167 /*
167 168 * Compression Types
tools/default_image.c
... ... @@ -35,7 +35,8 @@
35 35  
36 36 static int image_check_image_types(uint8_t type)
37 37 {
38   - if ((type > IH_TYPE_INVALID) && (type < IH_TYPE_FLATDT))
  38 + if (((type > IH_TYPE_INVALID) && (type < IH_TYPE_FLATDT)) ||
  39 + (type == IH_TYPE_KERNEL_NOLOAD))
39 40 return EXIT_SUCCESS;
40 41 else
41 42 return EXIT_FAILURE;