* [PATCH 2.6.20 1/14] CRIS architecture update - Build system
@ 2007-04-22 19:24 Mikael Starvik
2007-04-22 19:40 ` Sam Ravnborg
0 siblings, 1 reply; 2+ messages in thread
From: Mikael Starvik @ 2007-04-22 19:24 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm
[-- Attachment #1: Type: text/plain, Size: 158 bytes --]
The attached patch improves the CRIS build system by allowing out-of-tree objdir everywhere
Signed-off-by: Mikael Starvik <starvik@axis.com>
/Mikael
[-- Attachment #2: cris1_make.patch --]
[-- Type: application/octet-stream, Size: 6143 bytes --]
diff -urNP --exclude='*.cvsignore' ../linux/arch/cris/arch-v10/boot/compressed/Makefile linux-2.6/arch/cris/arch-v10/boot/compressed/Makefile
--- ../linux/arch/cris/arch-v10/boot/compressed/Makefile 2007-02-04 19:44:54.000000000 +0100
+++ linux-2.6/arch/cris/arch-v10/boot/compressed/Makefile 2006-10-11 17:47:04.000000000 +0200
@@ -1,45 +1,34 @@
#
-# create a compressed vmlinuz image from the binary vmlinux.bin file
+# arch/cris/arch-v10/boot/compressed/Makefile
#
-target = $(target_compressed_dir)
-src = $(src_compressed_dir)
CC = gcc-cris -melf $(LINUXINCLUDE)
CFLAGS = -O2
LD = ld-cris
+LDFLAGS = -T $(obj)/decompress.ld
+OBJECTS = $(obj)/head.o $(obj)/misc.o
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
-OBJECTS = $(target)/head.o $(target)/misc.o
-# files to compress
-SYSTEM = $(objtree)/vmlinux.bin
+quiet_cmd_image = BUILD $@
+cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz > $@
-all: $(target_compressed_dir)/vmlinuz
+targets := vmlinux piggy.gz decompress.o decompress.bin
-$(target)/decompress.bin: $(OBJECTS)
- $(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS)
- $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin
+$(obj)/decompress.o: $(OBJECTS) FORCE
+ $(call if_changed,ld)
-# Create vmlinuz image in top-level build directory
-$(target_compressed_dir)/vmlinuz: $(target) piggy.img $(target)/decompress.bin
- @echo " COMPR vmlinux.bin --> vmlinuz"
- @cat $(target)/decompress.bin piggy.img > $(target_compressed_dir)/vmlinuz
- @rm -f piggy.img
+$(obj)/decompress.bin: $(obj)/decompress.o FORCE
+ $(call if_changed,objcopy)
-$(target)/head.o: $(src)/head.S
- $(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
+$(obj)/head.o: $(obj)/head.S .config
+ @$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
-$(target)/misc.o: $(src)/misc.c
- $(CC) -D__KERNEL__ -c $< -o $@
+$(obj)/misc.o: $(obj)/misc.c .config
+ @$(CC) -D__KERNEL__ -c $< -o $@
-# gzip the kernel image
-
-piggy.img: $(SYSTEM)
- @cat $(SYSTEM) | gzip -f -9 > piggy.img
-
-$(target):
- mkdir -p $(target)
-
-clean:
- rm -f piggy.img $(objtree)/vmlinuz
+$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
+ $(call if_changed,image)
+$(obj)/piggy.gz: $(obj)/../Image FORCE
+ $(call if_changed,gzip)
diff -urNP --exclude='*.cvsignore' ../linux/arch/cris/arch-v10/boot/Makefile linux-2.6/arch/cris/arch-v10/boot/Makefile
--- ../linux/arch/cris/arch-v10/boot/Makefile 2007-02-04 19:44:54.000000000 +0100
+++ linux-2.6/arch/cris/arch-v10/boot/Makefile 2006-11-29 17:05:40.000000000 +0100
@@ -1,13 +1,21 @@
#
-# arch/cris/boot/Makefile
+# arch/cris/arch-v10/boot/Makefile
#
-target = $(target_boot_dir)
-src = $(src_boot_dir)
-zImage: compressed/vmlinuz
+OBJCOPY = objcopy-cris
+OBJCOPYFLAGS = -O binary --remove-section=.bss
-compressed/vmlinuz:
- @$(MAKE) -f $(src)/compressed/Makefile $(target_compressed_dir)/vmlinuz
+subdir- := compressed rescue
+targets := Image
-clean:
- @$(MAKE) -f $(src)/compressed/Makefile clean
+$(obj)/Image: vmlinux FORCE
+ $(call if_changed,objcopy)
+ @echo ' Kernel: $@ is ready'
+
+$(obj)/compressed/vmlinux: $(obj)/Image FORCE
+ $(Q)$(MAKE) $(build)=$(obj)/compressed $@
+ $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin
+
+$(obj)/zImage: $(obj)/compressed/vmlinux
+ @cp $< $@
+ @echo ' Kernel: $@ is ready'
diff -urNP --exclude='*.cvsignore' ../linux/arch/cris/arch-v10/boot/rescue/Makefile linux-2.6/arch/cris/arch-v10/boot/rescue/Makefile
--- ../linux/arch/cris/arch-v10/boot/rescue/Makefile 2007-02-04 19:44:54.000000000 +0100
+++ linux-2.6/arch/cris/arch-v10/boot/rescue/Makefile 2006-11-30 11:42:39.000000000 +0100
@@ -1,56 +1,38 @@
#
-# Makefile for rescue code
+# Makefile for rescue (bootstrap) code
#
-target = $(target_rescue_dir)
-src = $(src_rescue_dir)
CC = gcc-cris -mlinux $(LINUXINCLUDE)
CFLAGS = -O2
-LD = gcc-cris -mlinux -nostdlib
+AFLAGS = -traditional
+LD = gcc-cris -mlinux -nostdlib
+LDFLAGS = -T $(obj)/rescue.ld
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
+obj-y = head.o
+OBJECT = $(obj)/$(obj-y)
-all: $(target)/rescue.bin $(target)/testrescue.bin $(target)/kimagerescue.bin
+targets := rescue.o rescue.bin
-$(target)/rescue.bin: $(target) $(target)/head.o
- $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o
- $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin
-# Place a copy in top-level build directory
- cp -p $(target)/rescue.bin $(objtree)
+$(obj)/rescue.o: $(OBJECT) FORCE
+ $(call if_changed,ld)
-$(target)/testrescue.bin: $(target) $(target)/testrescue.o
- $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/testrescue.o tr.bin
+$(obj)/rescue.bin: $(obj)/rescue.o FORCE
+ $(call if_changed,objcopy)
+ cp -p $(obj)/rescue.bin $(objtree)
+
+$(obj)/testrescue.bin: $(obj)/testrescue.o
+ $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
# Pad it to 784 bytes
dd if=/dev/zero of=tmp2423 bs=1 count=784
cat tr.bin tmp2423 >testrescue_tmp.bin
- dd if=testrescue_tmp.bin of=$(target)/testrescue.bin bs=1 count=784
+ dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
rm tr.bin tmp2423 testrescue_tmp.bin
-$(target)/kimagerescue.bin: $(target) $(target)/kimagerescue.o
- $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/kimagerescue.o ktr.bin
+$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
+ $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
# Pad it to 784 bytes, that's what the rescue loader expects
dd if=/dev/zero of=tmp2423 bs=1 count=784
cat ktr.bin tmp2423 >kimagerescue_tmp.bin
- dd if=kimagerescue_tmp.bin of=$(target)/kimagerescue.bin bs=1 count=784
+ dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
rm ktr.bin tmp2423 kimagerescue_tmp.bin
-
-$(target):
- mkdir -p $(target)
-
-$(target)/head.o: $(src)/head.S
- $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
-
-$(target)/testrescue.o: $(src)/testrescue.S
- $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
-
-$(target)/kimagerescue.o: $(src)/kimagerescue.S
- $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
-
-clean:
- rm -f $(target)/*.o $(target)/*.bin
-
-fastdep:
-
-modules:
-
-modules-install:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2.6.20 1/14] CRIS architecture update - Build system
2007-04-22 19:24 [PATCH 2.6.20 1/14] CRIS architecture update - Build system Mikael Starvik
@ 2007-04-22 19:40 ` Sam Ravnborg
0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2007-04-22 19:40 UTC (permalink / raw)
To: Mikael Starvik; +Cc: linux-kernel, akpm
On Sun, Apr 22, 2007 at 09:24:34PM +0200, Mikael Starvik wrote:
> The attached patch improves the CRIS build system by allowing out-of-tree objdir everywhere
I have browsed through the changes and this is in addition a much more readable
set of Makefile's - good work!
I stumbled over this:
+AFLAGS = -traditional
+LD = gcc-cris -mlinux -nostdlib
+LDFLAGS = -T $(obj)/rescue.ld
We have in i386 / x86_64 recently managed to get rid of -traditional.
And it looks a bit strange that you use gcc as linker.
But thats how it was also done before so not a big issue.
>
> Signed-off-by: Mikael Starvik <starvik@axis.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Sam
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-04-22 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-22 19:24 [PATCH 2.6.20 1/14] CRIS architecture update - Build system Mikael Starvik
2007-04-22 19:40 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®