All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] MIPS: zboot: Avoid useless rebuilds
@ 2015-12-10  9:57 Alban Bedel
  2015-12-10  9:57 ` [PATCH 2/3] MIPS: zboot: Add support for serial debug using the PROM Alban Bedel
  2015-12-10  9:57 ` [PATCH 3/3] MIPS: ath79: Add zboot debug serial support Alban Bedel
  0 siblings, 2 replies; 4+ messages in thread
From: Alban Bedel @ 2015-12-10  9:57 UTC (permalink / raw)
  To: linux-mips
  Cc: Alban Bedel, Ralf Baechle, Alex Smith, Wu Zhangjin,
	Andrew Bresticker, linux-kernel

Add dummy.o to the targets list, and fill targets automatically from
$(vmlinuzobjs) to avoid having to maintain two lists.

When building with XZ compression copy ashldi3.c to the build
directory to use a different object file for the kernel and zboot.
Without this the same object file need to be build with different
flags which cause a rebuild at every run.

Signed-off-by: Alban Bedel <albeu@free.fr>
---
 arch/mips/boot/compressed/Makefile | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index d5bdee1..e66b2c6 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,13 @@ 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
-endif
+vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
+
+$(obj)/ashldi3.o: KBUILD_CFLAGS += -I$(srctree)/arch/mips/lib
+$(obj)/ashldi3.c: $(srctree)/arch/mips/lib/ashldi3.c
+	$(call cmd,shipped)
+
+targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
 OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
@@ -60,7 +62,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 2/3] MIPS: zboot: Add support for serial debug using the PROM
  2015-12-10  9:57 [PATCH 1/3] MIPS: zboot: Avoid useless rebuilds Alban Bedel
@ 2015-12-10  9:57 ` Alban Bedel
  2015-12-10  9:57 ` [PATCH 3/3] MIPS: ath79: Add zboot debug serial support Alban Bedel
  1 sibling, 0 replies; 4+ messages in thread
From: Alban Bedel @ 2015-12-10  9:57 UTC (permalink / raw)
  To: linux-mips
  Cc: Alban Bedel, Ralf Baechle, Alex Smith, Andrew Bresticker,
	Wu Zhangjin, linux-kernel

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>
---
 arch/mips/Kconfig                     | 4 ++++
 arch/mips/boot/compressed/Makefile    | 1 +
 arch/mips/boot/compressed/uart-prom.c | 7 +++++++
 3 files changed, 12 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 e66b2c6..4eff1ef 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..1c3d51b
--- /dev/null
+++ b/arch/mips/boot/compressed/uart-prom.c
@@ -0,0 +1,7 @@
+
+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 3/3] MIPS: ath79: Add zboot debug serial support
  2015-12-10  9:57 [PATCH 1/3] MIPS: zboot: Avoid useless rebuilds Alban Bedel
  2015-12-10  9:57 ` [PATCH 2/3] MIPS: zboot: Add support for serial debug using the PROM Alban Bedel
@ 2015-12-10  9:57 ` Alban Bedel
  2016-01-08  9:28   ` Antony Pavlov
  1 sibling, 1 reply; 4+ messages in thread
From: Alban Bedel @ 2015-12-10  9:57 UTC (permalink / raw)
  To: linux-mips
  Cc: Alban Bedel, Ralf Baechle, Alex Smith, Wu Zhangjin,
	Andrew Bresticker, linux-kernel

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>
---
 arch/mips/Kconfig                  | 2 +-
 arch/mips/boot/compressed/Makefile | 4 ++++
 2 files changed, 5 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 4eff1ef..f648bf7 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -37,8 +37,12 @@ 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
 
+$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
+	$(call cmd,shipped)
+
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
 
 $(obj)/ashldi3.o: KBUILD_CFLAGS += -I$(srctree)/arch/mips/lib
-- 
2.0.0


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

* Re: [PATCH 3/3] MIPS: ath79: Add zboot debug serial support
  2015-12-10  9:57 ` [PATCH 3/3] MIPS: ath79: Add zboot debug serial support Alban Bedel
@ 2016-01-08  9:28   ` Antony Pavlov
  0 siblings, 0 replies; 4+ messages in thread
From: Antony Pavlov @ 2016-01-08  9:28 UTC (permalink / raw)
  To: Alban Bedel
  Cc: linux-mips, Ralf Baechle, Alex Smith, Wu Zhangjin,
	Andrew Bresticker, linux-kernel

On Thu, 10 Dec 2015 10:57:22 +0100
Alban Bedel <albeu@free.fr> wrote:

> 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>
> ---
>  arch/mips/Kconfig                  | 2 +-
>  arch/mips/boot/compressed/Makefile | 4 ++++
>  2 files changed, 5 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 4eff1ef..f648bf7 100644
> --- a/arch/mips/boot/compressed/Makefile
> +++ b/arch/mips/boot/compressed/Makefile
> @@ -37,8 +37,12 @@ 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
>  
> +$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
> +	$(call cmd,shipped)
> +
>  vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
>  
>  $(obj)/ashldi3.o: KBUILD_CFLAGS += -I$(srctree)/arch/mips/lib
> -- 
> 2.0.0
> 

This patch has a side effect: git untracked file arch/mips/boot/compressed/uart-ath79.c after build.
This untracked file is not removed by 'make mrproper'.

Here is my build log:

    $ git clone -b ath79 https://github.com/AlbanBedel/linux
    ...
    $ cd linux
    linux$ make ARCH=mips ath79_defconfig
    ...
    linux$ grep -w CONFIG_DEBUG_ZBOOT .config
    # CONFIG_DEBUG_ZBOOT is not set
    linux$ sed -i "s/^# \(CONFIG_DEBUG_ZBOOT\) .*$/\1=y/" .config
    linux$ make ARCH=mips oldconfig
    linux$ grep -w CONFIG_DEBUG_ZBOOT .config
    CONFIG_DEBUG_ZBOOT=y
    linux$ git status
    On branch ath79
    Your branch is up-to-date with 'origin/ath79'.
    nothing to commit, working directory clean
    
    linux$ make -s ARCH=mips CROSS_COMPILE=mips-linux-gnu- vmlinuz
    ...
    
    linux$ git status
    On branch ath79
    Your branch is up-to-date with 'origin/ath79'.
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
            arch/mips/boot/compressed/uart-ath79.c
    
    nothing added to commit but untracked files present (use "git add" to track)
    
    linux$ make ARCH=mips mrproper
    ...

    linux$ git status
    On branch ath79
    Your branch is up-to-date with 'origin/ath79'.
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
            arch/mips/boot/compressed/uart-ath79.c
    
    nothing added to commit but untracked files present (use "git add" to track)

-- 
Best regards,
  Antony Pavlov

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

end of thread, other threads:[~2016-03-30 17:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10  9:57 [PATCH 1/3] MIPS: zboot: Avoid useless rebuilds Alban Bedel
2015-12-10  9:57 ` [PATCH 2/3] MIPS: zboot: Add support for serial debug using the PROM Alban Bedel
2015-12-10  9:57 ` [PATCH 3/3] MIPS: ath79: Add zboot debug serial support Alban Bedel
2016-01-08  9:28   ` Antony Pavlov

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.