[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#593340: linux-2.6: please add new Debian arch: powerpcspe



Package: linux-2.6 
Version: 2.6.32-20
Severity: wishlist
Tags: patch sid
User: debian-powerpcspe@breakpoint.cc
Usertags: powerpcspe

This patch adds support for powerpcspe. The config activates a few
drivers and 85xx board. It was tested on top of the unstable svn
branch on mpc8536ds. SMP support is for mpc8572ds.

The boot loader expects us give it a kernel and ramdisk with an uImage
header around it. The compression is only important for the kernel as
the boot loader only decompresses the kernel. The ramdisk gets only its
uImage header removed and passed as it.
Since this image is also used by the D-I, the kernel image depends on
the just introduced linux-devicetree package which provides machine
descriptions for the individual boards. After an installation we will
have the kernel, initrd and device tree in proper shape. This means we
can pass it to the boot loader and boot. The boot loader has support for
SATA and TFTP so I guess we don't need any further hacks.

Sebastian
From 7bb5f1c7591def3f76cdf07e6fdd616d1000464b Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Mon, 16 Aug 2010 10:13:26 +0200
Subject: [PATCH] linux-2.6: add support for powerpcspe

This patch adds support for powerpcspe. The config activates a few
drivers and 85xx board. It was tested on top of the unstable svn
branch on mpc8536ds. SMP support is for mpc8572ds.

The boot loader expects us give it a kernel and ramdisk with an uImage
header around it. The compression is only important for the kernel as
the boot loader only decompresses the kernel. The ramdisk gets only its
uImage header removed and passed as it.
Since this image is also used by the D-I, the kernel image depends on
the just introduced linux-devicetree package which provides machine
descriptions for the individual boards. After an installation we will
have the kernel, initrd and device tree in proper shape. This means we
can pass it to the boot loader and boot. The boot loader has support for
SATA and TFTP so I guess we don't need any further hacks.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 debian/bin/initramfs-uimage-format             |   30 ++++++++++++++
 debian/config/defines                          |    2 +
 debian/config/powerpcspe/config                |   51 ++++++++++++++++++++++++
 debian/config/powerpcspe/config.powerpcspe-smp |    4 ++
 debian/config/powerpcspe/defines               |   32 +++++++++++++++
 debian/rules                                   |    1 +
 debian/rules.real                              |   45 ++++++++++++++++++++-
 debian/templates/control.main.in               |   12 +++++-
 debian/templates/control.source.in             |    2 +-
 9 files changed, 175 insertions(+), 4 deletions(-)
 create mode 100644 debian/bin/initramfs-uimage-format
 create mode 100644 debian/config/powerpcspe/config
 create mode 100644 debian/config/powerpcspe/config.powerpcspe-smp
 create mode 100644 debian/config/powerpcspe/defines

diff --git a/debian/bin/initramfs-uimage-format b/debian/bin/initramfs-uimage-format
new file mode 100644
index 0000000..459b231
--- /dev/null
+++ b/debian/bin/initramfs-uimage-format
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+# Script is called by kernel postinst with
+#  version
+# Where version is upstream version. It will create an uImage header around
+# the freshly created initrd.
+#
+if [ -n "$1" ]; then
+	version="$1"
+	initrd="/boot/initrd.img-${version}"
+else
+	echo "Need version as argument"
+	exit 1
+fi
+
+if [ ! -f ${initrd} ]; then
+	echo "Can't find ${initrd}."
+	exit 1
+fi
+
+echo "Creating new ${file}.uImage"
+tmp=$(tempfile --prefix=initrd-upgrade)
+mkimage -A ppc -O linux -T ramdisk -C gzip -d ${initrd} ${tmp}
+if [ -e ${initrd}.uImage ]; then
+	echo "backup of ${initrd}.uImage."
+	mv ${initrd}.uImage ${initrd}.uImage.bak
+fi
+mv $tmp ${initrd}.uImage
+echo "New ${initrd}.uImage is ready"
diff --git a/debian/config/defines b/debian/config/defines
index e2da5b0..505b9bd 100644
--- a/debian/config/defines
+++ b/debian/config/defines
@@ -41,6 +41,7 @@ arches:
  mips
  mipsel
  powerpc
+ powerpcspe
  s390
  sh4
  sparc
@@ -74,6 +75,7 @@ initramfs-tools: update-initramfs
 
 [relations]
 gcc-4.3: gcc-4.3
+gcc-4.4: gcc-4.4
 initramfs-fallback: linux-initramfs-tool
 initramfs-tools: initramfs-tools (>= 0.55)
 util-vserver: util-vserver (>= 0.30.215)
diff --git a/debian/config/powerpcspe/config b/debian/config/powerpcspe/config
new file mode 100644
index 0000000..015c6d9
--- /dev/null
+++ b/debian/config/powerpcspe/config
@@ -0,0 +1,51 @@
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_PPC_85xx=y
+CONFIG_E500=y
+CONFIG_BOOKE=y
+CONFIG_FSL_BOOKE=y
+CONFIG_SPE=y
+CONFIG_OPROFILE=m
+CONFIG_MPC8536_DS=y
+CONFIG_MPC85xx_DS=y
+# CONFIG_CPU_FREQ is not set
+CONFIG_PPC_INDIRECT_PCI=y
+CONFIG_FSL_PCI=y
+CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_SYSCALL=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCIEAER=y
+CONFIG_PCI_MSI=y
+CONFIG_PCI_LEGACY=y
+CONFIG_MTD=y
+CONFIG_MTD_OF_PARTS=m
+CONFIG_MTD_BLOCK=m
+CONFIG_MTD_CFI=m
+CONFIG_MTD_JEDECPROBE=m
+CONFIG_MTD_CFI_INTELEXT=m
+CONFIG_MTD_CFI_AMDSTD=m
+CONFIG_MTD_CFI_STAA=m
+CONFIG_MTD_CFI_UTIL=m
+CONFIG_MTD_PHYSMAP_OF=m
+CONFIG_SATA_FSL=m
+CONFIG_FSL_PQ_MDIO=m
+CONFIG_GIANFAR=m
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_NR_UARTS=4
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+CONFIG_SERIAL_8250_SHARE_IRQ=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_BOOKE_WDT=y
+CONFIG_I2C_MPC=m
+CONFIG_SPI_MPC8xxx=m
+CONFIG_FB=m
+CONFIG_FB_FSL_DIU=m
+CONFIG_FRAMEBUFFER_CONSOLE=m
+CONFIG_USB=m
+CONFIG_USB_EHCI_HCD=m
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+CONFIG_USB_EHCI_FSL=y
+CONFIG_USB_EHCI_HCD_PPC_OF=y
diff --git a/debian/config/powerpcspe/config.powerpcspe-smp b/debian/config/powerpcspe/config.powerpcspe-smp
new file mode 100644
index 0000000..0fa3434
--- /dev/null
+++ b/debian/config/powerpcspe/config.powerpcspe-smp
@@ -0,0 +1,4 @@
+CONFIG_HIGHMEM=y
+CONFIG_SMP=y
+CONFIG_NR_CPUS=2
+CONFIG_PM_SLEEP_SMP=y
diff --git a/debian/config/powerpcspe/defines b/debian/config/powerpcspe/defines
new file mode 100644
index 0000000..5db2d99
--- /dev/null
+++ b/debian/config/powerpcspe/defines
@@ -0,0 +1,32 @@
+[base]
+flavours:
+ powerpcspe
+ powerpcspe-smp
+kernel-arch: powerpc
+compiler: gcc-4.4
+
+[powerpcspe_base]
+class: Book-E Freescale
+longclass: Freescale's Book-E
+
+[powerpcspe_build]
+image-file: arch/powerpc/boot/uImage
+
+[powerpcspe_image]
+depends: uboot-mkimage, linux-devicetree
+[powerpcspe_description]
+hardware: uniprocessor 32-bit FSL book-E PowerPC
+
+[powerpcspe-smp_base]
+class: Book-E Freescale
+longclass: Book-E with Freescale's changes
+
+[powerpcspe-smp_build]
+image-file: arch/powerpc/boot/uImage
+
+[powerpcspe-smp_image]
+depends: uboot-mkimage, linux-devicetree
+configs: powerpcspe/config powerpcspe/config.powerpcspe-smp
+
+[powerpcspe-smp_description]
+hardware: multiprocessor 32-bit FSL book-E PowerPC
diff --git a/debian/rules b/debian/rules
index 2c64da3..6b41db6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -57,6 +57,7 @@ maintainerclean:
 clean: debian/control
 	dh_testdir
 	rm -rf $(BUILD_DIR) $(STAMPS_DIR) debian/lib/python/debian_linux/*.pyc debian/linux-headers-* debian/linux-image-* debian/linux-tools-*
+	rm -rf debian/linux-devicetree-*
 	dh_clean
 
 binary-indep: $(STAMPS_DIR)/source-base
diff --git a/debian/rules.real b/debian/rules.real
index 7d27884..919f926 100644
--- a/debian/rules.real
+++ b/debian/rules.real
@@ -39,9 +39,12 @@ MAKE_PERF_VARS = prefix=/usr NO_PERL=1 V=2
 #
 binary-arch-arch: install-headers_$(ARCH)
 binary-arch-arch: install-libc-dev_$(ARCH)
-ifneq ($(filter amd64 hppa i386 powerpc s390 sh4 sparc sparc64,$(ARCH)),)
+ifneq ($(filter amd64 hppa i386 powerpc powerpcspe s390 sh4 sparc sparc64,$(ARCH)),)
   binary-arch-arch: install-tools_$(ARCH)
 endif
+ifneq ($(filter powerpcspe ,$(ARCH)),)
+  binary-arch-arch: install-devicetree_$(ARCH)
+endif
 binary-arch-featureset: install-headers_$(ARCH)_$(FEATURESET)
 binary-arch-flavour: install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE)
 ifeq ($(DEBUG),True)
@@ -145,6 +148,18 @@ $(STAMPS_DIR)/build-tools_$(ARCH): $(STAMPS_DIR)/source
 	+$(MAKE_CLEAN) -C '$(DIR)/tools/perf' $(JOBS_ARG) $(MAKE_PERF_VARS) all man
 	@$(stamp)
 
+$(STAMPS_DIR)/build-devicetree_$(ARCH): SOURCE_DIR=$(BUILD_DIR)/source
+$(STAMPS_DIR)/build-devicetree_$(ARCH): DIR=$(BUILD_DIR)/build-devicetree_$(ARCH)
+$(STAMPS_DIR)/build-devicetree_$(ARCH): $(STAMPS_DIR)/source
+	rm -rf $(DIR)
+	mkdir -p $(DIR)
+	for name in mpc8536ds mpc8572ds; do \
+		dtc -O dtb -b 0 -p 1024 \
+			-o $(DIR)/$$name-$(UPSTREAMVERSION).dtb \
+			$(SOURCE_DIR)/arch/$(KERNEL_ARCH)/boot/dts/$$name.dts; \
+	done
+	@$(stamp)
+
 $(STAMPS_DIR)/build-doc: SOURCE_DIR=$(BUILD_DIR)/source
 $(STAMPS_DIR)/build-doc: DIR=$(BUILD_DIR)/build-doc
 $(STAMPS_DIR)/build-doc: $(STAMPS_DIR)/source
@@ -254,7 +269,7 @@ install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/build_$(ARCH)_$(
 	cp -a $(SOURCE_DIR)/{.config,.kernel*,Module.symvers,include} $(DIR)
 	cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/kernel/asm-offsets.s $(DIR)/arch/$(KERNEL_ARCH)/kernel
 
-ifeq ($(ARCH),powerpc)
+ifneq ($(filter powerpc powerpcspe,$(ARCH)),)
 	if [ -f $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/lib/crtsavres.o ]; then \
 		mkdir $(DIR)/arch/$(KERNEL_ARCH)/lib; \
 		cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/lib/crtsavres.o $(DIR)/arch/$(KERNEL_ARCH)/lib; \
@@ -379,6 +394,16 @@ install-image_mips_$(FEATURESET)_$(FLAVOUR)_plain_image \
 install-image_mipsel_$(FEATURESET)_$(FLAVOUR)_plain_image:
 	install -m644 '$(DIR)/vmlinux' $(INSTALL_DIR)/vmlinux-$(REAL_VERSION)
 
+install-image_powerpcspe_$(FEATURESET)_$(FLAVOUR)_plain_image: WRAPPER_INSTALL_DIR = '$(CURDIR)'/$(PACKAGE_DIR)/usr/lib/linux-image-$(REAL_VERSION)
+install-image_powerpcspe_$(FEATURESET)_$(FLAVOUR)_plain_image:
+	install -m644 '$(DIR)/arch/$(KERNEL_ARCH)/boot/uImage' $(INSTALL_DIR)/uImage-$(REAL_VERSION)
+	+$(MAKE_CLEAN) -C '$(DIR)' bootwrapper_install \
+	  WRAPPER_OBJDIR='$(WRAPPER_INSTALL_DIR)' \
+	  WRAPPER_DTSDIR='$(WRAPPER_INSTALL_DIR)'/dts \
+	  WRAPPER_BINDIR='$(WRAPPER_INSTALL_DIR)'
+	mkdir -p $(PACKAGE_DIR)/etc/kernel/postinst.d/$(REAL_VERSION)
+	install -m755 debian/bin/initramfs-uimage-format $(PACKAGE_DIR)/etc/kernel/postinst.d/$(REAL_VERSION)
+
 install-image_powerpc_$(FEATURESET)_$(FLAVOUR)_plain_image: WRAPPER_INSTALL_DIR = '$(CURDIR)'/$(PACKAGE_DIR)/usr/lib/linux-image-$(REAL_VERSION)
 install-image_powerpc_$(FEATURESET)_$(FLAVOUR)_plain_image:
 	install -m644 '$(DIR)/vmlinux' $(INSTALL_DIR)/vmlinux-$(REAL_VERSION)
@@ -400,6 +425,8 @@ install-image_mips_$(FEATURESET)_$(FLAVOUR)_plain_templates \
 install-image_mipsel_$(FEATURESET)_$(FLAVOUR)_plain_templates \
 install-image_powerpc_$(FEATURESET)_$(FLAVOUR)_plain_templates: ARG_KIMAGE = vmlinux
 
+install-image_powerpcspe_$(FEATURESET)_$(FLAVOUR)_plain_templates: ARG_KIMAGE = uImage
+
 install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_templates:
 	for i in $(wildcard debian/templates/temp.image.plain/*); do \
 	  sed \
@@ -495,6 +522,20 @@ install-tools_$(ARCH): $(STAMPS_DIR)/build-tools_$(ARCH)
 		$(PACKAGE_DIR)/usr/share/man/*/*
 	+$(MAKE_SELF) install-base
 
+install-devicetree_$(ARCH): PACKAGE_NAME = linux-devicetree-$(UPSTREAMVERSION)
+install-devicetree_$(ARCH): PACKAGE_DIR = debian/$(PACKAGE_NAME)
+install-devicetree_$(ARCH): DIR = $(BUILD_DIR)/build-devicetree_$(ARCH)
+install-devicetree_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME)
+install-devicetree_$(ARCH): $(STAMPS_DIR)/build-devicetree_$(ARCH)
+	dh_testdir
+	dh_testroot
+	dh_prep
+	dh_installdirs boot
+	for dtb in $(DIR)/*.dtb; do \
+		install -m644 "$$dtb" "$(PACKAGE_DIR)/boot/" || exit; \
+	done
+	+$(MAKE_SELF) install-base
+
 install-patch: PACKAGE = linux-patch-debian-$(VERSION)
 install-patch: pbase := /usr/src/kernel-patches/all/$(UPSTREAMVERSION)
 install-patch: pfull := debian/$(PACKAGE)$(pbase)
diff --git a/debian/templates/control.main.in b/debian/templates/control.main.in
index 15fee80..c416dfa 100644
--- a/debian/templates/control.main.in
+++ b/debian/templates/control.main.in
@@ -1,5 +1,5 @@
 Package: linux-tools-@version@
-Architecture: amd64 hppa i386 powerpc s390 sh4 sparc sparc64
+Architecture: amd64 hppa i386 powerpc powerpcspe s390 sh4 sparc sparc64
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Recommends: linux-base (>= 2.6.32-16)
 Suggests: linux-doc-@version@
@@ -10,6 +10,16 @@ Description: Performance analysis tools for Linux @upstreamversion@
  The linux-base package contains a 'perf' command which will invoke the
  appropriate version for the running kernel.
 
+Package: linux-devicetree-@version@
+Architecture: powerpcspe
+Section: kernel
+Provides: linux-devicetree
+Depends: ${misc:Depends}
+Description: Devicetree blobs for Linux @upstreamversion@
+ This package contains the devicetrees for Linux kernel version
+ @upstreamversion@. It is required by the bootloader for the hardware
+ description.
+
 Package: linux-source-@version@
 Architecture: all
 Section: kernel
diff --git a/debian/templates/control.source.in b/debian/templates/control.source.in
index 377d3b4..a1b9779 100644
--- a/debian/templates/control.source.in
+++ b/debian/templates/control.source.in
@@ -3,7 +3,7 @@ Priority: optional
 Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org>
 Uploaders: Bastian Blank <waldi@debian.org>, Frederik Schüler <fs@debian.org>, maximilian attems <maks@debian.org>, Ben Hutchings <ben@decadent.org.uk>
 Standards-Version: 3.8.4
-Build-Depends: debhelper (>> 7), cpio, module-init-tools, python, lzma [armel], libelf-dev, binutils-dev, asciidoc, xmlto
+Build-Depends: debhelper (>> 7), cpio, module-init-tools, python, lzma [armel], libelf-dev, binutils-dev, asciidoc, xmlto, uboot-mkimage [powerpcspe], device-tree-compiler [powerpcspe]
 Build-Depends-Indep: bzip2, python-support
 Vcs-Svn: svn://svn.debian.org/svn/kernel/dists/sid/linux-2.6/
 Vcs-Browser: http://svn.debian.org/wsvn/kernel/dists/sid/linux-2.6/?op=log
-- 
1.7.2


Reply to: