[PATCH] tools: mkimage: Allow changing U-Boot image magic

Simon Glass sjg at chromium.org
Thu Jan 26 02:41:29 CET 2023


Hi Hauke,

On Mon, 23 Jan 2023 at 15:45, Hauke Mehrtens <hauke at hauke-m.de> wrote:
>
> On 1/23/23 19:49, Simon Glass wrote:
> > Hi,
> >
> > On Sun, 22 Jan 2023 at 07:20, Hauke Mehrtens <hauke at hauke-m.de> wrote:
> >>
> >> Extend mkimage with a new optional option -M to specify a special U-Boot
> >> image magic number. OpenWrt ships images for about 30 different boards
> >> with vendor boot loaders which are expecting the mkimage format, but
> >> with a different image magic.
> >>
> >> OpenWrt includes this patch for mkimage more than 10 years.
> >> It was added by Gabor Juhos in this commit:
> >> https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=f3d2056b81b7a92d28402c22736534d84fe23cfe
> >>
> >> Cc: Gabor Juhos <j4g8y7 at gmail.com>
> >> Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
> >> ---
> >>   tools/default_image.c |  4 ++--
> >>   tools/imagetool.h     |  1 +
> >>   tools/mkimage.c       | 14 ++++++++++++--
> >>   3 files changed, 15 insertions(+), 4 deletions(-)
> >
> > Strange...what is the different magic for?
>
> I do not know really know why some vendors do this. With Openwrt we
> create images which user can install on their devices. We normally do
> not change the vendor bootloader and create an image which is compatible
> with the vendor boot loader.
>
> I assume the vendors want to prevent users from installing "unsupported"
> images, but still want to use something close to the U-Boot image. With
> a different magic their boot loader (often vendor modified U-Boot) can
> prevent the user from installing "wrong" images.
>
> I saw this on many devices sold by NetGear for example these devices:
> NETGEAR WNDR4300
> NETGEAR WNDR4500
> NETGEAR WNR1000
> NETGEAR WNR612 v2
>
> I have also seen it from other vendors, probably some ODM or OEM does this.
>

OK, but I think it would be better to use a FIT, thus allowing the
vendor to add more info into the file.

Are the vendor bootloaders upstreamed?

Anyway, I don't see a big problem with doing this. Can you please
update the mkimage man page? Do we need to update dumpimage also?

Regards,
Simon


More information about the U-Boot mailing list