Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[firefly-linux-kernel-4.4.55.git] / scripts / package / builddeb
index 35d5a5877d040a6f3db61badd77ed6c991af5dcf..59726243c2ebab1a9263019a5ff8eb759b2fdda7 100755 (executable)
@@ -37,7 +37,7 @@ create_package() {
        s390*)
                debarch=s390$(grep -q CONFIG_64BIT=y $KCONFIG_CONFIG && echo x || true) ;;
        ppc*)
-               debarch=powerpc ;;
+               debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;;
        parisc*)
                debarch=hppa ;;
        mips*)
@@ -64,7 +64,7 @@ create_package() {
        fi
 
        # Create the package
-       dpkg-gencontrol -isp $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir"
+       dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir"
        dpkg --build "$pdir" ..
 }
 
@@ -152,18 +152,16 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
                rmdir "$tmpdir/lib/modules/$version"
        fi
        if [ -n "$BUILD_DEBUG" ] ; then
-               (
-                       cd $tmpdir
-                       for module in $(find lib/modules/ -name *.ko); do
-                               mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
-                               # only keep debug symbols in the debug file
-                               $OBJCOPY --only-keep-debug $module $dbg_dir/usr/lib/debug/$module
-                               # strip original module from debug symbols
-                               $OBJCOPY --strip-debug $module
-                               # then add a link to those
-                               $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module
-                       done
-               )
+               for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do
+                       module=lib/modules/$module
+                       mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
+                       # only keep debug symbols in the debug file
+                       $OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module
+                       # strip original module from debug symbols
+                       $OBJCOPY --strip-debug $tmpdir/$module
+                       # then add a link to those
+                       $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module
+               done
        fi
 fi