From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] image: add support for Android's boot image format
Date: Tue, 22 Nov 2011 13:30:07 +0100 [thread overview]
Message-ID: <20111122123007.GA5755@linutronix.de> (raw)
In-Reply-To: <20111121201907.64E5D1ADFED2@gemini.denx.de>
* Wolfgang Denk | 2011-11-21 21:19:07 [+0100]:
>Dear Sebastian Andrzej Siewior,
Hi Wolfgang,
>Please provide _exact_ reference where this code has been copied from,
>see bullet 4 etc. at
>http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
>
>Also please provide exact information about the applicable licenses
>for this copied code.
I added a detailed description to the repository and the commit head
where I took it from.
>...
>> /* get image parameters */
>> - switch (genimg_get_format(os_hdr)) {
>> + img_type = genimg_get_format(os_hdr);
>> + switch (img_type) {
>...
>> +#ifdef CONFIG_ANDROID_BOOT_IMAGE
>> + } else if (img_type == IMAGE_FORMAT_ANDROID) {
>> + images.ep = images.os.load;
>> +#endif
>
>Why don't you handle the Andoid image case inside the switch() ?
Because the code flow looks like:
| if (images.legacy_hdr_valid) {
| images.ep = image_get_ep(&images.legacy_hdr_os_copy);
| #if defined(CONFIG_FIT)
| } else if (images.fit_uname_os) {
...
| }
| #endif
| #ifdef CONFIG_ANDROID_BOOT_IMAGE
...
| #endif
| } else {
| puts("Could not find kernel entry point!\n");
| return 1;
| }
|
So if I don't add an extra android block here, I end up in this else
part complaining about the entrypoint.
I guess that this part could be merged into the previous switch
statement if you want me to.
>> +#ifdef CONFIG_ANDROID_BOOT_IMAGE
>> +static char andr_tmp_str[ANDR_BOOT_ARGS_SIZE + 1];
>> +static int android_image_get_kernel(struct andr_img_hdr *hdr, int verify)
>> +{
>> + /*
>> + * Not all Android tools use the id field for signing the image with
>> + * sha1 (or anything) so we don't check it. It is not obvious that the
>> + * string is null terminated so we take care of this.
>> + */
>> + strncpy(andr_tmp_str, hdr->name, ANDR_BOOT_NAME_SIZE);
>> + andr_tmp_str[ANDR_BOOT_NAME_SIZE] = '\0';
>> + if (strlen(andr_tmp_str))
>> + printf("Android's image name: %s\n", andr_tmp_str);
>> +
>> + printf("Kernel load addr 0x%08x size %u KiB\n",
>> + hdr->kernel_addr, DIV_ROUND_UP(hdr->kernel_size, 1024));
>> + strncpy(andr_tmp_str, hdr->cmdline, ANDR_BOOT_ARGS_SIZE);
>> + andr_tmp_str[ANDR_BOOT_ARGS_SIZE] = '\0';
>> + if (strlen(andr_tmp_str)) {
>> + printf("Kernel command line: %s\n", andr_tmp_str);
>> + setenv("bootargs", andr_tmp_str);
>> + }
>> + if (hdr->ramdisk_size)
>> + printf("RAM disk load addr 0x%08x size %u KiB\n",
>> + hdr->ramdisk_addr,
>> + DIV_ROUND_UP(hdr->ramdisk_size, 1024));
>> + return 0;
>> +}
>> +#endif
>
>This and similar Android image related code shoudl eventually go into
>a separate file, exposing only a few functions.
Okay.
>> +#ifdef CONFIG_ANDROID_BOOT_IMAGE
>> + if (format == IMAGE_FORMAT_INVALID) {
>> + const struct andr_img_hdr *ahdr = img_addr;
>>
>> + if (!memcmp(ANDR_BOOT_MAGIC, ahdr->magic, ANDR_BOOT_MAGIC_SIZE))
>> + format = IMAGE_FORMAT_ANDROID;
>> + }
>> +#endif
>
>This is all we have for testing for a valid image?
More or less, yes. The fastboot client [0] does nothing else if you
provide it a kernel (and it creates the ANDROID image out of it).
The comment field is used by mkbootimg/mkbootimg.c tool to stash a sha1
checksum. The format how to create the sha1 checksum (i.e. pad, don't
pad, include header or not, ...) isn't documented (atleast I did not
find anything) so the only source of documentation is
the source code wich is under Apache2 license which is compatible with
GPLv3 but not with v2 so I can't look at it.
[0] http://android-dls.com/wiki/index.php?title=Fastboot
>> index 0000000..b231b66
>> --- /dev/null
>> +++ b/include/android_image.h
>> @@ -0,0 +1,89 @@
>> +/*
>> + * This is from the Android Project,
>> + * bootloader/legacy/include/boot/bootimg.h
>> + *
>> + * Copyright (C) 2008 The Android Open Source Project
>> + * All rights reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> + * are met:
>> + * * Redistributions of source code must retain the above copyright
>> + * notice, this list of conditions and the following disclaimer.
>> + * * Redistributions in binary form must reproduce the above copyright
>> + * notice, this list of conditions and the following disclaimer in
>> + * the documentation and/or other materials provided with the
>> + * distribution.
>
>Sorry, but this is not GPL compatible.
Ehm. Is this the All rights reserved issue? If so then I assumed that I
cleared up things in
http://lists.denx.de/pipermail/u-boot/2011-September/101793.html
>
>Best regards,
>
>Wolfgang Denk
Sebastian
next prev parent reply other threads:[~2011-11-22 12:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-21 14:09 [U-Boot] Fastboot gadget, v2. repost Sebastian Andrzej Siewior
2011-11-21 14:09 ` [U-Boot] [PATCH 1/2] image: add support for Android's boot image format Sebastian Andrzej Siewior
2011-11-21 20:19 ` Wolfgang Denk
2011-11-22 12:30 ` Sebastian Andrzej Siewior [this message]
2011-11-22 19:04 ` Wolfgang Denk
2011-11-23 10:03 ` Sebastian Andrzej Siewior
2012-01-17 9:16 ` Aneesh V
2012-02-02 9:28 ` Aneesh V
2012-02-08 17:36 ` Tom Rini
2012-03-17 22:05 ` Wolfgang Denk
2012-04-12 14:54 ` Aneesh V
2012-03-17 22:04 ` Wolfgang Denk
2011-11-21 14:09 ` [U-Boot] [PATCH 2/2] usb/gadget: add the fastboot gadget Sebastian Andrzej Siewior
2011-11-21 14:48 ` Stefan Schmidt
2011-11-23 10:27 ` Sebastian Andrzej Siewior
2012-01-08 4:56 ` Mike Frysinger
2012-05-28 13:50 ` [U-Boot] [PATCH 2/3] " Macpaul Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111122123007.GA5755@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.