Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] MIPS: vmlinuz: gather some string functions into string.c
@ 2013-09-28 15:42 Antony Pavlov
  2013-09-28 17:32 ` Florian Fainelli
  0 siblings, 1 reply; 4+ messages in thread
From: Antony Pavlov @ 2013-09-28 15:42 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Antony Pavlov

This patch fixes linker error:

    LD    vmlinuz
  arch/mips/boot/compressed/decompress.o: In function `decompress_kernel':
  decompress.c:(.text+0x754): undefined reference to `memcpy'
  make[1]: *** [vmlinuz] Error 1

Which appears when compiling vmlinuz image with CONFIG_KERNEL_LZO=y.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/boot/compressed/Makefile     |  4 ++--
 arch/mips/boot/compressed/decompress.c | 19 -------------------
 arch/mips/boot/compressed/string.c     | 28 ++++++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 21 deletions(-)
 create mode 100644 arch/mips/boot/compressed/string.c

diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 0048c08..30e30d4 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -27,10 +27,10 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
 	-DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
 	-DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
 
-targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o
+targets := head.o decompress.o string.o dbg.o uart-16550.o uart-alchemy.o
 
 # decompressor objects (linked with vmlinuz)
-vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
+vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/dbg.o
 
 ifdef CONFIG_DEBUG_ZBOOT
 vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index 2c95730..fc1f294 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -44,29 +44,10 @@ void error(char *x)
 #define STATIC static
 
 #ifdef CONFIG_KERNEL_GZIP
-void *memcpy(void *dest, const void *src, size_t n)
-{
-	int i;
-	const char *s = src;
-	char *d = dest;
-
-	for (i = 0; i < n; i++)
-		d[i] = s[i];
-	return dest;
-}
 #include "../../../../lib/decompress_inflate.c"
 #endif
 
 #ifdef CONFIG_KERNEL_BZIP2
-void *memset(void *s, int c, size_t n)
-{
-	int i;
-	char *ss = s;
-
-	for (i = 0; i < n; i++)
-		ss[i] = c;
-	return s;
-}
 #include "../../../../lib/decompress_bunzip2.c"
 #endif
 
diff --git a/arch/mips/boot/compressed/string.c b/arch/mips/boot/compressed/string.c
new file mode 100644
index 0000000..49e6db0
--- /dev/null
+++ b/arch/mips/boot/compressed/string.c
@@ -0,0 +1,28 @@
+/*
+ * arch/mips/boot/compressed/string.c
+ *
+ * Very small subset of simple string routines
+ */
+
+#include <linux/string.h>
+
+void *memcpy(void *dest, const void *src, size_t n)
+{
+	int i;
+	const char *s = src;
+	char *d = dest;
+
+	for (i = 0; i < n; i++)
+		d[i] = s[i];
+	return dest;
+}
+
+void *memset(void *s, int c, size_t n)
+{
+	int i;
+	char *ss = s;
+
+	for (i = 0; i < n; i++)
+		ss[i] = c;
+	return s;
+}
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: vmlinuz: gather some string functions into string.c
  2013-09-28 15:42 [PATCH] MIPS: vmlinuz: gather some string functions into string.c Antony Pavlov
@ 2013-09-28 17:32 ` Florian Fainelli
  2013-09-28 20:14   ` Antony Pavlov
  2013-09-29  7:02   ` Antony Pavlov
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Fainelli @ 2013-09-28 17:32 UTC (permalink / raw)
  To: Antony Pavlov, linux-mips; +Cc: Ralf Baechle

Hello,

Le 28/09/2013 17:42, Antony Pavlov a écrit :
> This patch fixes linker error:
>
>      LD    vmlinuz
>    arch/mips/boot/compressed/decompress.o: In function `decompress_kernel':
>    decompress.c:(.text+0x754): undefined reference to `memcpy'
>    make[1]: *** [vmlinuz] Error 1
>
> Which appears when compiling vmlinuz image with CONFIG_KERNEL_LZO=y.

You would have to rebase this on top of mips-for-linux-next which 
contains a bit more ifdef for supporting LZ4 and XZ otherwise the first 
hunk of the patch does not apply.

Regarding the contents of the patch, you are somehow changing the 
existing compressor code by unconditionnaly providing a memset and 
memcpy implementation, which is fine per se but should be mentioned at 
least.

