All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] MIPS: zboot: Fix the build with XZ compression on older GCC versions
@ 2016-01-23 12:48 Alban Bedel
  2016-01-23 12:48 ` [PATCH v2 2/4] MIPS: zboot: Avoid useless rebuilds Alban Bedel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alban Bedel @ 2016-01-23 12:48 UTC (permalink / raw)
  To: linux-mips
  Cc: Ralf Baechle, Andrew Bresticker, Alex Smith, Wu Zhangjin,
	linux-kernel, Alban Bedel, stable

Some older GCC version (at least 4.6) emits calls to __bswapsi2() when
building the XZ decompressor. The link of the compressed image then
fails with the following error:

arch/mips/boot/compressed/decompress.o: In function '__fswab32':
include/uapi/linux/swab.h:60: undefined reference to '__bswapsi2'

Add bswapsi.o to the link to fix the build with these versions.

Signed-off-by: Alban Bedel <albeu@free.fr>
CC: stable@vger.kernel.org # v4.4
---
Changelog:
v2: * Added CC to stable as the patch hasn't been merged in 4.4
---
 arch/mips/boot/compressed/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index d5bdee1..45f8abb 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -41,7 +41,7 @@ vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)		   += $(obj)/uart-alchemy.o
 endif
 
 ifdef CONFIG_KERNEL_XZ
-vmlinuzobjs-y += $(obj)/../../lib/ashldi3.o
+vmlinuzobjs-y += $(obj)/../../lib/ashldi3.o $(obj)/../../lib/bswapsi.o
 endif
 
 targets += vmlinux.bin
-- 
2.0.0

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

* [PATCH v2 2/4] MIPS: zboot: Avoid useless rebuilds
  2016-01-23 12:48 [PATCH v2 1/4] MIPS: zboot: Fix the build with XZ compression on older GCC versions Alban Bedel
@ 2016-01-23 12:48 ` Alban Bedel
  2016-01-23 12:48 ` [PATCH v2 3/4] MIPS: zboot: Add support for serial debug using the PROM Alban Bedel
  2016-01-23 12:48 ` [PATCH v2 4/4] MIPS: ath79: Add zboot debug serial support Alban Bedel
  2 siblings, 0 replies; 4+ messages in thread
From: Alban Bedel @ 2016-01-23 12:48 UTC (permalink / raw)
  To: linux-mips
  Cc: Ralf Baechle, Andrew Bresticker, Alex Smith, Wu Zhangjin,
	linux-kernel, Alban Bedel

dummy.o is missing from the targets list which cause useless rebuilds.
Instead of adding it to the target list we now fill the list
automatically from $(vmlinuzobjs) to avoid having to maintain two
lists.

Building with XZ compression also lead to useless rebuilds because it
reuse source files from another directory. The kernel and zboot
wrapper use different flags, so if these object are built for the
kernel, they then get overwritten by the zboot wrapper version.
In the next build these object files are missing for the kernel,
so they get rebuild again, and then again for the zboot wrapper. To
solve this we copy the source files to the build directory to avoid
overwritting the kernel objects.

Signed-off-by: Alban Bedel <albeu@free.fr>
---
Changelog:
v2: * Properly delete the copied source files on clean
    * Rewrote the commit log to better explain the problem
---
 arch/mips/boot/compressed/Makefile | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 45f8abb..2d5d97f 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -29,8 +29,6 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
 	-DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
 	-DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
 
-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)/string.o
 
@@ -40,9 +38,14 @@ vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
 vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)		   += $(obj)/uart-alchemy.o
 endif
 
-ifdef CONFIG_KERNEL_XZ
-vmlinuzobjs-y += $(obj)/../../lib/ashldi3.o $(obj)/../../lib/bswapsi.o
-endif
+vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o $(obj)/bswapsi.o
+
+extra-y += ashldi3.c bswapsi.c
+$(obj)/ashldi3.o $(obj)/bswapsi.o: KBUILD_CFLAGS += -I$(srctree)/arch/mips/lib
+$(obj)/ashldi3.c $(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c
+	$(call cmd,shipped)
+
+targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
 OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
@@ -60,7 +63,7 @@ targets += vmlinux.bin.z
 $(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
 	$(call if_changed,$(tool_y))
 
-targets += piggy.o
+targets += piggy.o dummy.o
 OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \
 			--set-section-flags=.image=contents,alloc,load,readonly,data
 $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
-- 
2.0.0

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

* [PATCH v2 3/4] MIPS: zboot: Add support for serial debug using the PROM
  2016-01-23 12:48 [PATCH v2 1/4] MIPS: zboot: Fix the build with XZ compression on older GCC versions Alban Bedel
  2016-01-23 12:48 ` [PATCH v2 2/4] MIPS: zboot: Avoid useless rebuilds Alban Bedel
@ 2016-01-23 12:48 ` Alban Bedel
  2016-01-23 12:48 ` [PATCH v2 4/4] MIPS: ath79: Add zboot debug serial support Alban Bedel
  2 siblings, 0 replies; 4+ messages in thread
From: Alban Bedel @ 2016-01-23 12:48 UTC (permalink / raw)
  To: linux-mips
  Cc: Ralf Baechle, Andrew Bresticker, Alex Smith, Wu Zhangjin,
	linux-kernel, Alban Bedel

As most platforms implement the PROM serial interface prom_putchar()
add a simple bridge to allow re-using this code for zboot.

Signed-off-by: Alban Bedel <albeu@free.fr>
---
Changelog:
v2: * Added a license header to uart-prom.c
---
 arch/mips/Kconfig                     |  4 ++++
 arch/mips/boot/compressed/Makefile    |  1 +
 arch/mips/boot/compressed/uart-prom.c | 20 ++++++++++++++++++++
 3 files changed, 25 insertions(+)
 create mode 100644 arch/mips/boot/compressed/uart-prom.c

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 71683a8..ef1d665 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1756,6 +1756,10 @@ config SYS_SUPPORTS_ZBOOT_UART16550
 	bool
 	select SYS_SUPPORTS_ZBOOT
 
+config SYS_SUPPORTS_ZBOOT_UART_PROM
+	bool
+	select SYS_SUPPORTS_ZBOOT
+
 config CPU_LOONGSON2
 	bool
 	select CPU_SUPPORTS_32BIT_KERNEL
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 2d5d97f..309d2ad 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -35,6 +35,7 @@ vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o
 ifdef CONFIG_DEBUG_ZBOOT
 vmlinuzobjs-$(CONFIG_DEBUG_ZBOOT)		   += $(obj)/dbg.o
 vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
+vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM) += $(obj)/uart-prom.o
 vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)		   += $(obj)/uart-alchemy.o
 endif
 
diff --git a/arch/mips/boot/compressed/uart-prom.c b/arch/mips/boot/compressed/uart-prom.c
new file mode 100644
index 0000000..9d8740c
--- /dev/null
+++ b/arch/mips/boot/compressed/uart-prom.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2015 Alban Bedel <albeu@free.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+extern void prom_putchar(unsigned char ch);
+
+void putc(char c)
+{
+	prom_putchar(c);
+}
-- 
2.0.0

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

* [PATCH v2 4/4] MIPS: ath79: Add zboot debug serial support
  2016-01-23 12:48 [PATCH v2 1/4] MIPS: zboot: Fix the build with XZ compression on older GCC versions Alban Bedel
  2016-01-23 12:48 ` [PATCH v2 2/4] MIPS: zboot: Avoid useless rebuilds Alban Bedel
  2016-01-23 12:48 ` [PATCH v2 3/4] MIPS: zboot: Add support for serial debug using the PROM Alban Bedel
@ 2016-01-23 12:48 ` Alban Bedel
  2 siblings, 0 replies; 4+ messages in thread
From: Alban Bedel @ 2016-01-23 12:48 UTC (permalink / raw)
  To: linux-mips
  Cc: Ralf Baechle, Andrew Bresticker, Alex Smith, Wu Zhangjin,
	linux-kernel, Alban Bedel

Reuse the early printk code to support the serial in zboot. We copy
early_printk.c instead of referencing it because we need to build a
different object file for the normal kernel and zboot.

Signed-off-by: Alban Bedel <albeu@free.fr>
---
Changelog:
v2: * Properly delete the copied source files on clean
---
 arch/mips/Kconfig                  | 2 +-
 arch/mips/boot/compressed/Makefile | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index ef1d665..bb2987b 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -138,7 +138,7 @@ config ATH79
 	select SYS_SUPPORTS_32BIT_KERNEL
 	select SYS_SUPPORTS_BIG_ENDIAN
 	select SYS_SUPPORTS_MIPS16
-	select SYS_SUPPORTS_ZBOOT
+	select SYS_SUPPORTS_ZBOOT_UART_PROM
 	select USE_OF
 	help
 	  Support for the Atheros AR71XX/AR724X/AR913X SoCs.
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 309d2ad..90aca95 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -37,8 +37,13 @@ vmlinuzobjs-$(CONFIG_DEBUG_ZBOOT)		   += $(obj)/dbg.o
 vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
 vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM) += $(obj)/uart-prom.o
 vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)		   += $(obj)/uart-alchemy.o
+vmlinuzobjs-$(CONFIG_ATH79)			   += $(obj)/uart-ath79.o
 endif
 
+extra-y += uart-ath79.c
+$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
+	$(call cmd,shipped)
+
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o $(obj)/bswapsi.o
 
 extra-y += ashldi3.c bswapsi.c
-- 
2.0.0

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

end of thread, other threads:[~2016-01-23 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-23 12:48 [PATCH v2 1/4] MIPS: zboot: Fix the build with XZ compression on older GCC versions Alban Bedel
2016-01-23 12:48 ` [PATCH v2 2/4] MIPS: zboot: Avoid useless rebuilds Alban Bedel
2016-01-23 12:48 ` [PATCH v2 3/4] MIPS: zboot: Add support for serial debug using the PROM Alban Bedel
2016-01-23 12:48 ` [PATCH v2 4/4] MIPS: ath79: Add zboot debug serial support Alban Bedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.