Git format-patch style patch attached.  This is an updated version of a
patch previously sent to the [email protected] list.

Tested cross building a 3.2.20 kernel for a beagleboard.org
BeagleBone on a Squeeze host and upgrading from 3.2.0 to 3.2.20 with
dpkg on Squeeze armel target.

Should apply cleanly to v12.036+nmu3 with 'patch -p1 < patchname'

Sorry for my previous bone-headed email.

Thanks,
Andrew
>From 4eaae2f0e6ab55ee2bb68c7ef68065536bc68f70 Mon Sep 17 00:00:00 2001
From: Andrew Bradford <[email protected]>
Date: Tue, 18 Dec 2012 08:55:04 -0500
Subject: [PATCH] Allow creation of uImage kernels for u-boot on ARM

Add the --uimage option to build a uImage kernel for ARM systems.
You'll need uboot-mkimage installed to do so, it should be recommended.
---
 debian/control               |    2 +-
 kernel/pkg/image/config      |    1 +
 kernel/pkg/image/postinst    |    1 +
 kernel/ruleset/arches/arm.mk |   23 +++++++++++++++++++----
 make-kpkg                    |   21 ++++++++++++++++++---
 5 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/debian/control b/debian/control
index eb164a6..29bcbc5 100644
--- a/debian/control
+++ b/debian/control
@@ -23,7 +23,7 @@ Description: A utility for building Linux kernel related Debian packages.
 Depends: build-essential, make (>= 3.80-10), po-debconf, gettext, file,
           debianutils (>= 2.30), binutils (>= 2.12), util-linux (>= 2.10o),
           module-init-tools (>= 0.9.10)
-Recommends: cpio
+Recommends: cpio, uboot-mkimage
 Suggests: linux-source | kernel-source, e2fsprogs (>= 1.41.4),
            libncurses-dev, docbook-utils, xmlto, e2fsprogs (>= 1.29), bzip2,
            linux-initramfs-tool, grub (>= 0.93) | grub2, jfsutils (>= 1.1.3),
diff --git a/kernel/pkg/image/config b/kernel/pkg/image/config
index b05b888..3c4fe5a 100755
--- a/kernel/pkg/image/config
+++ b/kernel/pkg/image/config
@@ -108,6 +108,7 @@ elsif ($kimage =~ m/^[iI]mage$/o)     { my $nop = $kimage;   }
 elsif ($kimage =~ m/^vmlinux$/o)      { my $nop = $kimage;   }
 elsif ($kimage =~ m/^xen[0u]-linux$/o){
     $package_name       = "${kimage}-$version";}
+elsif ($kimage =~ m/^uImage$/o)       { my $nop = $kimage;   }
 else                                  { $kimage = "vmlinuz"; } # Default
 
 if (-d "$kimage" ) {
diff --git a/kernel/pkg/image/postinst b/kernel/pkg/image/postinst
index c0a30fd..d160cba 100755
--- a/kernel/pkg/image/postinst
+++ b/kernel/pkg/image/postinst
@@ -134,6 +134,7 @@ elsif ($kimage =~ m/^b?zImage$/o)     {$kimage = "vmlinuz"} # these produce vmli
 elsif ($kimage =~ m/^[iI]mage$/o)     { my $nop = $kimage;}
 elsif ($kimage =~ m/^vmlinux$/o)      { my $nop = $kimage;}
 elsif ($kimage =~ m/^xen[0u]-linux$/o){ $package_name  = "${kimage}-$version";}
+elsif ($kimage =~ m/^uImage$/o)       { my $nop = $kimage;}
 else                                   {$kimage = "vmlinuz"} # default
 
 $ENV{KERNEL_ARCH}=$kernel_arch if $kernel_arch;
diff --git a/kernel/ruleset/arches/arm.mk b/kernel/ruleset/arches/arm.mk
index 33a1235..cbf5958 100644
--- a/kernel/ruleset/arches/arm.mk
+++ b/kernel/ruleset/arches/arm.mk
@@ -42,11 +42,26 @@ ifeq ($(strip $(architecture)),arm)
     NEED_DIRECT_GZIP_IMAGE=NO
     DEBCONFIG= $(CONFDIR)/config.netwinder
   else
-    kimage := vmlinuz
-    target = zImage
+    ifeq (uImage,$(IMAGE_TYPE))
+      kimage := uImage
+    else
+      kimage := vmlinuz
+    endif
+    # Default to zImage and vmlinuz-$(KERNRELEASE) unless overridden
+    ifeq (,$(IMAGE_TYPE))
+      target = zImage
+      kimagesrc = arch/$(KERNEL_ARCH)/boot/zImage
+      kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(KERNELRELEASE)
+    else
+      target = $(IMAGE_TYPE)
+      kimagesrc = arch/$(KERNEL_ARCH)/boot/$(IMAGE_TYPE)
+      ifeq (uImage,$(IMAGE_TYPE))
+        kimagedest = $(INT_IMAGE_DESTDIR)/uImage-$(KERNELRELEASE)
+      else
+        kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(KERNELRELEASE)
+      endif
+    endif
     NEED_DIRECT_GZIP_IMAGE=NO
-    kimagesrc = arch/$(KERNEL_ARCH)/boot/zImage
-    kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(KERNELRELEASE)
     DEBCONFIG = $(CONFDIR)/config.$(DEB_HOST_ARCH)
   endif
   kelfimagesrc = vmlinux
diff --git a/make-kpkg b/make-kpkg
index 27502df..b477890 100755
--- a/make-kpkg
+++ b/make-kpkg
@@ -37,6 +37,7 @@ my $append_to_version='';
 my $arch='';
 my $arch_in_name=0;
 my $bzimage;
+my $uimage;
 my $concurrency=0;
 my $config_target='oldconfig';
 my $cross_compile='';
@@ -85,6 +86,7 @@ my %option_ctl =
    "us"                  => \$unsign_source,
    "uc"                  => \$unsign_changelog,
    "bzimage"             => \$bzimage,
+   "uimage"              => \$uimage,
    "mkimage=s"           => \$mkimage,
    "jobs|j=i"            => \$concurrency
   );
@@ -323,6 +325,14 @@ on sites where the default is zImage kernels.
 
 =back
 
+=item B<--uimage>
+
+=over 2
+
+Makes a uImage kernel. Useful for people who want a uImage kernel.
+
+=back
+
 =item B<--rootcmd>
 
 =over 2
@@ -402,6 +412,8 @@ usage: $main::MYNAME [options] target [target ...]
  --bzimage             Create a kernel using bzImage (in case the site
                        wide default is zimage, as set in
                        /etc/kernel-pkg.conf)
+ --uimage              Create a kernel using uImage rather than zImage
+                       or bzImage
  --rootcmd method      A command that provides a means of gaining
                        superuser access (for example, `sudo' or
                        `fakeroot') as needed by dpkg-buildpackages'
@@ -416,7 +428,7 @@ usage: $main::MYNAME [options] target [target ...]
                        changelog. This is only relevant for the
                        buildpackage target.
 
-Use one of --zimage or --bzimage, or none, but not both.
+Optionally, use only one of --zimage, --bzimage, or --uimage.
 
 Option Format: The options may be shortened to the smallest unique
 string, and may be entered with either a - or a -- prefix, and you may
@@ -684,8 +696,8 @@ sub main (){
     exit 0;
   }
 
-  if ($bzimage && $zimage){
-    print "Use only one of bzimage and zimage options.\n";
+  if (($bzimage && $zimage) || ($bzimage && $uimage) || ( $zimage && $uimage)){
+    print "Use only one of bzimage, zimage, and uimage options.\n";
     print "use --help to display command line syntax help.\n";
     exit 1;
   }
@@ -944,6 +956,9 @@ EOERR3
   elsif ($bzimage) {
     $command .= " IMAGE_TYPE=bzImage ";
   }
+  elsif ($uimage) {
+    $command .= " IMAGE_TYPE=uImage ";
+  }
 
   my $hostcc = $ENV{'HOSTCC'} if $ENV{'HOSTCC'};
   $hostcc =~ s/^\s+//g if $hostcc;
-- 
1.7.10.4

Reply via email to