Fastboot gadget
This series contains a smaller version of the fastboot gadget. I removed the flash/mmc/write to media part and re-add once I'm through with this basic thing :)
This "basic" gadget supports the retrieval of variables (like serial number), reboot functionality, download of binary data and booting them in case the binary data is a bootable image.
I did not include the fastboot client in this series. Remy asked about this. I could take it and stash it in tools if someone really wants this to have. This would include the fastboot and libzipfile folder from Andorid's system/core repository. An online version can be found at [0]. I haven't seen the library somewhere else than Android. For basic testing, the library could be excluded.
[0] http://www.netmite.com/android/mydroid/system/core/
Sebastian
PATCH 1/3 image: add support for Android's boot image format
This patch adds support for the Android boot-image format. The header file is from the Android project and got slightly alterted so the struct + its defines are not generic but have something like a namespace. The header file is from bootloader/legacy/include/boot/bootimg.h. The header parsing has been written from scratch and I looked at bootloader/legacy/usbloader/usbloader.c for some details.
The image contains the physical address (load address) of the kernel and ramdisk. This address is considered only for the kernel image. The "second image" is currently ignored. I haven't found anything that is creating this.
--- common/cmd_bootm.c | 87 +++++++++++++++++++++++++++++++++++++++++++++- common/image.c | 17 +++++++++ include/android_image.h | 89 +++++++++++++++++++++++++++++++++++++++++++++++ include/image.h | 4 ++ 4 files changed, 196 insertions(+), 1 deletions(-) create mode 100644 include/android_image.h
common/cmd_bootm.c +86 -1
@@ -36,6 +36,7 @@#include <lmb.h> #include <linux/ctype.h> #include <asm/byteorder.h> +#include <android_image.h> #if defined(CONFIG_CMD_USB )#include <usb.h>
@@ -211,10 +212,33 @@ static void bootm_start_lmb(void)#endif } +#ifdef CONFIG_ANDROID_BOOT_IMAGE +static u32 android_img_get_end (struct andr_img_hdr *hdr) +{ +u32 size =0 ; +/* +* The header takes a full page, the remaining components are aligned +* on page boundary +*/ + size += hdr->page_size; + size +=ALIGN (hdr->kernel_size, hdr->page_size); + size +=ALIGN (hdr->ramdisk_size, hdr->page_size); + size +=ALIGN (hdr->second_size, hdr->page_size); + +return size; +} + +static u32 andoir_img_get_kload (struct andr_img_hdr *hdr) +{ +return hdr->kernel_addr; +} +#endif +static int bootm_start (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) {void *os_hdr;int ret; +int img_type;memset ((void *)&images,0 ,sizeof (images)); images.verify =getenv_yesno ("verify" );
@@ -230,7 +254,8 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] }/* get image parameters */ -switch (genimg_get_format (os_hdr)) { + img_type =genimg_get_format (os_hdr); +switch (img_type) {case IMAGE_FORMAT_LEGACY : images.os.type =image_get_type (os_hdr); images.os.comp =image_get_comp (os_hdr);
@@ -272,6 +297,16 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] }break ;#endif +#ifdef CONFIG_ANDROID_BOOT_IMAGE +case IMAGE_FORMAT_ANDROID : + images.os.type =IH_TYPE_KERNEL ; + images.os.comp =IH_COMP_NONE ; + images.os.os =IH_OS_LINUX ; + + images.os.end =android_img_get_end (os_hdr); + images.os.load =andoir_img_get_kload (os_hdr); +break ; +#endif default :puts ("ERROR: unknown image format type!\n" );return 1 ;
@@ -289,6 +324,10 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]return 1 ; }#endif +#ifdef CONFIG_ANDROID_BOOT_IMAGE + }else if (img_type ==IMAGE_FORMAT_ANDROID ) { + images.ep = images.os.load; +#endif }else {puts ("Could not find kernel entry point!\n" );return 1 ;
@@ -821,6 +860,36 @@ static int fit_check_kernel (const void *fit, int os_noffset, int verify) }#endif /* CONFIG_FIT */ +#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 +/** * boot_get_kernel - find kernel image * @os_data: pointer to a ulong variable, will hold os data start address
@@ -847,6 +916,9 @@ static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char * constint cfg_noffset;int os_noffset;#endif +#ifdef CONFIG_ANDROID_BOOT_IMAGE +struct andr_img_hdr *ahdr; +#endif /* find out kernel image address */ if (argc <2 ) {
@@ -980,6 +1052,19 @@ static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char * const images->fit_noffset_os = os_noffset;break ;#endif +#ifdef CONFIG_ANDROID_BOOT_IMAGE +case IMAGE_FORMAT_ANDROID : +printf ("## Booting Android Image at 0x%08lx ...\n" , img_addr); + ahdr = (void *)img_addr; +if (android_image_get_kernel (ahdr, images->verify)) +return NULL ; + + *os_data = img_addr; + *os_data += ahdr->page_size; + *os_len = ahdr->kernel_size; + images->ahdr = ahdr; +break ; +#endif default :printf ("Wrong Image Format for %s command\n" , cmdtp->name);show_boot_progress (-108 );
common/image.c +17 -0
@@ -26,6 +26,7 @@#ifndef USE_HOSTCC #include <common.h> #include <watchdog.h> +#include <android_image.h> #ifdef CONFIG_SHOW_BOOT_PROGRESS #include <status_led.h>
@@ -671,7 +672,14 @@ int genimg_get_format (void *img_addr) format =IMAGE_FORMAT_FIT ; }#endif +#ifdef CONFIG_ANDROID_BOOT_IMAGE + else { +const struct andr_img_hdr *ahdr = img_addr; +if (!memcmp (ANDR_BOOT_MAGIC , ahdr->magic,ANDR_BOOT_MAGIC_SIZE )) + format =IMAGE_FORMAT_ANDROID ; + } +#endif return format; }
@@ -993,6 +1001,15 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images, (ulong)images->legacy_hdr_os);image_multi_getimg (images->legacy_hdr_os,1 , &rd_data, &rd_len); +#ifdef CONFIG_ANDROID_BOOT_IMAGE +if (images->ahdr && images->ahdr->ramdisk_size) { + rd_data = (unsigned long ) images->ahdr; + rd_data += images->ahdr->page_size; + rd_data +=ALIGN (images->ahdr->kernel_size, + images->ahdr->page_size); + rd_len = images->ahdr->ramdisk_size; + } +#endif }else {/* * no initrd image
include/android_image.h new file +89 -0
89 lines not on this page · raw message
include/image.h +4 -0
@@ -261,6 +261,9 @@ typedef struct bootm_headers {#ifdef CONFIG_LMB struct lmb lmb;/* for memory mgmt */ #endif +#ifdef CONFIG_ANDROID_BOOT_IMAGE +struct andr_img_hdr *ahdr; +#endif } bootm_headers_t;/*
@@ -326,6 +329,7 @@ void genimg_print_size (uint32_t size);#define IMAGE_FORMAT_INVALID 0x00#define IMAGE_FORMAT_LEGACY 0x01/* legacy image_header based format */ #define IMAGE_FORMAT_FIT 0x02/* new, libfdt based format */ +#define IMAGE_FORMAT_ANDROID 0x03/* Android boot image */ int genimg_get_format (void *img_addr);int genimg_has_config (bootm_headers_t *images);
Signature · 1 line
1.7.5.4
PATCH 1/3 image: add support for Android's boot image format
Quoted 1 line · On Friday, September 16, 2011 12:51:17 Sebastian Andrzej Siewior wrote:
+#ifdef
CONFIG_ANDROID_BOOT_IMAGE
we already have a standard here: CONFIG_BOOTM_ANDROID
Quoted 1 line
+static u32
andoir_img_get_kload(struct andr_img_hdr *hdr)
looks like you missed a "d" in that "andoir"
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110916/68925473/attachment.pgp
PATCH 1/3 image: add support for Android's boot image format
Quoted 4 lines · Mike Frysinger
Quoted 1 line · On Friday, September 16, 2011 12:51:17 Sebastian Andrzej Siewior wrote:
+#ifdef
CONFIG_ANDROID_BOOT_IMAGEwe already have a standard here:
CONFIG_BOOTM_ANDROID
Ehm. Can't follow. If you want me to s/CONFIG_ANDROID_BOOT_IMAGE /CONFIG_BOOTM_ANDROID/ I sure can do this. The uImage has no CONFIG around it and the other format has CONFIG_FIT around it.
A grep for CONFIG_BOOTM_ returns LINUX, NETBSD and others. They differ in the calling ABI, argument passing etc. I do boot here a Linux image but not from an uImage.
Quoted 3 lines
Quoted 1 line
+static u32
andoir_img_get_kload(struct andr_img_hdr *hdr)looks like you missed a "d" in that "andoir"
yup, fixing, thanks.
Quoted 1 line
-mike
Sebastian
PATCH 1/3 image: add support for Android's boot image format
In reply to Sebastian Andrzej SiewiorDear Sebastian Andrzej Siewior,
Quoted 10 lines · In message <[email protected]> you wrote:
This patch adds support for the Android boot-image format. The header file is from the Android project and got slightly alterted so the struct + its defines are not generic but have something like a namespace. The header file is from
bootloader/legacy/include/boot/bootimg.h. The header parsing has been written from scratch and I looked atbootloader/legacy/usbloader/usbloader.cfor some details.
The image contains the physical address (load address) of the kernel and ramdisk. This address is considered only for the kernel image. The "second image" is currently ignored. I haven't found anything that is creating this.
...
Quoted 12 lines
+ * 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.
Quoted 14 lines
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
Are you 100% sure this is a GPLv2+ compatible license??? I don't think so...
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
He'd heard her use that sweet, innocent tone of voice before. It
meant that, pretty soon, there was going to be trouble.
- Terry Pratchett, _Truckers_PATCH 1/3 image: add support for Android's boot image format
Quoted 1 line · Wolfgang Denk
Dear Sebastian Andrzej Siewior,
Hi Wolfgang,
Quoted 27 lines
Quoted 12 lines
+ * 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.Quoted 14 lines
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
Quoted 2 lines
Are you 100% sure this is a GPLv2+ compatible license??? I don't think so...
How so? This is a 3-clause BSD license. According to [0] it is compatible. Is there anything I missed here?
[0] http://www.gnu.org/licenses/license-list.html#ModifiedBSD
Quoted 4 lines
Best regards,
Wolfgang Denk
Sebastian
PATCH 1/3 image: add support for Android's boot image format
Quoted 29 lines · On Friday, September 16, 2011 17:28:08 Sebastian Andrzej Siewior wrote:
Quoted 28 lines · Wolfgang Denk
Dear Sebastian Andrzej Siewior,
Quoted 26 lines
+ * 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.+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE.
+ */
Quoted 5 lines
Quoted 2 lines
Are you 100% sure this is a GPLv2+ compatible license??? I don't think so...
How so? This is a 3-clause BSD license. According to [0] it is compatible. Is there anything I missed here?
i think you mean 2-clause
http://en.wikipedia.org/wiki/BSD_License#2-
clause_license_.28.22Simplified_BSD_License.22_or_.22FreeBSD_License.22.29 -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110916/26d43361/attachment.pgp
PATCH 1/3 image: add support for Android's boot image format
Quoted 33 lines · Mike Frysinger
Quoted 32 lines · On Friday, September 16, 2011 17:28:08 Sebastian Andrzej Siewior wrote:
Quoted 30 lines · Wolfgang Denk
Dear Sebastian Andrzej Siewior,
Quoted 12 lines
+ * 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.Quoted 14 lines
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE.
+ */Are you 100% sure this is a GPLv2+ compatible license??? I don't think so...
Quoted 6 lines
Quoted 2 lines
How so? This is a 3-clause BSD license. According to [0] it is compatible. Is there anything I missed here?
i think you mean 2-clause
http://en.wikipedia.org/wiki/BSD_License#2-
clause_license_.28.22Simplified_BSD_License.22_or_.22FreeBSD_License.22.29
Ups, sorry, Yes, I do.
Quoted 1 line
-mike
Sebastian
PATCH 1/3 image: add support for Android's boot image format
In reply to Sebastian Andrzej SiewiorDear Sebastian Andrzej Siewior,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines
Are you 100% sure this is a GPLv2+ compatible license??? I don't think so...
How so? This is a 3-clause BSD license. According to [0] it is compatible. Is there anything I missed here?
The "All rights reserved." clause doesn't fit.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Do not underestimate the value of print statements for debugging. Don't have aesthetic convulsions when using them, either.
PATCH 1/3 image: add support for Android's boot image format
Quoted 1 line · Wolfgang Denk
Dear Sebastian Andrzej Siewior,
Hi Wolfgang,
Quoted 9 lines
Quoted 6 lines · In message<[email protected]> you wrote:
Quoted 3 lines
Are you 100% sure this is a GPLv2+ compatible license??? I don't think so...
How so? This is a 3-clause BSD license. According to [0] it is compatible. Is there anything I missed here?
The "All rights reserved." clause doesn't fit.
Are you sure? This type of license matches the FreeBSD license [0] (including the "All rights reserved" statement) and the FSF says that it is compatible with the GPL license [1].
I also see this in tools/fit_image.c which is GPLv2 or later and in include/elf.h which is a 3-clause BSD license.
So why does it not fit in here?
[0] http://www.freebsd.org/copyright/freebsd-license.html
[1] http://www.gnu.org/licenses/license-list.html#FreeBSD
Quoted 3 lines
Best regards,
Wolfgang Denk
Sebastian
PATCH 1/3 image: add support for Android's boot image format
Quoted 8 lines · On Saturday, September 17, 2011 15:33:40 Sebastian Andrzej Siewior wrote:
Quoted 7 lines · Wolfgang Denk
Quoted 5 lines · Sebastian Andrzej Siewior
Quoted 2 lines
Are you 100% sure this is a GPLv2+ compatible license??? I don't think so...
How so? This is a 3-clause BSD license. According to [0] it is compatible. Is there anything I missed here?
Quoted 8 lines
Quoted 1 line
The "All rights reserved." clause doesn't fit.
Are you sure? This type of license matches the FreeBSD license [0] (including the "All rights reserved" statement) and the FSF says that it is compatible with the GPL license [1].
I also see this intools/fit_image.cwhich is GPLv2 or later and ininclude/elf.hwhich is a 3-clause BSD license.
So why does it not fit in here?
the phrase is meaningless cruft nowadays:
http://en.wikipedia.org/wiki/All_Rights_Reserved
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110917/b5638470/attachment.pgp
PATCH 1/3 image: add support for Android's boot image format
In reply to Wolfgang DenkQuoted 1 line · * Wolfgang Denk | 2011-09-17 15:10:31 [+0200]:
Dear Sebastian Andrzej Siewior,
Hi Wolfgang,
Quoted 9 lines
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines
Are you 100% sure this is a GPLv2+ compatible license??? I don't think so...
How so? This is a 3-clause BSD license. According to [0] it is compatible. Is there anything I missed here?
The "All rights reserved." clause doesn't fit.
This is what I got from the FSF:
|As far as we know, the maintainer is incorrect on this point. "All |rights reserved" is legally null these days and poses no compatibility |issues. Years ago, it was required to trigger the international |copyright laws, but now that happens by default. |http://en.wikipedia.org/wiki/All_rights_reserved discusses the matter |briefly. | |In our view, the GPL and FreeBSD licenses are and remain compatible. | |Hope this helps. Best regards, |karl at gnu.org | |Disclaimer: I am not a lawyer, and this is not official legal advice.
This also matches what I've found at [0] in paragraph a).
[0] https://www.osadl.org/What-is-license-compatibility.faq2-4.0.html
Quoted 3 lines
Best regards,
Wolfgang Denk
Sebastian
PATCH 2/3 usb/gadget: add the fastboot gadget
In reply to Sebastian Andrzej SiewiorThis patch contains an implementation of the fastboot protocol on the device side and a little of documentation.
The gadget expects the new-style gadget framework.
The gadget implements the getvar, reboot, download and reboot commands. What is missing is the flash handling i.e. writting the image to media.
--- common/Makefile | 2 + common/cmd_fastboot.c | 28 ++ doc/README.android-fastboot | 86 ++++++ doc/README.android-fastboot-protocol | 170 +++++++++++ drivers/usb/gadget/Makefile | 5 + drivers/usb/gadget/f_fastboot.c | 549 ++++++++++++++++++++++++++++++++++ drivers/usb/gadget/g_fastboot.h | 20 ++ drivers/usb/gadget/u_fastboot.c | 308 +++++++++++++++++++ include/usb/fastboot.h | 95 ++++++ 9 files changed, 1263 insertions(+), 0 deletions(-) create mode 100644 common/cmd_fastboot.c create mode 100644 doc/README.android-fastboot create mode 100644 doc/README.android-fastboot-protocol create mode 100644 drivers/usb/gadget/f_fastboot.c create mode 100644 drivers/usb/gadget/g_fastboot.h create mode 100644 drivers/usb/gadget/u_fastboot.c create mode 100644 include/usb/fastboot.h
common/Makefile +2 -0
@@ -157,6 +157,8 @@ COBJS-y += cmd_usb.o COBJS-y += usb.o COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif +COBJS-$(CONFIG_CMD_FASTBOOT) += cmd_fastboot.o + COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
common/cmd_fastboot.c new file +28 -0
@@ -0,0 +1,28 @@ +#include <common.h> +#include <command.h> +#include <usb/fastboot.h> + +static int do_fastboot (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +int ret =1 ; + +if (!fastboot_init ()) { +printf ("Fastboot entered...\n" ); + + ret =0 ; + +while (1 ) { +if (fastboot_poll ()) +break ; + } + } + +fastboot_shutdown (); +return ret; +} + +U_BOOT_CMD ( + fastboot,1 ,1 , do_fastboot, +"fastboot- use USB Fastboot protocol\n" , +"" +);
doc/README.android-fastboot new file +86 -0
86 lines not on this page · raw message
doc/README.android-fastboot-protocol new file +170 -0
170 lines not on this page · raw message
drivers/usb/gadget/Makefile +5 -0
@@ -42,6 +42,11 @@ COBJS-$(CONFIG_SPEARUDC) += spr_udc.o endif endif +ifdef CONFIG_CMD_FASTBOOT +COBJS-y += f_fastboot.o u_fastboot.o +COBJS-y += epautoconf.o usbstring.o +endif + COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
drivers/usb/gadget/f_fastboot.c new file +549 -0
549 lines not on this page · raw message
drivers/usb/gadget/g_fastboot.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef _G_FASTBOOT_H_ +#define _G_FASTBOOT_H_ + +#define EP_BUFFER_SIZE 4096 +#define FASTBOOT_INTERFACE_CLASS 0xff +#define FASTBOOT_INTERFACE_SUB_CLASS 0x42 +#define FASTBOOT_INTERFACE_PROTOCOL 0x03 +#define FASTBOOT_VERSION "0.4" + +extern struct fastboot_config fb_cfg; +extern struct usb_ep *ep_in; +extern struct usb_request *req_in; +extern struct usb_ep *ep_out; +extern struct usb_request *req_out; + +void rx_handler_command (struct usb_ep *ep,struct usb_request *req); +int fastboot_tx_write (const char *buffer,unsigned int buffer_size); +const char *fb_find_usb_string (unsigned int id); + +#endif
drivers/usb/gadget/u_fastboot.c new file +308 -0
308 lines not on this page · raw message
include/usb/fastboot.h new file +95 -0
95 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 2/3 usb/gadget: add the fastboot gadget
Dear Sebastian Andrzej Siewior,
Quoted 7 lines · In message <[email protected]> you wrote:
This patch contains an implementation of the fastboot protocol on the device side and a little of documentation.
The gadget expects the new-style gadget framework.
The gadget implements the getvar, reboot, download and reboot commands. What is missing is the flash handling i.e. writting the image to media.Signed-off-by Sebastian Andrzej Siewior <[email protected]>
...
Quoted 8 lines
drivers/usb/gadget/f_fastboot.c new file +2
-0@@ -0,0 +1,549 @@ +/* +* The file is based on content which was
drivers/usb/gadget/f_fastboot.c line 12
Quoted 10 lines
drivers/usb/gadget/f_fastboot.c new file +10
-0+* (C) Copyright 2008 - 2009 +* Windriver, <www.windriver.com> +* Tom Rix <[email protected]> +* +* but after the chainsaw attack by +* Copyright (c) 2011 Sebastian Andrzej Siewior <[email protected]> +* +* there isn't much left. The license is in both cases GPLv2 as published +* by the FSF +*/
For U-Boot, we need GPLv2+. Please see bullet # 3 at
http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
and note # 1 at http://www.denx.de/wiki/view/U-Boot/Patches#Notes
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de That was the thing about deserts. They had their own gravity. They sucked you into the centre. - Terry Pratchett, _Small Gods_
PATCH 3/3 fastboot: add board specific implementation
In reply to Sebastian Andrzej SiewiorThis is just an example how the board specific implementation can look like. Not for merging.
--- board/ti/sdp4430/Makefile | 7 ++++--- board/ti/sdp4430/fastboot.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 board/ti/sdp4430/fastboot.c
board/ti/sdp4430/Makefile +4 -3
@@ -26,11 +26,12 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o ifndef CONFIG_SPL_BUILD -COBJS := sdp.o cmd_bat.o +COBJS-y := sdp.o cmd_bat.o +COBJS-$(CONFIG_CMD_FASTBOOT) += fastboot.o endif -SRCS := $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) +SRCS := $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) $(LIB): $(obj).depend $(OBJS) $(call cmd_link_o_target, $(OBJS))
board/ti/sdp4430/fastboot.c new file +36 -0
@@ -0,0 +1,36 @@ +#include <common.h> +#include <usb/fastboot.h> +#include <linux/usb/ch9.h> +#include <linux/usb/gadget.h> + +static struct usb_string def_usb_fb_strings[] = { + {FB_STR_SERIAL_IDX ,"abcd+efg" }, + {FB_STR_PROC_REV_IDX ,"ES0.0" }, + {FB_STR_PROC_TYPE_IDX ,"VirtIO" }, + { } +}; + +static struct usb_gadget_strings def_fb_strings = { + .language =0x0409 ,/* en-us */ + .strings = def_usb_fb_strings, +}; + +/* +* Hardcoded memory region to stash data which comes over USB before it is +* stored on media +*/ +DECLARE_GLOBAL_DATA_PTR ; +#define SZ_16M 0x01000000 +#define SZ_128M 0x08000000 +#define CFG_FASTBOOT_TRANSFER_BUFFER (void *)(gd->bd->bi_dram[0].start + SZ_16M) +#define CFG_FASTBOOT_TRANSFER_BUFFER_SIZE (SZ_128M - SZ_16M) + +int fastboot_board_init (struct fastboot_config *interface, +struct usb_gadget_strings **str) { + + interface->transfer_buffer =CFG_FASTBOOT_TRANSFER_BUFFER ; + interface->transfer_buffer_size =CFG_FASTBOOT_TRANSFER_BUFFER_SIZE ; + + *str = &def_fb_strings; +return 0 ; +}
Signature · 1 line
1.7.5.4
PATCH 3/3 fastboot: add board specific implementation
Dear Sebastian Andrzej Siewior,
Quoted 4 lines · In message <[email protected]> you wrote:
This is just an example how the board specific implementation can look like. Not for merging.
Signed-off-by Sebastian Andrzej Siewior <[email protected]>
...
board/ti/sdp4430/fastboot.c line 4
Quoted 7 lines
board/ti/sdp4430/fastboot.c new file +4
-0@@ -0,0 +1,36 @@ +#include <common.h> +#include <usb/fastboot.h> +#include <linux/usb/ch9.h> +#include <linux/usb/gadget.h>
Please _always_ add the required license header.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Lispers are among the best grads of the Sweep-It-Under-Someone- Else's-Carpet School of Simulated Simplicity. [Was that sufficiently incendiary? :-)] - Larry Wall in <[email protected]