* [PATCH 1/4] hush: add getopt only if it enabled
2013-02-07 21:31 [PATCH v2 0/4] Small fixes in barebox Alexander Aring
@ 2013-02-07 21:31 ` Alexander Aring
2013-02-07 21:31 ` [PATCH 2/4] getopt: change optstring to const char* Alexander Aring
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2013-02-07 21:31 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] 7+ messages in thread
* [PATCH 2/4] getopt: change optstring to const char*
2013-02-07 21:31 [PATCH v2 0/4] Small fixes in barebox Alexander Aring
2013-02-07 21:31 ` [PATCH 1/4] hush: add getopt only if it enabled Alexander Aring
@ 2013-02-07 21:31 ` Alexander Aring
2013-02-07 21:31 ` [PATCH 3/4] sata-imx: fix depends on ARCH_IMX Alexander Aring
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2013-02-07 21:31 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] 7+ messages in thread
* [PATCH 3/4] sata-imx: fix depends on ARCH_IMX
2013-02-07 21:31 [PATCH v2 0/4] Small fixes in barebox Alexander Aring
2013-02-07 21:31 ` [PATCH 1/4] hush: add getopt only if it enabled Alexander Aring
2013-02-07 21:31 ` [PATCH 2/4] getopt: change optstring to const char* Alexander Aring
@ 2013-02-07 21:31 ` Alexander Aring
2013-02-07 21:31 ` [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP Alexander Aring
2013-02-08 8:37 ` [PATCH v2 0/4] Small fixes in barebox Sascha Hauer
4 siblings, 0 replies; 7+ 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/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] 7+ messages in thread
* [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP
2013-02-07 21:31 [PATCH v2 0/4] Small fixes in barebox Alexander Aring
` (2 preceding siblings ...)
2013-02-07 21:31 ` [PATCH 3/4] sata-imx: fix depends on ARCH_IMX Alexander Aring
@ 2013-02-07 21:31 ` Alexander Aring
2013-02-08 8:37 ` [PATCH v2 0/4] Small fixes in barebox Sascha Hauer
4 siblings, 0 replies; 7+ 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] 7+ messages in thread
* Re: [PATCH v2 0/4] Small fixes in barebox
2013-02-07 21:31 [PATCH v2 0/4] Small fixes in barebox Alexander Aring
` (3 preceding siblings ...)
2013-02-07 21:31 ` [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP Alexander Aring
@ 2013-02-08 8:37 ` Sascha Hauer
4 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2013-02-08 8:37 UTC (permalink / raw)
To: Alexander Aring; +Cc: barebox
On Thu, Feb 07, 2013 at 10:31:37PM +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.
>
> 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.
Applied, thanks
Sascha
>
>
> 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.
>
> v2:
> - fix commit msg in "net: fix cpsw depends on ARCH_OMAP" patch
>
> 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
>
--
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] 7+ messages in thread