Small fixes in barebox
Subsystems (3)
v2 cover Small fixes in 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.
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(-)
Signature · 7 lines
1.8.1.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 1/4 hush: add getopt only if it enabled
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.
--- common/hush.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/hush.c +2 -1
@@ -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);
Signature · 7 lines
1.8.1.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 2/4 getopt: change optstring to const char*
In reply to Alexander AringChange 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.
--- include/getopt.h | 2 +- lib/getopt.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/getopt.h +1 -1
@@ -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;
lib/getopt.c +2 -2
@@ -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);
Signature · 7 lines
1.8.1.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 3/4 sata-imx: fix depends on ARCH_IMX
In reply to Alexander Aring--- drivers/ata/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/ata/Kconfig +1 -0
@@ -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"
Signature · 7 lines
1.8.1.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 4/4 net: fix cpsw depends on ARCH_OMAP
In reply to Alexander Aring--- drivers/net/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/Kconfig +1 -0
@@ -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
Signature · 7 lines
1.8.1.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 15 lines · Alexander Aring
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.
Quoted 7 lines
sata-imx: fix depends on
ARCH_IMX
- I am not sure but this looks likeARCH_IMXrelated 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 thatmach/cpsw.hwasn't found. I only found that in the omap implementation.
Applied, thanks
Sascha
Quoted 37 lines
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_sizeis a power-of-two, we can use a shift for this instead of division. But I don't know ifleb_sizea power-of-two number.v2:
- fix commit msg in "net: fix cpsw depends onARCH_OMAP" patchAlexander Aring (4):
hush: add getopt only if it enabled
getopt: change optstring to const char*
sata-imx: fix depends onARCH_IMX
net: fix cpsw depends onARCH_OMAPcommon/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(-)Signature · 7 lines
1.8.1.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox