public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: "H. Peter Anvin" <hpa@linux.intel.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	hbabu@us.ibm.com, ebiederm@xmission.com, ying.huang@intel.com,
	mingo@elte.hu, tglx@linutronix.de, vgoyal@redhat.com
Subject: Re: [PATCH 09/14] x86, boot: add new runtime_address and runtime_size bzImage fields
Date: Fri, 8 May 2009 09:55:16 +0200	[thread overview]
Message-ID: <20090508075516.GF12808@uranus.ravnborg.org> (raw)
In-Reply-To: <1241735222-6640-10-git-send-email-hpa@linux.intel.com>

On Thu, May 07, 2009 at 03:26:57PM -0700, H. Peter Anvin wrote:
> From: H. Peter Anvin <hpa@zytor.com>
> 
> Make the (minimum) runtime address and the required amount of linear
> address space available to the boot loader.  A relocating boot loader
> can use this information to select a kernel location; furthermore, it
> is permitted to modify the minimum runtime address field in order for
> the boot loader to force a specific location for the kernel (as long
> as it fits the alignment constraints.)
> 
> This means that the address space layout for the kernel compressor has
> to be determined at compile time.  Since we have to do that, we might
> as well reap the benefit and remove some runtime calculations in
> assembly.
> 
> Note: bounding the amount of linear address space (not necessarily
> bounding the amount of memory needed, but the amount that has to be
> linearly contiguous before the memory map is consulted) was only
> possible since Jeremy Fitzhardinge's brk support work.
> 
> [ Impact: new feature; simplication of compressed/head_*.S ]
> 
> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---
>  arch/x86/boot/Makefile               |   24 ++++++---
>  arch/x86/boot/compressed/Makefile    |   14 ++++--
>  arch/x86/boot/compressed/head_32.S   |   54 ++++++-------------
>  arch/x86/boot/compressed/head_64.S   |   52 +++++-------------
>  arch/x86/boot/compressed/mkpiggy.c   |   97 ++++++++++++++++++++++++++++++++++
>  arch/x86/boot/compressed/vmlinux.scr |   10 ----
>  arch/x86/boot/header.S               |   19 +++++--
>  arch/x86/include/asm/bootparam.h     |    2 +
>  arch/x86/kernel/asm-offsets_32.c     |    1 +
>  arch/x86/kernel/asm-offsets_64.c     |    1 +
>  10 files changed, 173 insertions(+), 101 deletions(-)
>  create mode 100644 arch/x86/boot/compressed/mkpiggy.c
>  delete mode 100644 arch/x86/boot/compressed/vmlinux.scr
> 
> diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
> index 6633b6e..3332d22 100644
> --- a/arch/x86/boot/Makefile
> +++ b/arch/x86/boot/Makefile
> @@ -86,19 +86,27 @@ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
>  
>  SETUP_OBJS = $(addprefix $(obj)/,$(setup-y))
>  
> -sed-offsets := -e 's/^00*/0/' \
> -        -e 's/^\([0-9a-fA-F]*\) . \(input_data\|input_data_end\)$$/\#define \2 0x\1/p'
> +sed-voffset := -e 's/^\([0-9a-fA-F]*\) . \(_text\|_end\)$$/\#define VO_\2 0x\1/p'
>  
> -quiet_cmd_offsets = OFFSETS $@
> -      cmd_offsets = $(NM) $< | sed -n $(sed-offsets) > $@
> +quiet_cmd_voffset = VOFFSET $@
> +      cmd_voffset = $(NM) $< | sed -n $(sed-voffset) > $@
>  
> -$(obj)/offsets.h: $(obj)/compressed/vmlinux FORCE
> -	$(call if_changed,offsets)
> +targets += voffset.h
> +$(obj)/voffset.h: vmlinux FORCE
> +	$(call if_changed,voffset)
> +
> +sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(input_data\|_ebss\|z_.*\)$$/\#define ZO_\2 0x\1/p'
> +
> +quiet_cmd_zoffset = ZOFFSET $@
> +      cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@
> +
> +targets += zoffset.h
> +$(obj)/zoffset.h: $(obj)/compressed/vmlinux FORCE
> +	$(call if_changed,zoffset)
>  
> -targets += offsets.h
>  
>  AFLAGS_header.o += -I$(obj)
> -$(obj)/header.o: $(obj)/offsets.h
> +$(obj)/header.o: $(obj)/voffset.h $(obj)/zoffset.h
>  
>  LDFLAGS_setup.elf	:= -T
>  $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE
> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
> index b35c3bb..6f4d7ba 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -4,7 +4,8 @@
>  # create a compressed vmlinux image from the original vmlinux
>  #
>  
> -targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o
> +targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \
> +	   vmlinux.bin.lzma head_$(BITS).o misc.o

You still have a piggy.o target.

>  
>  KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
>  KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
> @@ -19,6 +20,8 @@ KBUILD_AFLAGS  := $(KBUILD_CFLAGS) -D__ASSEMBLY__
>  LDFLAGS := -m elf_$(UTS_MACHINE)
>  LDFLAGS_vmlinux := -T
>  
> +hostprogs-y	:= mkpiggy
> +
>  $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE
>  	$(call if_changed,ld)
>  	@:
> @@ -50,6 +53,9 @@ suffix_$(CONFIG_KERNEL_GZIP)  = gz
>  suffix_$(CONFIG_KERNEL_BZIP2) = bz2
>  suffix_$(CONFIG_KERNEL_LZMA)  = lzma

No need for a recursive assignment here. Use ":="
Ann we usually uses "-y" not "_y".

>  
> -LDFLAGS_piggy.o := -r --format binary --oformat $(CONFIG_OUTPUT_FORMAT) -T
> -$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE
> -	$(call if_changed,ld)
> +quiet_cmd_mkpiggy = MKPIGGY $@
> +      cmd_mkpiggy = $(obj)/mkpiggy $< > $@


> +      cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || (rm -f $@; false)

So we delete the file on error.

> +
> +targets += piggy.S
> +$(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix_y) $(obj)/mkpiggy FORCE
> +	$(call if_changed,mkpiggy)


	Sam  

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2009-05-08  7:53 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07 22:26 [PATCH 00/14] RFC: x86: relocatable kernel changes H. Peter Anvin
2009-05-07 22:26 ` [PATCH 01/14] x86, boot: align the .bss section in the decompressor H. Peter Anvin
2009-05-08  7:17   ` Sam Ravnborg
2009-05-08  8:18     ` Eric Dumazet
2009-05-08 16:54     ` H. Peter Anvin
2009-05-08  7:53   ` Cyrill Gorcunov
2009-05-08 17:03     ` H. Peter Anvin
2009-05-08 17:15       ` Cyrill Gorcunov
2009-05-08 17:21         ` H. Peter Anvin
2009-05-07 22:26 ` [PATCH 02/14] x86, boot: honor CONFIG_PHYSICAL_START when relocatable H. Peter Anvin
2009-05-08  7:34   ` Sam Ravnborg
2009-05-08 16:58     ` H. Peter Anvin
2009-05-07 22:26 ` [PATCH 03/14] x86, config: change defaults PHYSICAL_START and PHYSICAL_ALIGN H. Peter Anvin
2009-05-08  7:36   ` Sam Ravnborg
2009-05-08  9:47     ` Ingo Molnar
2009-05-08 17:01     ` H. Peter Anvin
2009-05-07 22:26 ` [PATCH 04/14] x86, boot: unify use LOAD_PHYSICAL_ADDR and LOAD_PHYSICAL_ALIGN H. Peter Anvin
2009-05-07 22:26 ` [PATCH 05/14] kbuild: allow compressors (gzip, bzip2, lzma) to take multiple inputs H. Peter Anvin
2009-05-08  7:42   ` Sam Ravnborg
2009-05-08 20:18     ` H. Peter Anvin
2009-05-08 20:47       ` Sam Ravnborg
2009-05-08 20:49         ` H. Peter Anvin
2009-05-08 21:33           ` Sam Ravnborg
2009-05-07 22:26 ` [PATCH 06/14] x86: add a Kconfig symbol for when relocations are needed H. Peter Anvin
2009-05-07 22:26 ` [PATCH 07/14] x86, boot: simplify arch/x86/boot/compressed/Makefile H. Peter Anvin
2009-05-08  7:45   ` Sam Ravnborg
2009-05-07 22:26 ` [PATCH 08/14] x86, boot: use BP_scratch in arch/x86/boot/compressed/head_*.S H. Peter Anvin
2009-05-07 22:26 ` [PATCH 09/14] x86, boot: add new runtime_address and runtime_size bzImage fields H. Peter Anvin
2009-05-08  7:55   ` Sam Ravnborg [this message]
2009-05-08 21:09     ` H. Peter Anvin
2009-05-08 21:35       ` Sam Ravnborg
2009-05-07 22:26 ` [PATCH 10/14] x86, doc: document the runtime_start " H. Peter Anvin
2009-05-07 22:26 ` [PATCH 11/14] x86, boot: use rep movsq to move kernel on 64 bits H. Peter Anvin
2009-05-07 22:27 ` [PATCH 12/14] x86, boot: zero EFLAGS on 32 bits H. Peter Anvin
2009-05-07 22:27 ` [PATCH 13/14] x86: make CONFIG_RELOCATABLE the default H. Peter Anvin
2009-05-07 22:27 ` [PATCH 14/14] x86, defconfig: update defconfigs to relocatable H. Peter Anvin
2009-05-08  1:23 ` [PATCH 00/14] RFC: x86: relocatable kernel changes Eric W. Biederman
2009-05-08  5:31   ` H. Peter Anvin
2009-05-08  6:54     ` Eric W. Biederman
2009-05-08 18:04       ` H. Peter Anvin
2009-05-08 18:47       ` H. Peter Anvin
2009-05-11  5:18         ` RFC: x86: relocatable kernel changes (revised spec) H. Peter Anvin
2009-05-11 11:54           ` Eric W. Biederman
2009-05-11 16:03             ` H. Peter Anvin
2009-05-11 17:56             ` RFC: x86: relocatable kernel changes (revised spec v2) H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090508075516.GF12808@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=ebiederm@xmission.com \
    --cc=hbabu@us.ibm.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox