LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [4/5][POWERPC] boot: Makefile and linker scripts for zImage.kexec
@ 2006-06-29 13:27 Milton Miller
  0 siblings, 0 replies; 2+ messages in thread
From: Milton Miller @ 2006-06-29 13:27 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

The Makefile and linker script changes to build zImage.kexec

This patch is based after the if_changed_dep patch.

Signed-off-by: Milton Miller <miltonm@bga.com>

Index: kernel/arch/powerpc/boot/Makefile
===================================================================
--- kernel.orig/arch/powerpc/boot/Makefile	2006-06-29 05:45:56.343109131 -0500
+++ kernel/arch/powerpc/boot/Makefile	2006-06-29 06:01:30.254334494 -0500
@@ -32,12 +32,22 @@ OBJCOPY_MIB_ARGS  := -O aixcoff-rs6000 -
 zlib       := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
 zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h
 linuxheader := zlib.h zconf.h zutil.h
+linuxheader += stringify.h
 
-src-boot := crt0.S string.S prom.c stdio.c main.c div64.S
-src-boot += $(zlib)
+src-common := string.S stdio.c main.c div64.S
+src-common += $(zlib)
+
+src-boot := crt0.S prom.c  $(src-common)
 src-boot := $(addprefix $(obj)/, $(src-boot))
 obj-boot := $(addsuffix .o, $(basename $(src-boot)))
 
+src-kexec := crt0_kexec.S kexec.c $(src-common)
+src-kexec := $(addprefix $(obj)/, $(src-kexec))
+obj-kexec := $(addsuffix .o, $(basename $(src-kexec)))
+
+src-mult := $(sort $(src-boot) $(src-kexec))
+obj-mult := $(sort $(obj-boot) $(obj-kexec))
+
 BOOTCFLAGS	+= -I$(obj) -I$(srctree)/$(obj)
 
 quiet_cmd_copy_zlib = COPY    $@
@@ -61,7 +71,7 @@ $(addprefix $(obj)/,$(linuxheader)): $(o
 	$(call if_changed,copy_linuxheader)
 
 targets += $(zlib) $(zlibheader) $(linuxheader)
-targets += $(patsubst $(obj)/%,%, $(obj-boot))
+targets += $(patsubst $(obj)/%,%, $(obj-mult))
 
 # copy all headers before trying to build objects
 $(obj-boot):  $(addprefix $(obj)/,$(linuxheader) $(zlibheader))
@@ -75,10 +85,10 @@ quiet_cmd_bootas = BOOTAS  $@
 quiet_cmd_bootld = BOOTLD  $@
       cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
 
-$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
+$(patsubst %.c,%.o, $(filter %.c, $(src-mult))): %.o: %.c FORCE
 	$(call if_changed_dep,bootcc)
 
-$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
+$(patsubst %.S,%.o, $(filter %.S, $(src-mult))): %.o: %.S FORCE
 	$(call if_changed_dep,bootas)
 
 #-----------------------------------------------------------
@@ -95,6 +105,7 @@ hostprogs-y		:= addnote addRamDisk hack-
 
 targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
 	   zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \
+	   zImage.kexec zImage.kexec.3264 zImage.kexec64 \
 	   $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
 	   $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
 	   $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
@@ -163,8 +174,36 @@ coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PP
 mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.image
 mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32)  := $(obj)/miboot.initrd.image
 
+# The kexec entry point is valid for all kernels.  This zImage should work
+# on all loaders (kexec or firmware) that do not use an openfirmware prom
+# callback, assuming the memory node constraints are met.
+#
+# Build if CONFIG_KEXEC=y or on master make zImage.kexec.
+#
+kexecimg-$(CONFIG_KEXEC)-$(CONFIG_PPC64) += $(obj)/zImage.kexec64
+kexecimg-$(CONFIG_KEXEC)-y               += $(obj)/zImage.kexec
+
+# Build 64 bit and 32 bit package when 64 bit kernel is being built
+$(obj)/zImage.kexec: $(filter-out $(obj)/zImage.kexec, $(kexecimg-y-y))
+
+$(obj)/zImage.kexec: obj-kexec += $(call obj-sec, $(required))
+$(obj)/zImage.kexec: $(obj-kexec) $(srctree)/$(src)/zImage.kexec.lds \
+		$(call obj-sec, $(required)) FORCE
+	$(call if_changed,bootld,$(obj-kexec) $(call obj-sec, $(required)) \
+			,zImage.kexec.lds)
+
+$(obj)/zImage.kexec.3264: obj-kexec += $(call obj-sec, $(required))
+$(obj)/zImage.kexec.3264: $(obj-kexec) $(srctree)/$(src)/zImage.kexec64.lds \
+		$(call obj-sec, $(required)) FORCE
+	$(call if_changed,bootld,$(obj-kexec) $(call obj-sec, $(required)) \
+			,zImage.kexec64.lds)
+
+OBJCOPYFLAGS_zImage.kexec64 := -I elf32-powerpc -O elf64-powerpc
+$(obj)/zImage.kexec64: $(obj)/zImage.kexec.3264 FORCE
+	$(call if_changed,objcopy,$< $@)
+
 $(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \
-			$(mibootimg-y-y)
+			$(mibootimg-y-y) $(kexecimg-y-y)
 	@cp -f $< $@
 	$(call cmd,addnote)
 
@@ -222,4 +261,4 @@ $(obj)/uImage: $(obj)/vmlinux.gz
 install: $(CONFIGURE) $(BOOTIMAGE)
 	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
 
-clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip)
+clean-files += $(addprefix $(objtree)/, $(obj-mult) vmlinux.strip)
Index: kernel/arch/powerpc/Makefile
===================================================================
--- kernel.orig/arch/powerpc/Makefile	2006-06-29 05:24:59.721841947 -0500
+++ kernel/arch/powerpc/Makefile	2006-06-29 05:51:17.300076495 -0500
@@ -147,7 +147,7 @@ all: $(KBUILD_IMAGE)
 
 CPPFLAGS_vmlinux.lds	:= -Upowerpc
 
-BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage vmlinux.bin
+BOOT_TARGETS = zImage zImage.initrd zImage.kexec znetboot znetboot.initrd vmlinux.sm uImage vmlinux.bin
 
 PHONY += $(BOOT_TARGETS)
 
Index: kernel/arch/powerpc/boot/zImage.kexec.lds
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ kernel/arch/powerpc/boot/zImage.kexec.lds	2006-06-29 06:01:30.125354912 -0500
@@ -0,0 +1,51 @@
+OUTPUT_ARCH(powerpc:common)
+ENTRY(master)
+SECTIONS
+{
+  . = 0;
+  _start = .;
+  .text      :
+  {
+    *(.text)
+    *(.fixup)
+  }
+  _etext = .;
+  . = ALIGN(4096);
+  .data    :
+  {
+    *(.rodata*)
+    *(.data*)
+    *(.sdata*)
+    __got2_start = .;
+    *(.got2)
+    __got2_end = .;
+  }
+
+  . = ALIGN(4096);
+  _vmlinux_start =  .;
+  .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
+  _vmlinux_end =  .;
+
+  . = ALIGN(4096);
+  _initrd_start =  .;
+  .kernel:initrd : { *(.kernel:initrd) }
+  _initrd_end =  .;
+
+  . = ALIGN(4096);
+  _edata  =  .;
+
+  . = ALIGN(4096);
+  __stack_start =  .;
+  .stack : { *(.stack) }
+  __stack_end =  .;
+
+  . = ALIGN(4096);
+  __bss_start = .;
+  .bss       :
+  {
+   *(.sbss)
+   *(.bss)
+  }
+  . = ALIGN(4096);
+  _end = . ;
+}
Index: kernel/arch/powerpc/boot/zImage.kexec64.lds
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ kernel/arch/powerpc/boot/zImage.kexec64.lds	2006-06-29 06:01:30.154350322 -0500
@@ -0,0 +1,52 @@
+OUTPUT_ARCH(powerpc:common)
+ENTRY(_master64)
+SECTIONS
+{
+  . = 0;
+  _start = .;
+  .text      :
+  {
+    *(.text)
+    *(.fixup)
+  }
+  _etext = .;
+  . = ALIGN(4096);
+  .data    :
+  {
+    *(.rodata*)
+    *(.data*)
+    *(.sdata*)
+    __got2_start = .;
+    *(.got2)
+    __got2_end = .;
+  }
+
+  . = ALIGN(4096);
+  _vmlinux_start =  .;
+  .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
+  _vmlinux_end =  .;
+
+  . = ALIGN(4096);
+  _initrd_start =  .;
+  .kernel:initrd : { *(.kernel:initrd) }
+  _initrd_end =  .;
+
+  . = ALIGN(4096);
+  _edata  =  .;
+
+  . = ALIGN(4096);
+  __stack_start =  .;
+  .stack : { *(.stack) }
+  __stack_end =  .;
+
+  . = ALIGN(4096);
+  __bss_start = .;
+  .bss       :
+  {
+   *(.sbss)
+   *(.bss)
+  }
+  . = ALIGN(4096);
+  _end = . ;
+}
+

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [0/5][POWERPC] boot: create zImage.kexec #2
@ 2006-07-01 23:46 Milton Miller
  2006-07-01 23:46 ` [4/5][POWERPC] boot: Makefile and linker scripts for zImage.kexec Milton Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Milton Miller @ 2006-07-01 23:46 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Sam Ravnborg

What follows is a series of 5 patches that take the existing zImge code
from the arch/powerpc/boot directory and add an alternative image that
will boot with a device tree struct but not with a prom interface
callback.

It searches the flat device tree (read-only) to find the
memory size, reserved ranges, and  rtas.  Messages are sent through
rtas to eiher the new for cell put-term-char or display-character
interfaces.


Status:  I changed more of the makefile to if_changed_dep.  I updated
the rules to not do if_changed and cmd when changing the same file.

Patches 4 and 5 have been rediffed and __ENTRY__ and __BASE__ are now
caps instead of lowercase in patch 5.

Unfornately I could not get my test and build machines talking due
to network problems, and thereefore was unable to regression test
the output.  Therefore the state is still 'it worked before I moved
code among the files' and 'display-character untested'.

Without [KBUILD] allow any PHONY in if_changed_dep it causes all
the files in boot to be built each time, unless we do some alternative,
either make COPYHEADERS a real dummy that we touch if it doesn't
exist, or just say rebuild all sources when any .h in the kernel
tree changes and collapse the dependency.

Its this fragment:

+$(obj-boot):  COPYHEADERS
+COPYHEADERS:	$(addprefix $(obj)/,$(linuxheader) $(zlibheader))
+PHONY	+= COPYHEADERS




 [1/5][POWERPC] boot: prepare for zImage.kexec
	I tried to keep the changes to main.c and prom.h minimal.  

 [2/5][POWERPC] boot: Add kexec callable zImage wrapper
	The actual code and crt0 for this method.

 [3/5][POWERPC] boot: use more Kbuild rules
	I had a bit of trouble with rebuilds.  This trys to get some
	rules more right.  

	It also renames zliblinuxheader to linuxheader as the next
	patch will add stringify.h to the list, and renames
	OBJCOPYFLAGS to allow usage of the $(objcopy) rule.

 [4/5][POWERPC] boot: Makefile and linker scripts for zImage.kexec
	Delta to above and inker scripts for the existing link.
	zImage.kexec is 32 bit, there is also altnernate link that
	pretends to be 64 bit which allows kexec-tools to load it
	without writing ompat code.

 [5/5][POWERPC] boot: generate lds file from lds.S
	An alterative file ploferations, generate the lds from .S using
	the Kbuild rule.  If you like this patch then I can avoid creating
	two files that are immediately removed.
milton

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

end of thread, other threads:[~2006-07-01 23:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-29 13:27 [4/5][POWERPC] boot: Makefile and linker scripts for zImage.kexec Milton Miller
  -- strict thread matches above, loose matches on Subject: below --
2006-07-01 23:46 [0/5][POWERPC] boot: create zImage.kexec #2 Milton Miller
2006-07-01 23:46 ` [4/5][POWERPC] boot: Makefile and linker scripts for zImage.kexec Milton Miller

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