Patchwork kobs-ng: new package

login
register
mail settings
Submitter Paul B. Henson
Date July 29, 2013, 3:14 a.m.
Message ID <20130729031743.9E00A5C125@zaphod.pbhware.com>
Download mbox | patch
Permalink /patch/262652/
State Changes Requested
Headers show

Comments

Paul B. Henson - July 29, 2013, 3:14 a.m.
Signed-off-by: Paul B. Henson <henson@acm.org>
---
 package/Config.in             |    1 +
 package/kobs-ng/Config.in     |    4 ++
 package/kobs-ng/kobs-ng.mk    |   18 +++++++++++
 package/kobs-ng/kobs-ng.patch |   67 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 90 insertions(+), 0 deletions(-)
 create mode 100644 package/kobs-ng/Config.in
 create mode 100644 package/kobs-ng/kobs-ng.mk
 create mode 100644 package/kobs-ng/kobs-ng.patch
Thomas Petazzoni - July 29, 2013, 6:54 p.m.
Dear Paul B. Henson,

On Sun, 28 Jul 2013 20:14:14 -0700, Paul B. Henson wrote:
> Signed-off-by: Paul B. Henson <henson@acm.org>
> ---
>  package/Config.in             |    1 +
>  package/kobs-ng/Config.in     |    4 ++
>  package/kobs-ng/kobs-ng.mk    |   18 +++++++++++
>  package/kobs-ng/kobs-ng.patch |   67 +++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 90 insertions(+), 0 deletions(-)
>  create mode 100644 package/kobs-ng/Config.in
>  create mode 100644 package/kobs-ng/kobs-ng.mk
>  create mode 100644 package/kobs-ng/kobs-ng.patch
> 
> diff --git a/package/Config.in b/package/Config.in
> index ed373de..c16b306 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -207,6 +207,7 @@ source "package/f2fs-tools/Config.in"
>  source "package/flashbench/Config.in"
>  source "package/genext2fs/Config.in"
>  source "package/genromfs/Config.in"
> +source "package/kobs-ng/Config.in"
>  source "package/makedevs/Config.in"
>  source "package/mtd/Config.in"
>  source "package/nfs-utils/Config.in"

Not sure it should be with the filesystem tools. Maybe just Hardware
handling?

> diff --git a/package/kobs-ng/Config.in b/package/kobs-ng/Config.in
> new file mode 100644
> index 0000000..6204af4
> --- /dev/null
> +++ b/package/kobs-ng/Config.in
> @@ -0,0 +1,4 @@
> +config BR2_PACKAGE_KOBS_NG
> +	bool "kobs-ng"
> +	help
> +	  Build freescale kobs-ng utility for burning bootstreams to NAND

Missing upstream URL.

> diff --git a/package/kobs-ng/kobs-ng.mk b/package/kobs-ng/kobs-ng.mk
> new file mode 100644
> index 0000000..8f877ca
> --- /dev/null
> +++ b/package/kobs-ng/kobs-ng.mk
> @@ -0,0 +1,18 @@
> +################################################################################
> +#
> +# kobs-ng
> +#
> +################################################################################
> +
> +# kobs-ng versions have never made much sense :(
> +KOBS_NG_VERSION = 3.0.35-4.0.0
> +KOBS_NG_SOURCE = kobs-ng-$(KOBS_NG_VERSION).tar.gz

Not needed, this is the default.

> +KOBS_NG_SITE = http://repository.timesys.com/buildsources/k/kobs-ng/kobs-ng-$(KOBS_NG_VERSION)/
> +KOBS_NG_LICENSE = GPLv2
> +KOBS_NG_LICENSE_FILES = COPYING
> +
> +define KOBS_NG_INSTALL_TARGET_CMDS
> +  install -D -m 0755 $(@D)/src/kobs-ng $(TARGET_DIR)/usr/sbin
> +endef

Isn't the default 'make install' working properly? Otherwise:
 - indentation is one tab, not two spaces
 - $(INSTALL) and not install
 - when using -D, you must pass a full path as second argument, i.e
   $(TARGET_DIR)/usr/sbin/kobs-ng

> +$(eval $(autotools-package))

I'm not sure to understand how this tool is typically used. On the
target itself? But then how do you get something on the target from the
first place if the tool is needed to flash a bootloader in NAND?

> diff --git a/package/kobs-ng/kobs-ng.patch b/package/kobs-ng/kobs-ng.patch
> new file mode 100644
> index 0000000..7e7ccb3
> --- /dev/null
> +++ b/package/kobs-ng/kobs-ng.patch

This patch lacks a header with description and Signed-off-by. Also, is
there a chance that you can submit it upstream?

Thanks,

Thomas
Paul B. Henson - July 31, 2013, 2:41 a.m.
On 7/29/2013 11:54 AM, Thomas Petazzoni wrote:

> Not sure it should be with the filesystem tools. Maybe just Hardware
> handling?

The menu says "Filesystem and flash utilities", kobs-ng is a flash 
utility, so it initially made sense to me. I can move it to the hardware 
section if you prefer.

>> +	bool "kobs-ng"
>> +	help
>> +	  Build freescale kobs-ng utility for burning bootstreams to NAND
>
> Missing upstream URL.

There isn't really an upstream URL for this specific package. Although 
it is GPL, and freely distributable, Freescale releases it as part of 
their board support packages, not as a standalone package. The only way 
to get it from Freescale is by downloading an entire BSP, each one of 
which usually has a different version of kobs-ng in it.

It's similar to the existing Freescale elftosb package already in the 
tree. Although it doesn't look like there is a Config.in in the elftosb 
directory, only elftosb.mk, so I'm not sure what the current status of 
that package is.

I see there are also a few other Freescale specific firmware and library 
packages in the tree (freescale-imx directory), they all say "This 
library is provided by Freescale as-is and doesn't have an upstream.", 
should I just put something similar?

>> +# kobs-ng versions have never made much sense :(
>> +KOBS_NG_VERSION = 3.0.35-4.0.0
>> +KOBS_NG_SOURCE = kobs-ng-$(KOBS_NG_VERSION).tar.gz
>
> Not needed, this is the default.

You mean the source line, not the version line, right?

> Isn't the default 'make install' working properly?

I remember having problems with it on an earlier version, I'll test 
again with this version and see if they were resolved.

> I'm not sure to understand how this tool is typically used. On the
> target itself? But then how do you get something on the target from the
> first place if the tool is needed to flash a bootloader in NAND?

Yes, the tool is typically used on the target itself. I don't have 
extensive experience with freescale, but my understanding is you 
typically bootstrap via some other boot method (SD card, USB-DFU, etc) 
to initially burn a bootstream to NAND. At that point, you can update 
the bootloader in an environment booted from NAND. u-boot has a tool 
called mxsboot that tries to generate a bootstream image that can be 
burned directly to NAND, but it makes a lot of assumptions about things 
kobs-ng determines dynamically and it seems more reliable to use the 
freescale purposed tool on the actual target environment.

> This patch lacks a header with description and Signed-off-by. Also, is
> there a chance that you can submit it upstream?

I'll add a header. I'm really not sure how one would submit changes to 
freescale upstream; AFAIK their code repository is not public and they 
don't have a mailing list for this tool's development. They have some 
general-purpose forums, and there are a fair number of freescale 
employees subscribed to various embedded oriented mailing lists (perhaps 
even this one?), but short of purchasing a support contract I don't know 
that there is any way to get official freescale notice of a patch 
submission.

Thanks…
Paul B. Henson - Aug. 4, 2013, 2:54 a.m.
On Tue, Jul 30, 2013 at 07:41:10PM -0700, Paul B. Henson wrote:
> On 7/29/2013 11:54 AM, Thomas Petazzoni wrote:
> 
> > Not sure it should be with the filesystem tools. Maybe just Hardware
> > handling?
> 
> The menu says "Filesystem and flash utilities", kobs-ng is a flash 
> utility, so it initially made sense to me. I can move it to the hardware 
> section if you prefer.

I resubmitted the patch to add kobs-ng; I think I addressed all of your
feedback other than the category. I don't think I saw a response to
this, so I left it in the flash utility category. I can move it to the
hardware handling category and resubmit if you still think that's a
better place for it.

Thanks...

Patch

diff --git a/package/Config.in b/package/Config.in
index ed373de..c16b306 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -207,6 +207,7 @@  source "package/f2fs-tools/Config.in"
 source "package/flashbench/Config.in"
 source "package/genext2fs/Config.in"
 source "package/genromfs/Config.in"
+source "package/kobs-ng/Config.in"
 source "package/makedevs/Config.in"
 source "package/mtd/Config.in"
 source "package/nfs-utils/Config.in"
diff --git a/package/kobs-ng/Config.in b/package/kobs-ng/Config.in
new file mode 100644
index 0000000..6204af4
--- /dev/null
+++ b/package/kobs-ng/Config.in
@@ -0,0 +1,4 @@ 
+config BR2_PACKAGE_KOBS_NG
+	bool "kobs-ng"
+	help
+	  Build freescale kobs-ng utility for burning bootstreams to NAND
diff --git a/package/kobs-ng/kobs-ng.mk b/package/kobs-ng/kobs-ng.mk
new file mode 100644
index 0000000..8f877ca
--- /dev/null
+++ b/package/kobs-ng/kobs-ng.mk
@@ -0,0 +1,18 @@ 
+################################################################################
+#
+# kobs-ng
+#
+################################################################################
+
+# kobs-ng versions have never made much sense :(
+KOBS_NG_VERSION = 3.0.35-4.0.0
+KOBS_NG_SOURCE = kobs-ng-$(KOBS_NG_VERSION).tar.gz
+KOBS_NG_SITE = http://repository.timesys.com/buildsources/k/kobs-ng/kobs-ng-$(KOBS_NG_VERSION)/
+KOBS_NG_LICENSE = GPLv2
+KOBS_NG_LICENSE_FILES = COPYING
+
+define KOBS_NG_INSTALL_TARGET_CMDS
+  install -D -m 0755 $(@D)/src/kobs-ng $(TARGET_DIR)/usr/sbin
+endef
+
+$(eval $(autotools-package))
diff --git a/package/kobs-ng/kobs-ng.patch b/package/kobs-ng/kobs-ng.patch
new file mode 100644
index 0000000..7e7ccb3
--- /dev/null
+++ b/package/kobs-ng/kobs-ng.patch
@@ -0,0 +1,67 @@ 
+diff -u -r kobs-ng-3.0.35-4.0.0-orig/src/mtd.c kobs-ng-3.0.35-4.0.0/src/mtd.c
+--- kobs-ng-3.0.35-4.0.0-orig/src/mtd.c	2012-12-17 22:37:40.000000000 -0800
++++ kobs-ng-3.0.35-4.0.0/src/mtd.c	2013-07-28 19:39:59.000000000 -0700
+@@ -852,8 +852,11 @@
+ 		mp = &md->part[i];
+ 
+ 		if (mp->fd != -1) {
++/* Newer kernels dropped MEMSETOOBSEL */
++#ifdef MEMSETOOBSEL
+ 			(void)ioctl(mp->fd, MEMSETOOBSEL,
+ 					&mp->old_oobinfo);
++#endif
+ 			close(mp->fd);
+ 		}
+ 
+@@ -896,6 +899,8 @@
+ 				continue;
+ 			}
+ 
++/* Newer kernels dropped MEMSETOOBSEL */
++#ifdef MEMSETOOBSEL
+ 			if (r == -ENOTTY) {
+ 				r = ioctl(mp->fd, MEMSETOOBSEL, &mp->old_oobinfo);
+ 				if (r != 0) {
+@@ -904,6 +909,7 @@
+ 				}
+ 				mp->oobinfochanged = 0;
+ 			}
++#endif
+ 		} else {
+ 			r = ioctl(mp->fd, MTDFILEMODE, (void *)MTD_MODE_RAW);
+ 			if (r != 0 && r != -ENOTTY) {
+@@ -911,6 +917,8 @@
+ 				continue;
+ 			}
+ 
++/* Newer kernels dropped MEMSETOOBSEL */
++#ifdef MEMSETOOBSEL
+ 			if (r == -ENOTTY) {
+ 				r = ioctl(mp->fd, MEMSETOOBSEL, &none_oobinfo);
+ 				if (r != 0) {
+@@ -920,6 +928,7 @@
+ 				mp->oobinfochanged = 1;
+ 			} else
+ 				mp->oobinfochanged = 2;
++#endif
+ 		}
+ 
+ 		mp->ecc = ecc;
+diff -u -r kobs-ng-3.0.35-4.0.0-orig/src/mtd.h kobs-ng-3.0.35-4.0.0/src/mtd.h
+--- kobs-ng-3.0.35-4.0.0-orig/src/mtd.h	2012-12-17 22:37:40.000000000 -0800
++++ kobs-ng-3.0.35-4.0.0/src/mtd.h	2013-07-28 19:33:57.000000000 -0700
+@@ -31,6 +31,14 @@
+ #include "BootControlBlocks.h"
+ #include "rom_nand_hamming_code_ecc.h"
+ 
++// Newer kernel headers renamed define
++#ifndef MTD_MODE_NORMAL
++#define MTD_MODE_NORMAL MTD_FILE_MODE_NORMAL
++#endif
++#ifndef MTD_MODE_RAW
++#define MTD_MODE_RAW MTD_FILE_MODE_RAW
++#endif
++
+ //------------------------------------------------------------------------------
+ // Re-definitions of true and false, because the standard ones aren't good
+ // enough?