>
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>   arch/mips/boot/compressed/Makefile     |  4 ++--
>   arch/mips/boot/compressed/decompress.c | 19 -------------------
>   arch/mips/boot/compressed/string.c     | 28 ++++++++++++++++++++++++++++
>   3 files changed, 30 insertions(+), 21 deletions(-)
>   create mode 100644 arch/mips/boot/compressed/string.c
>
> diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
> index 0048c08..30e30d4 100644
> --- a/arch/mips/boot/compressed/Makefile
> +++ b/arch/mips/boot/compressed/Makefile
> @@ -27,10 +27,10 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
>   	-DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
>   	-DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
>
> -targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o
> +targets := head.o decompress.o string.o dbg.o uart-16550.o uart-alchemy.o
>
>   # decompressor objects (linked with vmlinuz)
> -vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
> +vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/dbg.o
>
>   ifdef CONFIG_DEBUG_ZBOOT
>   vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
> diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
> index 2c95730..fc1f294 100644
> --- a/arch/mips/boot/compressed/decompress.c
> +++ b/arch/mips/boot/compressed/decompress.c
> @@ -44,29 +44,10 @@ void error(char *x)
>   #define STATIC static
>
>   #ifdef CONFIG_KERNEL_GZIP
> -void *memcpy(void *dest, const void *src, size_t n)
> -{
> -	int i;
> -	const char *s = src;
> -	char *d = dest;
> -
> -	for (i = 0; i < n; i++)
> -		d[i] = s[i];
> -	return dest;
> -}
>   #include "../../../../lib/decompress_inflate.c"
>   #endif
>
>   #ifdef CONFIG_KERNEL_BZIP2
> -void *memset(void *s, int c, size_t n)
> -{
> -	int i;
> -	char *ss = s;
> -
> -	for (i = 0; i < n; i++)
> -		ss[i] = c;
> -	return s;
> -}
>   #include "../../../../lib/decompress_bunzip2.c"
>   #endif
>
> diff --git a/arch/mips/boot/compressed/string.c b/arch/mips/boot/compressed/string.c
> new file mode 100644
> index 0000000..49e6db0
> --- /dev/null
> +++ b/arch/mips/boot/compressed/string.c
> @@ -0,0 +1,28 @@
> +/*
> + * arch/mips/boot/compressed/string.c
> + *
> + * Very small subset of simple string routines
> + */
> +
> +#include <linux/string.h>
> +
> +void *memcpy(void *dest, const void *src, size_t n)
> +{
> +	int i;
> +	const char *s = src;
> +	char *d = dest;
> +
> +	for (i = 0; i < n; i++)
> +		d[i] = s[i];
> +	return dest;
> +}
> +
> +void *memset(void *s, int c, size_t n)
> +{
> +	int i;
> +	char *ss = s;
> +
> +	for (i = 0; i < n; i++)
> +		ss[i] = c;
> +	return s;
> +}
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: vmlinuz: gather some string functions into string.c
  2013-09-28 17:32 ` Florian Fainelli
@ 2013-09-28 20:14   ` Antony Pavlov
  2013-09-29  7:02   ` Antony Pavlov
  1 sibling, 0 replies; 4+ messages in thread
From: Antony Pavlov @ 2013-09-28 20:14 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-mips, Ralf Baechle

On Sat, 28 Sep 2013 19:32:23 +0200
Florian Fainelli <f.fainelli@gmail.com> wrote:

> Hello,
> 
> Le 28/09/2013 17:42, Antony Pavlov a écrit :
> > This patch fixes linker error:
> >
> >      LD    vmlinuz
> >    arch/mips/boot/compressed/decompress.o: In function `decompress_kernel':
> >    decompress.c:(.text+0x754): undefined reference to `memcpy'
> >    make[1]: *** [vmlinuz] Error 1
> >
> > Which appears when compiling vmlinuz image with CONFIG_KERNEL_LZO=y.
> 
> You would have to rebase this on top of mips-for-linux-next which 
> contains a bit more ifdef for supporting LZ4 and XZ otherwise the first 
> hunk of the patch does not apply.

My bad, I found your "[PATCH v2] MIPS: ZBOOT: support LZ4 compression scheme" patch
__after__ sending my patches.

Unfortunately I can't get access to the mips-for-linux-next branch:

* the git://git.linux-mips.org/pub/scm/ralf/linux.git repo contain only the *-stable
branches;
* I can't clone linux-queue.git (see below).

$ git clone git://git.linux-mips.org/pub/scm/ralf/linux-queue.git
Cloning into 'linux-queue'...
fatal: remote error: access denied or repository not exported: /pub/scm/ralf/linux-queue.git

How can I obtain the mips-for-linux-next branch?

> Regarding the contents of the patch, you are somehow changing the 
> existing compressor code by unconditionnaly providing a memset and 
> memcpy implementation, which is fine per se but should be mentioned at 
> least.
> 
> >
> > Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> > ---
> >   arch/mips/boot/compressed/Makefile     |  4 ++--
> >   arch/mips/boot/compressed/decompress.c | 19 -------------------
> >   arch/mips/boot/compressed/string.c     | 28 ++++++++++++++++++++++++++++
> >   3 files changed, 30 insertions(+), 21 deletions(-)
> >   create mode 100644 arch/mips/boot/compressed/string.c
> >
> > diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
> > index 0048c08..30e30d4 100644
> > --- a/arch/mips/boot/compressed/Makefile
> > +++ b/arch/mips/boot/compressed/Makefile
> > @@ -27,10 +27,10 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
> >   	-DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
> >   	-DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
> >
> > -targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o
> > +targets := head.o decompress.o string.o dbg.o uart-16550.o uart-alchemy.o
> >
> >   # decompressor objects (linked with vmlinuz)
> > -vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
> > +vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/dbg.o
> >
> >   ifdef CONFIG_DEBUG_ZBOOT
> >   vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
> > diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
> > index 2c95730..fc1f294 100644
> > --- a/arch/mips/boot/compressed/decompress.c
> > +++ b/arch/mips/boot/compressed/decompress.c
> > @@ -44,29 +44,10 @@ void error(char *x)
> >   #define STATIC static
> >
> >   #ifdef CONFIG_KERNEL_GZIP
> > -void *memcpy(void *dest, const void *src, size_t n)
> > -{
> > -	int i;
> > -	const char *s = src;
> > -	char *d = dest;
> > -
> > -	for (i = 0; i < n; i++)
> > -		d[i] = s[i];
> > -	return dest;
> > -}
> >   #include "../../../../lib/decompress_inflate.c"
> >   #endif
> >
> >   #ifdef CONFIG_KERNEL_BZIP2
> > -void *memset(void *s, int c, size_t n)
> > -{
> > -	int i;
> > -	char *ss = s;
> > -
> > -	for (i = 0; i < n; i++)
> > -		ss[i] = c;
> > -	return s;
> > -}
> >   #include "../../../../lib/decompress_bunzip2.c"
> >   #endif
> >
> > diff --git a/arch/mips/boot/compressed/string.c b/arch/mips/boot/compressed/string.c
> > new file mode 100644
> > index 0000000..49e6db0
> > --- /dev/null
> > +++ b/arch/mips/boot/compressed/string.c
> > @@ -0,0 +1,28 @@
> > +/*
> > + * arch/mips/boot/compressed/string.c
> > + *
> > + * Very small subset of simple string routines
> > + */
> > +
> > +#include <linux/string.h>
> > +
> > +void *memcpy(void *dest, const void *src, size_t n)
> > +{
> > +	int i;
> > +	const char *s = src;
> > +	char *d = dest;
> > +
> > +	for (i = 0; i < n; i++)
> > +		d[i] = s[i];
> > +	return dest;
> > +}
> > +
> > +void *memset(void *s, int c, size_t n)
> > +{
> > +	int i;
> > +	char *ss = s;
> > +
> > +	for (i = 0; i < n; i++)
> > +		ss[i] = c;
> > +	return s;
> > +}
> >
> 


-- 
-- 
Best regards,
  Antony Pavlov

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: vmlinuz: gather some string functions into string.c
  2013-09-28 17:32 ` Florian Fainelli
  2013-09-28 20:14   ` Antony Pavlov
@ 2013-09-29  7:02   ` Antony Pavlov
  1 sibling, 0 replies; 4+ messages in thread
From: Antony Pavlov @ 2013-09-29  7:02 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-mips, Ralf Baechle

On Sat, 28 Sep 2013 19:32:23 +0200
Florian Fainelli <f.fainelli@gmail.com> wrote:

> Hello,
> 
> Le 28/09/2013 17:42, Antony Pavlov a écrit :
> > This patch fixes linker error:
> >
> >      LD    vmlinuz
> >    arch/mips/boot/compressed/decompress.o: In function `decompress_kernel':
> >    decompress.c:(.text+0x754): undefined reference to `memcpy'
> >    make[1]: *** [vmlinuz] Error 1
> >
> > Which appears when compiling vmlinuz image with CONFIG_KERNEL_LZO=y.
> 
> You would have to rebase this on top of mips-for-linux-next which 
> contains a bit more ifdef for supporting LZ4 and XZ otherwise the first 
> hunk of the patch does not apply.

I have read http://www.linux-mips.org/wiki/Git. But there is no information
about mips-for-linux-next. Eventually I have found the branch in the
git://git.linux-mips.org/pub/scm/ralf/upstream-sfr.git repo.

Can we update the Git wiki page?

-- 
Best regards,
  Antony Pavlov

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-29  7:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-28 15:42 [PATCH] MIPS: vmlinuz: gather some string functions into string.c Antony Pavlov
2013-09-28 17:32 ` Florian Fainelli
2013-09-28 20:14   ` Antony Pavlov
2013-09-29  7:02   ` Antony Pavlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox