From patchwork Wed Jul 29 12:49:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 38118 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6TCrlBf012807 for ; Wed, 29 Jul 2009 12:53:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751194AbZG2Mxp (ORCPT ); Wed, 29 Jul 2009 08:53:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754650AbZG2Mxp (ORCPT ); Wed, 29 Jul 2009 08:53:45 -0400 Received: from rv-out-0506.google.com ([209.85.198.234]:59923 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751194AbZG2Mxp (ORCPT ); Wed, 29 Jul 2009 08:53:45 -0400 Received: by rv-out-0506.google.com with SMTP id f6so212714rvb.1 for ; Wed, 29 Jul 2009 05:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=DzjVyWIfhT/N2NRDTstOsOubV2YPXifwl5B7wune5t0=; b=sXZC2vaOYyZhgTTegJdUbNErzPr2O+FpdvVOeW43OsX1HTjlx8rstEgGU0XYY+QhNM jbA7kCCNRNPUb81ykMUfOOzuiGglHGcYlcjam7icYaCA7BVR11CZKpSq0lR/Ch2kOl8+ BXWdatUGYQL03+w33tAAC7538uOFRnrWPf5C8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=iJE/pqmNKnVQywxhl/+GQ+0zd209ddcrYpe98nnsTEwkdj32IWGrpD/OGlaw2IJ/PR IsUOO6TTrJ8y+5JPSWYHEuLXtJdIOF9gZSIacjLKB9Xc/3i4tR6+KfXqnY/Rncsc7Si+ +euAcM5drrlb0r4+dcmuy9uka0j/0hpfNhR54= Received: by 10.141.33.16 with SMTP id l16mr6275022rvj.182.1248872024974; Wed, 29 Jul 2009 05:53:44 -0700 (PDT) Received: from rx1.opensource.se (210.5.32.202.bf.2iij.net [202.32.5.210]) by mx.google.com with ESMTPS id f21sm5602403rvb.4.2009.07.29.05.53.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 29 Jul 2009 05:53:44 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Wed, 29 Jul 2009 21:49:42 +0900 Message-Id: <20090729124942.3344.84856.sendpatchset@rx1.opensource.se> Subject: [PATCH] sh: romImage support Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm This patch adds support for the romImage build target. The resulting romImage file should be burned to rom or flash and could be used as small boot loader. Board code should keep their setup code in the file romimage.h located in their mach include directory. Signed-off-by: Magnus Damm --- arch/sh/Makefile | 2 +- arch/sh/boot/Makefile | 11 +++++++++-- arch/sh/boot/romimage/Makefile | 31 +++++++++++++++++++++++++++++++ arch/sh/boot/romimage/head_32.S | 18 ++++++++++++++++++ arch/sh/boot/romimage/head_64.S | 11 +++++++++++ arch/sh/include/mach-common/romimage.h | 1 + 6 files changed, 71 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/arch/sh/Makefile +++ work/arch/sh/Makefile 2009-07-29 20:36:36.000000000 +0900 @@ -195,7 +195,7 @@ libs-$(CONFIG_SUPERH32) := arch/sh/lib/ libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec \ - zImage vmlinux.srec + zImage vmlinux.srec romImage PHONY += maketools $(BOOT_TARGETS) FORCE maketools: include/linux/version.h FORCE --- 0001/arch/sh/boot/Makefile +++ work/arch/sh/boot/Makefile 2009-07-29 20:36:36.000000000 +0900 @@ -24,9 +24,9 @@ suffix-$(CONFIG_KERNEL_GZIP) := gz suffix-$(CONFIG_KERNEL_BZIP2) := bz2 suffix-$(CONFIG_KERNEL_LZMA) := lzma -targets := zImage vmlinux.srec uImage uImage.srec uImage.gz uImage.bz2 uImage.lzma +targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz uImage.bz2 uImage.lzma extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma -subdir- := compressed +subdir- := compressed romimage $(obj)/zImage: $(obj)/compressed/vmlinux FORCE $(call if_changed,objcopy) @@ -35,6 +35,13 @@ $(obj)/zImage: $(obj)/compressed/vmlinux $(obj)/compressed/vmlinux: FORCE $(Q)$(MAKE) $(build)=$(obj)/compressed $@ +$(obj)/romImage: $(obj)/romimage/vmlinux FORCE + $(call if_changed,objcopy) + @echo ' Kernel: $@ is ready' + +$(obj)/romimage/vmlinux: $(obj)/compressed/vmlinux FORCE + $(Q)$(MAKE) $(build)=$(obj)/romimage $@ + KERNEL_MEMORY := 0x00000000 ifeq ($(CONFIG_PMB_FIXED),y) KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \ --- /dev/null +++ work/arch/sh/boot/romimage/Makefile 2009-07-29 20:36:36.000000000 +0900 @@ -0,0 +1,31 @@ +# +# linux/arch/sh/boot/romimage/Makefile +# +# create an image suitable for burning to flash from zImage +# + +targets := vmlinux head_$(BITS).o + +OBJECTS = $(obj)/head_$(BITS).o + +# +# IMAGE_OFFSET is the load offset of the compression loader +# +IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \ + $$[$(CONFIG_PAGE_OFFSET) + \ + $(KERNEL_MEMORY) + \ + $(CONFIG_BOOT_LINK_OFFSET)]') + +LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) + +ifeq ($(CONFIG_MCOUNT),y) +ORIG_CFLAGS := $(KBUILD_CFLAGS) +KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) +endif + +LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e romstart \ + -T $(obj)/../../kernel/vmlinux.lds + +$(obj)/vmlinux: $(OBJECTS) arch/sh/boot/compressed/vmlinux $(LIBGCC) FORCE + $(call if_changed,ld) + @: --- /dev/null +++ work/arch/sh/boot/romimage/head_32.S 2009-07-29 20:45:52.000000000 +0900 @@ -0,0 +1,18 @@ +/* + * linux/arch/sh/boot/romimage/head_32.S + * + * Board specific setup code, executed before zImage loader + */ + +.text + .global romstart +romstart: +#include + mov.l startup_addr, r0 + jmp @r0 + nop + + .align 2 +startup_addr: + .long startup + .align 0 --- /dev/null +++ work/arch/sh/boot/romimage/head_64.S 2009-07-29 20:46:55.000000000 +0900 @@ -0,0 +1,11 @@ +/* + * linux/arch/sh/boot/romimage/head_64.S + * + * Board specific setup code, executed before zImage loader + */ + +.text + .global romstart +romstart: +#include +#warning "64-bit implementation needs more work" --- /dev/null +++ work/arch/sh/include/mach-common/romimage.h 2009-07-29 20:36:36.000000000 +0900 @@ -0,0 +1 @@ +/* do nothing here by default */