* [PATCH 0/4] Small fixes in barebox
@ 2013-02-07 20:36 Alexander Aring
2013-02-07 20:36 ` [PATCH 1/4] hush: add getopt only if it enabled Alexander Aring
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Alexander Aring @ 2013-02-07 20:36 UTC (permalink / raw)
To: barebox
First I tried to change getopt optstring argument to "const char *"
and I test it with an allyesconfig for compiler warnings.
Then there popup some compile errors, which I tried to fix.
I am not happy with some of these solutions. Maybe someone have an idea
how we can make it better.
hush: add getopt only if it enabled
- I don't know if this needs a fix. But if we disable getopt there is a
no-op getopt implementation in the command list. This patch don't add
getopt to the command list at runtime, but the no-op implementation is
still there. Maybe a compiletime solution is better to remove the
no-op implementation.
sata-imx: fix depends on ARCH_IMX
- I am not sure but this looks like ARCH_IMX related things. I got a error
that some imx51 header files could'nt be found.
net: fix cpsw depends on ARCH_OMAP
- Same thing like sata-imx. I got a compile error that mach/cpsw.h wasn't
found. I only found that in the omap implementation.
Another (maybe toolchain related issue) is:
barebox/lib/libubigen.c:105: undefined reference to `__divdi3'
Is it in this line:
tmp = (vi->bytes + ui->leb_size - 1) / ui->leb_size;
If we know that ui->leb_size is a power-of-two, we can use a shift for this
instead of division. But I don't know if leb_size a power-of-two number.
Alexander Aring (4):
hush: add getopt only if it enabled
getopt: change optstring to const char*
sata-imx: fix depends on ARCH_IMX
net: fix cpsw depends on ARCH_OMAP
common/hush.c | 3 ++-
drivers/ata/Kconfig | 1 +
drivers/net/Kconfig | 1 +
include/getopt.h | 2 +-
lib/getopt.c | 4 ++--
5 files changed, 7 insertions(+), 4 deletions(-)
--
1.8.1.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/4] hush: add getopt only if it enabled
2013-02-07 20:36 [PATCH 0/4] Small fixes in barebox Alexander Aring
@ 2013-02-07 20:36 ` Alexander Aring
2013-02-07 20:36 ` [PATCH 2/4] getopt: change optstring to const char* Alexander Aring
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2013-02-07 20:36 UTC (permalink / raw)
To: barebox
This patch add getopt to the command list if it enabled via
Kconfig. With this patch we get a 'command not found' error.
Otherwise getopt doing nothing.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
common/hush.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/common/hush.c b/common/hush.c
index 1f468f6..602f8f1 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -782,7 +782,8 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
remove_quotes(globbuf.gl_pathc, globbuf.gl_pathv);
- if (!strcmp(globbuf.gl_pathv[0], "getopt")) {
+ if (!strcmp(globbuf.gl_pathv[0], "getopt") &&
+ IS_ENABLED(CONFIG_HUSH_GETOPT)) {
ret = builtin_getopt(ctx, child, globbuf.gl_pathc, globbuf.gl_pathv);
} else if (!strcmp(globbuf.gl_pathv[0], "exit")) {
ret = builtin_exit(ctx, child, globbuf.gl_pathc, globbuf.gl_pathv);
--
1.8.1.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/4] getopt: change optstring to const char*
2013-02-07 20:36 [PATCH 0/4] Small fixes in barebox Alexander Aring
2013-02-07 20:36 ` [PATCH 1/4] hush: add getopt only if it enabled Alexander Aring
@ 2013-02-07 20:36 ` Alexander Aring
2013-02-07 20:36 ` [PATCH 3/4] sata-imx: fix depends on ARCH_IMX Alexander Aring
` (2 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2013-02-07 20:36 UTC (permalink / raw)
To: barebox
Change getopt optstring parameter type to const char *.
Also change type to const char * of tmp variable which
pointed to optstring. This will only handle readonly.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
include/getopt.h | 2 +-
lib/getopt.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/getopt.h b/include/getopt.h
index f23175f..4f48ba8 100644
--- a/include/getopt.h
+++ b/include/getopt.h
@@ -35,7 +35,7 @@ extern char *optarg;
* - options can be mixed with nonoptions (like ls /bin -R)
*/
-int getopt(int argc, char *argv[], char *optstring);
+int getopt(int argc, char *argv[], const char *optstring);
struct getopt_context {
int opterr;
diff --git a/lib/getopt.c b/lib/getopt.c
index ead9150..fd12a88 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -56,10 +56,10 @@ void getopt_context_restore(struct getopt_context *gc)
}
EXPORT_SYMBOL(getopt_context_restore);
-int getopt(int argc, char *argv[], char *optstring)
+int getopt(int argc, char *argv[], const char *optstring)
{
char curopt; /* current option character */
- char *curoptp; /* pointer to the current option in optstring */
+ const char *curoptp; /* pointer to the current option in optstring */
while(1) {
debug("optindex: %d nonopts: %d optind: %d\n", optindex, nonopts, optind);
--
1.8.1.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/4] sata-imx: fix depends on ARCH_IMX
2013-02-07 20:36 [PATCH 0/4] Small fixes in barebox Alexander Aring
2013-02-07 20:36 ` [PATCH 1/4] hush: add getopt only if it enabled Alexander Aring
2013-02-07 20:36 ` [PATCH 2/4] getopt: change optstring to const char* Alexander Aring
@ 2013-02-07 20:36 ` Alexander Aring
2013-02-07 20:36 ` [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP Alexander Aring
2013-02-07 21:35 ` [PATCH 0/4] Small fixes in barebox Sascha Hauer
4 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2013-02-07 20:36 UTC (permalink / raw)
To: barebox
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
drivers/ata/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index ff6528a..42f2065 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -38,6 +38,7 @@ config DISK_AHCI
select DISK_DRIVE
config DISK_AHCI_IMX
+ depends on ARCH_IMX
depends on DISK_AHCI
bool "i.MX AHCI support"
--
1.8.1.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP
2013-02-07 20:36 [PATCH 0/4] Small fixes in barebox Alexander Aring
` (2 preceding siblings ...)
2013-02-07 20:36 ` [PATCH 3/4] sata-imx: fix depends on ARCH_IMX Alexander Aring
@ 2013-02-07 20:36 ` Alexander Aring
2013-02-07 21:27 ` Alexander Aring
2013-02-07 21:35 ` [PATCH 0/4] Small fixes in barebox Sascha Hauer
4 siblings, 1 reply; 12+ messages in thread
From: Alexander Aring @ 2013-02-07 20:36 UTC (permalink / raw)
To: barebox
drivers/net/cpsw.c:34:23: fatal error: mach/cpsw.h: No such file or directory
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
drivers/net/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index cf6ceee..2b7decd 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -33,6 +33,7 @@ config DRIVER_NET_CS8900
config DRIVER_NET_CPSW
bool "CPSW ethernet driver"
+ depends on ARCH_OMAP
select PHYLIB
config DRIVER_NET_SMC911X
--
1.8.1.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP
2013-02-07 20:36 ` [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP Alexander Aring
@ 2013-02-07 21:27 ` Alexander Aring
0 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2013-02-07 21:27 UTC (permalink / raw)
To: barebox
Hi,
On Thu, Feb 07, 2013 at 09:36:20PM +0100, Alexander Aring wrote:
> drivers/net/cpsw.c:34:23: fatal error: mach/cpsw.h: No such file or directory
grml, I should resend them with an empty commit msg.
Sorry.
Regards
Alex
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/4] Small fixes in barebox
2013-02-07 20:36 [PATCH 0/4] Small fixes in barebox Alexander Aring
` (3 preceding siblings ...)
2013-02-07 20:36 ` [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP Alexander Aring
@ 2013-02-07 21:35 ` Sascha Hauer
2013-02-07 21:41 ` Sascha Hauer
2013-02-07 21:47 ` Alexander Aring
4 siblings, 2 replies; 12+ messages in thread
From: Sascha Hauer @ 2013-02-07 21:35 UTC (permalink / raw)
To: Alexander Aring; +Cc: barebox
On Thu, Feb 07, 2013 at 09:36:16PM +0100, Alexander Aring wrote:
> First I tried to change getopt optstring argument to "const char *"
> and I test it with an allyesconfig for compiler warnings.
>
> Then there popup some compile errors, which I tried to fix.
>
> I am not happy with some of these solutions. Maybe someone have an idea
> how we can make it better.
>
> hush: add getopt only if it enabled
> - I don't know if this needs a fix. But if we disable getopt there is a
> no-op getopt implementation in the command list. This patch don't add
> getopt to the command list at runtime, but the no-op implementation is
> still there. Maybe a compiletime solution is better to remove the
> no-op implementation.
I don't understand. getopt is not there if CONFIG_HUSH_GETOPT is
disabled. It's ifdeffed out.
>
> sata-imx: fix depends on ARCH_IMX
> - I am not sure but this looks like ARCH_IMX related things. I got a error
> that some imx51 header files could'nt be found.
That's fine you did this. Another option would be to move the header
file to include/, but currently this is not worth it.
>
> net: fix cpsw depends on ARCH_OMAP
> - Same thing like sata-imx. I got a compile error that mach/cpsw.h wasn't
> found. I only found that in the omap implementation.
Also fine.
>
>
> Another (maybe toolchain related issue) is:
> barebox/lib/libubigen.c:105: undefined reference to `__divdi3'
>
> Is it in this line:
>
> tmp = (vi->bytes + ui->leb_size - 1) / ui->leb_size;
>
> If we know that ui->leb_size is a power-of-two, we can use a shift for this
> instead of division. But I don't know if leb_size a power-of-two number.
leb_size (logical erase block size) is never a power of two. This is the
peb size (physical erase block size) minus the ubi metadata.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/4] Small fixes in barebox
2013-02-07 21:35 ` [PATCH 0/4] Small fixes in barebox Sascha Hauer
@ 2013-02-07 21:41 ` Sascha Hauer
2013-02-07 21:50 ` Alexander Aring
2013-02-07 21:47 ` Alexander Aring
1 sibling, 1 reply; 12+ messages in thread
From: Sascha Hauer @ 2013-02-07 21:41 UTC (permalink / raw)
To: Alexander Aring; +Cc: barebox
On Thu, Feb 07, 2013 at 10:35:24PM +0100, Sascha Hauer wrote:
> On Thu, Feb 07, 2013 at 09:36:16PM +0100, Alexander Aring wrote:
> > First I tried to change getopt optstring argument to "const char *"
> > and I test it with an allyesconfig for compiler warnings.
> >
> > Then there popup some compile errors, which I tried to fix.
> >
> > I am not happy with some of these solutions. Maybe someone have an idea
> > how we can make it better.
> >
> > hush: add getopt only if it enabled
> > - I don't know if this needs a fix. But if we disable getopt there is a
> > no-op getopt implementation in the command list. This patch don't add
> > getopt to the command list at runtime, but the no-op implementation is
> > still there. Maybe a compiletime solution is better to remove the
> > no-op implementation.
>
> I don't understand. getopt is not there if CONFIG_HUSH_GETOPT is
> disabled. It's ifdeffed out.
Ah, now I got it. You miss the 'unknown command... message'. Then the
patch seems fine.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/4] Small fixes in barebox
2013-02-07 21:35 ` [PATCH 0/4] Small fixes in barebox Sascha Hauer
2013-02-07 21:41 ` Sascha Hauer
@ 2013-02-07 21:47 ` Alexander Aring
1 sibling, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2013-02-07 21:47 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi Sascha,
On Thu, Feb 07, 2013 at 10:35:24PM +0100, Sascha Hauer wrote:
> On Thu, Feb 07, 2013 at 09:36:16PM +0100, Alexander Aring wrote:
> > First I tried to change getopt optstring argument to "const char *"
> > and I test it with an allyesconfig for compiler warnings.
> >
> > Then there popup some compile errors, which I tried to fix.
> >
> > I am not happy with some of these solutions. Maybe someone have an idea
> > how we can make it better.
> >
> > hush: add getopt only if it enabled
> > - I don't know if this needs a fix. But if we disable getopt there is a
> > no-op getopt implementation in the command list. This patch don't add
> > getopt to the command list at runtime, but the no-op implementation is
> > still there. Maybe a compiletime solution is better to remove the
> > no-op implementation.
>
> I don't understand. getopt is not there if CONFIG_HUSH_GETOPT is
> disabled. It's ifdeffed out.
>
Yes it's ifdeffed out with an empty no-op getopt implementation. But
this will be add to the barebox command list.
So if we type "getopt" we don't get a "Unknown command" message, barebox
run only a no-op getopt implementation.
This patch will don't add getopt to the command list if we don't enable
it. I let the no-op getopt implementation there, otherwise we get a
compiler warning.
Regards
Alex
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/4] Small fixes in barebox
2013-02-07 21:41 ` Sascha Hauer
@ 2013-02-07 21:50 ` Alexander Aring
2013-02-08 8:29 ` Sascha Hauer
0 siblings, 1 reply; 12+ messages in thread
From: Alexander Aring @ 2013-02-07 21:50 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi,
On Thu, Feb 07, 2013 at 10:41:56PM +0100, Sascha Hauer wrote:
> On Thu, Feb 07, 2013 at 10:35:24PM +0100, Sascha Hauer wrote:
> > On Thu, Feb 07, 2013 at 09:36:16PM +0100, Alexander Aring wrote:
> > > First I tried to change getopt optstring argument to "const char *"
> > > and I test it with an allyesconfig for compiler warnings.
> > >
> > > Then there popup some compile errors, which I tried to fix.
> > >
> > > I am not happy with some of these solutions. Maybe someone have an idea
> > > how we can make it better.
> > >
> > > hush: add getopt only if it enabled
> > > - I don't know if this needs a fix. But if we disable getopt there is a
> > > no-op getopt implementation in the command list. This patch don't add
> > > getopt to the command list at runtime, but the no-op implementation is
> > > still there. Maybe a compiletime solution is better to remove the
> > > no-op implementation.
> >
> > I don't understand. getopt is not there if CONFIG_HUSH_GETOPT is
> > disabled. It's ifdeffed out.
>
> Ah, now I got it. You miss the 'unknown command... message'. Then the
> patch seems fine.
>
Yea, it's only a small thing... I don't know if this is necessary. :-)
Maybe there is a special reason for that no error occurs.
Regards
Alex
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/4] Small fixes in barebox
2013-02-07 21:50 ` Alexander Aring
@ 2013-02-08 8:29 ` Sascha Hauer
0 siblings, 0 replies; 12+ messages in thread
From: Sascha Hauer @ 2013-02-08 8:29 UTC (permalink / raw)
To: Alexander Aring; +Cc: barebox
On Thu, Feb 07, 2013 at 10:50:54PM +0100, Alexander Aring wrote:
> Hi,
>
> On Thu, Feb 07, 2013 at 10:41:56PM +0100, Sascha Hauer wrote:
> > On Thu, Feb 07, 2013 at 10:35:24PM +0100, Sascha Hauer wrote:
> > > On Thu, Feb 07, 2013 at 09:36:16PM +0100, Alexander Aring wrote:
> > > > First I tried to change getopt optstring argument to "const char *"
> > > > and I test it with an allyesconfig for compiler warnings.
> > > >
> > > > Then there popup some compile errors, which I tried to fix.
> > > >
> > > > I am not happy with some of these solutions. Maybe someone have an idea
> > > > how we can make it better.
> > > >
> > > > hush: add getopt only if it enabled
> > > > - I don't know if this needs a fix. But if we disable getopt there is a
> > > > no-op getopt implementation in the command list. This patch don't add
> > > > getopt to the command list at runtime, but the no-op implementation is
> > > > still there. Maybe a compiletime solution is better to remove the
> > > > no-op implementation.
> > >
> > > I don't understand. getopt is not there if CONFIG_HUSH_GETOPT is
> > > disabled. It's ifdeffed out.
> >
> > Ah, now I got it. You miss the 'unknown command... message'. Then the
> > patch seems fine.
> >
>
> Yea, it's only a small thing... I don't know if this is necessary. :-)
> Maybe there is a special reason for that no error occurs.
Well the patch will result in dropping the unnecessary strcmp, so a
slightly smaller binary.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP
2013-02-07 21:31 [PATCH v2 " Alexander Aring
@ 2013-02-07 21:31 ` Alexander Aring
0 siblings, 0 replies; 12+ messages in thread
From: Alexander Aring @ 2013-02-07 21:31 UTC (permalink / raw)
To: barebox
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
drivers/net/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index cf6ceee..2b7decd 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -33,6 +33,7 @@ config DRIVER_NET_CS8900
config DRIVER_NET_CPSW
bool "CPSW ethernet driver"
+ depends on ARCH_OMAP
select PHYLIB
config DRIVER_NET_SMC911X
--
1.8.1.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-02-08 8:29 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-07 20:36 [PATCH 0/4] Small fixes in barebox Alexander Aring
2013-02-07 20:36 ` [PATCH 1/4] hush: add getopt only if it enabled Alexander Aring
2013-02-07 20:36 ` [PATCH 2/4] getopt: change optstring to const char* Alexander Aring
2013-02-07 20:36 ` [PATCH 3/4] sata-imx: fix depends on ARCH_IMX Alexander Aring
2013-02-07 20:36 ` [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP Alexander Aring
2013-02-07 21:27 ` Alexander Aring
2013-02-07 21:35 ` [PATCH 0/4] Small fixes in barebox Sascha Hauer
2013-02-07 21:41 ` Sascha Hauer
2013-02-07 21:50 ` Alexander Aring
2013-02-08 8:29 ` Sascha Hauer
2013-02-07 21:47 ` Alexander Aring
2013-02-07 21:31 [PATCH v2 " Alexander Aring
2013-02-07 21:31 ` [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP Alexander Aring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox