Move sun8i mainline to sun8i-dev LINUXFAMILY

This commit is contained in:
zador-blood-stained 2016-04-18 15:17:28 +03:00
parent a0410e14e7
commit 0c6f683a75
11 changed files with 249 additions and 40 deletions

View file

@ -1,5 +1,5 @@
# H3 quad core 1Gb SoC Wifi # H3 quad core 1Gb SoC Wifi
KERNEL_TARGET="default,next,dev" KERNEL_TARGET="default,dev"
LINUXFAMILY=sun8i LINUXFAMILY=sun8i
BOOTCONFIG=Sinovoip_BPI_M2_plus_defconfig BOOTCONFIG=Sinovoip_BPI_M2_plus_defconfig
MODULES="#gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #ap6211" MODULES="#gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #ap6211"

View file

@ -1,5 +1,5 @@
# H3 quad core 1Gb SoC Wifi # H3 quad core 1Gb SoC Wifi
KERNEL_TARGET="default,next,dev" KERNEL_TARGET="default,dev"
LINUXFAMILY=sun8i LINUXFAMILY=sun8i
BOOTCONFIG=FriendlyARM_NanoPi_M1_defconfig BOOTCONFIG=FriendlyARM_NanoPi_M1_defconfig
MODULES="#gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #ap6211" MODULES="#gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #ap6211"

View file

@ -1,5 +1,5 @@
# H3 quad core (Orange Pi PC/One/2/Lite) # H3 quad core (Orange Pi PC/One/2/Lite)
KERNEL_TARGET="default,next,dev" KERNEL_TARGET="default,dev"
LINUXFAMILY=sun8i LINUXFAMILY=sun8i
BOOTCONFIG=orangepi_h3_defconfig BOOTCONFIG=orangepi_h3_defconfig
MODULES="8189es #gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #gc2035" MODULES="8189es #gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #gc2035"

View file

@ -1,5 +1,5 @@
# H3 quad core (Orange Pi Plus or Plus 2) # H3 quad core (Orange Pi Plus or Plus 2)
KERNEL_TARGET="default,next,dev" KERNEL_TARGET="default,dev"
LINUXFAMILY=sun8i LINUXFAMILY=sun8i
BOOTCONFIG=orangepi_plus_defconfig BOOTCONFIG=orangepi_plus_defconfig
MODULES="8189es #gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #gc2035" MODULES="8189es #gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #gc2035"

View file

@ -28,22 +28,11 @@ CACHEDIR=$DEST/cache
# board family configurations # board family configurations
case $LINUXFAMILY in case $LINUXFAMILY in
sun4i|sun5i|sun7i|sun8i|sun6i|sun9i) sun4i|sun5i|sun6i|sun7i|sun9i)
[[ -z $LINUXCONFIG && $BRANCH == "default" ]] && LINUXCONFIG="linux-"$LINUXFAMILY-"$BRANCH" [[ -z $LINUXCONFIG && $BRANCH == "default" ]] && LINUXCONFIG="linux-"$LINUXFAMILY-"$BRANCH"
[[ -z $LINUXCONFIG && $BRANCH != "default" ]] && LINUXCONFIG="linux-sunxi-"$BRANCH [[ -z $LINUXCONFIG && $BRANCH != "default" ]] && LINUXCONFIG="linux-sunxi-"$BRANCH
# Kernel # Kernel
# sun8i switches
if [[ $LINUXFAMILY == sun8i ]]; then
#KERNEL_DEFAULT="https://github.com/O-Computers/linux-sunxi"
#KERNEL_DEFAULT_BRANCH="h3-wip"
#KERNEL_DEFAULT_SOURCE="linux-sun8i"
KERNEL_DEFAULT="https://github.com/igorpecovnik/linux"
KERNEL_DEFAULT_BRANCH="sun8i"
KERNEL_DEFAULT_SOURCE="linux-sun8i"
KERNEL_DEV=https://github.com/wens/linux
KERNEL_DEV_BRANCH=h3-emac
KERNEL_DEV_SOURCE="linux-sun8i-mainline"
else
KERNEL_DEFAULT='https://github.com/linux-sunxi/linux-sunxi' KERNEL_DEFAULT='https://github.com/linux-sunxi/linux-sunxi'
KERNEL_DEFAULT_BRANCH="sunxi-3.4" KERNEL_DEFAULT_BRANCH="sunxi-3.4"
KERNEL_DEFAULT_SOURCE="linux-sunxi" KERNEL_DEFAULT_SOURCE="linux-sunxi"
@ -51,7 +40,7 @@ case $LINUXFAMILY in
[ "$USE_MAINLINE_GOOGLE_MIRROR" = "yes" ] && KERNEL_DEV='https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable' [ "$USE_MAINLINE_GOOGLE_MIRROR" = "yes" ] && KERNEL_DEV='https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable'
KERNEL_DEV_BRANCH="" KERNEL_DEV_BRANCH=""
KERNEL_DEV_SOURCE="linux-vanilla" KERNEL_DEV_SOURCE="linux-vanilla"
fi
KERNEL_NEXT='git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git' KERNEL_NEXT='git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git'
[ "$USE_MAINLINE_GOOGLE_MIRROR" = "yes" ] && KERNEL_NEXT='https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable' [ "$USE_MAINLINE_GOOGLE_MIRROR" = "yes" ] && KERNEL_NEXT='https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable'
KERNEL_NEXT_BRANCH="v"`wget -qO- https://www.kernel.org/finger_banner | grep "The latest st" | awk '{print $NF}' | head -1` KERNEL_NEXT_BRANCH="v"`wget -qO- https://www.kernel.org/finger_banner | grep "The latest st" | awk '{print $NF}' | head -1`
@ -59,7 +48,9 @@ case $LINUXFAMILY in
# U-boot # U-boot
UBOOT_DEFAULT="git://git.denx.de/u-boot.git" UBOOT_DEFAULT="git://git.denx.de/u-boot.git"
UBOOT_DEFAULT_BRANCH="v"$(git ls-remote git://git.denx.de/u-boot.git | grep -v rc | grep -v "\^" | tail -1 | cut -d "v" -f 2) # latest stable v2016.03 broken gmac on sun7i, fixing it for DEFAULT and NEXT
#UBOOT_DEFAULT_BRANCH="v"$(git ls-remote git://git.denx.de/u-boot.git | grep -v rc | grep -v "\^" | tail -1 | cut -d "v" -f 2)
UBOOT_DEFAULT_BRANCH="v2016.01"
UBOOT_DEFAULT_SOURCE="u-boot" UBOOT_DEFAULT_SOURCE="u-boot"
UBOOT_NEXT=$UBOOT_DEFAULT UBOOT_NEXT=$UBOOT_DEFAULT
UBOOT_NEXT_BRANCH=$UBOOT_DEFAULT_BRANCH UBOOT_NEXT_BRANCH=$UBOOT_DEFAULT_BRANCH
@ -67,11 +58,27 @@ case $LINUXFAMILY in
UBOOT_DEV=$UBOOT_DEFAULT UBOOT_DEV=$UBOOT_DEFAULT
UBOOT_DEV_BRANCH="" UBOOT_DEV_BRANCH=""
UBOOT_DEV_SOURCE=$UBOOT_DEFAULT_SOURCE UBOOT_DEV_SOURCE=$UBOOT_DEFAULT_SOURCE
# latest stable v2016.03 broken gmac on sun7i, fixing it for DEFAULT and NEXT ;;
if [[ $LINUXFAMILY != sun8i ]]; then
UBOOT_DEFAULT_BRANCH="v2016.01" sun8i)
UBOOT_NEXT_BRANCH="v2016.01" [[ -z $LINUXCONFIG ]] && LINUXCONFIG="linux-"$LINUXFAMILY-"$BRANCH"
fi
#KERNEL_DEFAULT="https://github.com/O-Computers/linux-sunxi"
#KERNEL_DEFAULT_BRANCH="h3-wip"
#KERNEL_DEFAULT_SOURCE="linux-sun8i"
KERNEL_DEFAULT="https://github.com/igorpecovnik/linux"
KERNEL_DEFAULT_BRANCH="sun8i"
KERNEL_DEFAULT_SOURCE="linux-sun8i"
KERNEL_DEV="https://github.com/wens/linux"
KERNEL_DEV_BRANCH=h3-emac
KERNEL_DEV_SOURCE="linux-sun8i-mainline"
UBOOT_DEFAULT="git://git.denx.de/u-boot.git"
UBOOT_DEFAULT_BRANCH="v"$(git ls-remote git://git.denx.de/u-boot.git | grep -v rc | grep -v "\^" | tail -1 | cut -d "v" -f 2)
UBOOT_DEFAULT_SOURCE="u-boot"
UBOOT_DEV=$UBOOT_DEFAULT
UBOOT_DEV_BRANCH=""
UBOOT_DEV_SOURCE=$UBOOT_DEFAULT_SOURCE
;; ;;
odroidxu4) odroidxu4)

View file

@ -105,6 +105,8 @@ if [[ -z $BRANCH ]]; then
fi fi
unset options unset options
[[ -z $BRANCH ]] && exit_with_error "No kernel branch selected" [[ -z $BRANCH ]] && exit_with_error "No kernel branch selected"
else
[[ $KERNEL_TARGET != *$BRANCH* ]] && exit_with_error "Kernel branch not defined for this board" "$BRANCH"
fi fi
if [[ $KERNEL_ONLY != yes && -z $RELEASE ]]; then if [[ $KERNEL_ONLY != yes && -z $RELEASE ]]; then
@ -189,7 +191,7 @@ if [[ -n $MISC5 ]]; then fetch_from_github "$MISC5" "$MISC5_DIR"; fi
# compile sunxi tools # compile sunxi tools
if [[ $LINUXFAMILY == sun*i ]]; then if [[ $LINUXFAMILY == sun*i ]]; then
compile_sunxi_tools compile_sunxi_tools
[[ $BRANCH != default ]] && LINUXFAMILY="sunxi" [[ $BRANCH != default && $LINUXFAMILY != sun8i ]] && LINUXFAMILY="sunxi"
fi fi
# define package names # define package names

View file

@ -0,0 +1,207 @@
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 6c3b038..cc9b3c0 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -27,6 +27,28 @@ create_package() {
chown -R root:root "$pdir"
chmod -R go-w "$pdir"
+ # Create preinstall and post install script to remove dtb
+ if [[ "$1" == *dtb* ]]; then
+ echo "if [ -d /boot/dtb ]; then rm -rf /boot/dtb; fi" >> $pdir/DEBIAN/preinst
+ echo "if [ -d /boot/dtb-$version ]; then rm -rf /boot/dtb-$version; fi" >> $pdir/DEBIAN/preinst
+ echo "if [ -d /boot/dtb.old ]; then rm -rf /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst
+ echo "if [ -d /dtb ]; then rm -rf /dtb; fi" >> $pdir/DEBIAN/preinst
+ echo "exit 0" >> $pdir/DEBIAN/preinst
+ chmod 775 $pdir/DEBIAN/preinst
+ #
+ echo "if [ -d /boot/dtb-$version.old ]; then rm -rf /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/postinst
+ echo "ln -sf dtb-$version /boot/dtb > /dev/null 2>&1 || mv /boot/dtb-$version /boot/dtb" >> $pdir/DEBIAN/postinst
+ echo "exit 0" >> $pdir/DEBIAN/postinst
+ chmod 775 $pdir/DEBIAN/postinst
+ fi
+
+ # Create postinstall script for headers
+ if [[ "$1" == *headers* ]]; then
+ echo "cd /usr/src/linux-headers-$version; echo \"Compiling headers - please wait ...\"; make -s scripts >/dev/null 2>&1" >> $pdir/DEBIAN/postinst
+ echo "exit 0" >> $pdir/DEBIAN/postinst
+ chmod 775 $pdir/DEBIAN/postinst
+ fi
+
# Create the package
dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"
dpkg --build "$pdir" ..
@@ -93,11 +115,13 @@ tmpdir="$objtree/debian/tmp"
fwdir="$objtree/debian/fwtmp"
kernel_headers_dir="$objtree/debian/hdrtmp"
libc_headers_dir="$objtree/debian/headertmp"
+dtb_dir="$objtree/debian/dtbtmp"
dbg_dir="$objtree/debian/dbgtmp"
-packagename=linux-image-$version
-fwpackagename=linux-firmware-image-$version
-kernel_headers_packagename=linux-headers-$version
-libc_headers_packagename=linux-libc-dev
+packagename=linux-image-dev"$LOCALVERSION"
+fwpackagename=linux-firmware-image-dev"$LOCALVERSION"
+kernel_headers_packagename=linux-headers-dev"$LOCALVERSION"
+dtb_packagename=linux-dtb-dev"$LOCALVERSION"
+libc_headers_packagename=linux-libc-dev-dev"$LOCALVERSION"
dbg_packagename=$packagename-dbg
debarch=
forcearch=
@@ -124,7 +148,9 @@ esac
BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
# Setup the directory structure
-rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
+rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" $objtree/debian/files
+mkdir -m 755 -p "$dtb_dir/DEBIAN"
+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename"
mkdir -m 755 -p "$tmpdir/DEBIAN"
mkdir -p "$tmpdir/lib" "$tmpdir/boot"
mkdir -p "$fwdir/lib/firmware/$version/"
@@ -183,6 +209,11 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
fi
fi
+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then
+ #mkdir -p "$tmpdir/boot/dtb"
+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb-$version" $MAKE KBUILD_SRC= dtbs_install
+fi
+
if [ "$ARCH" != "um" ]; then
$MAKE headers_check KBUILD_SRC=
$MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
@@ -195,7 +226,7 @@ fi
# so do we; recent versions of dracut and initramfs-tools will obey this.
debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then
- want_initrd=Yes
+ want_initrd=Yes
else
want_initrd=No
fi
@@ -207,9 +238,11 @@ for script in postinst postrm preinst prerm ; do
set -e
# Pass maintainer script parameters to hook scripts
+
export DEB_MAINT_PARAMS="\$*"
# Tell initramfs builder whether it's wanted
+
export INITRD=$want_initrd
test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
@@ -218,6 +251,59 @@ EOF
chmod 755 "$tmpdir/DEBIAN/$script"
done
+##
+## Create sym link to kernel image
+##
+sed -e "s/set -e//g" -i $tmpdir/DEBIAN/postinst
+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
+cat >> $tmpdir/DEBIAN/postinst <<EOT
+if [ "\$(grep nand /proc/partitions)" != "" ] && [ "\$(grep mmc /proc/partitions)" = "" ]; then
+mkimage -A arm -O linux -T kernel -C none -a "0x40008000" -e "0x40008000" -n "Linux kernel" -d /$installed_image_path /boot/uImage > /dev/null 2>&1
+cp /boot/uImage /tmp/uImage
+sync
+mountpoint -q /boot || mount /boot
+cp /tmp/uImage /boot/uImage
+rm -f /$installed_image_path
+else
+ln -sf $(basename $installed_image_path) /boot/zImage > /dev/null 2>&1 || mv /$installed_image_path /boot/zImage
+fi
+if [ -f "/boot/initrd.img-$version" ]; then
+mkimage -A $UTS_MACHINE -O linux -T ramdisk -C gzip -a 0 -e 0 -n uInitrd -d /boot/initrd.img-$version /boot/uInitrd > /dev/null 2>&1
+rm /boot/initrd.img-$version
+fi
+touch /boot/.next
+exit 0
+EOT
+##
+## FAT install workaround
+##
+sed -e "s/set -e//g" -i $tmpdir/DEBIAN/preinst
+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst
+cat >> $tmpdir/DEBIAN/preinst <<EOT
+# exit if we are running chroot
+if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi
+
+check_and_unmount (){
+boot_device=\$(mountpoint -d /boot)
+
+for file in /dev/* ; do
+ CURRENT_DEVICE=\$(printf "%d:%d" \$(stat --printf="0x%t 0x%T" \$file))
+ if [ \$CURRENT_DEVICE = \$boot_device ]; then
+ boot_partition=\$file
+ break;
+ fi
+done
+
+bootfstype=\$(blkid -s TYPE -o value \$boot_partition)
+if [ "\$bootfstype" = "vfat" ]; then
+umount /boot;
+rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/zImage /boot/uImage /boot/*nitrd*
+fi
+}
+mountpoint -q /boot && check_and_unmount
+EOT
+echo "exit 0" >> $tmpdir/DEBIAN/preinst
+
# Try to determine maintainer and email values
if [ -n "$DEBEMAIL" ]; then
email=$DEBEMAIL
@@ -328,16 +414,24 @@ fi
(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
destdir=$kernel_headers_dir/usr/src/linux-headers-$version
mkdir -p "$destdir"
+######################## headers patch
+ZACNI=$(pwd)
+cd $destdir
+patch -p1 < /tmp/headers-debian-byteshift.patch
+cd $ZACNI
+######################## headers patch
(cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
(cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
+(cd "$destdir"; make M=scripts clean)
+
cat <<EOF >> debian/control
Package: $kernel_headers_packagename
-Provides: linux-headers, linux-headers-2.6
+Provides: linux-headers
Architecture: any
Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch}
This package provides kernel header files for $KERNELRELEASE on \${kernel:debarch}
@@ -363,6 +457,16 @@ fi
cat <<EOF >> debian/control
+Package: $dtb_packagename
+Architecture: any
+Description: Linux DTB, version $version
+ This package contains device blobs from the Linux kernel, version $version.
+EOF
+
+create_package "$dtb_packagename" "$dtb_dir"
+
+cat <<EOF >> debian/control
+
Package: $libc_headers_packagename
Section: devel
Provides: linux-kernel-headers
@@ -374,7 +478,7 @@ EOF
if [ "$ARCH" != "um" ]; then
create_package "$kernel_headers_packagename" "$kernel_headers_dir"
- create_package "$libc_headers_packagename" "$libc_headers_dir"
+# create_package "$libc_headers_packagename" "$libc_headers_dir"
fi
create_package "$packagename" "$tmpdir"

View file

@ -106,22 +106,15 @@ patching_sources(){
cd $SOURCES/$LINUXSOURCEDIR cd $SOURCES/$LINUXSOURCEDIR
# what are we building
#grab_kernel_version
# this is a patch that Ubuntu Trusty compiler works # this is a patch that Ubuntu Trusty compiler works
if [ "$(patch --dry-run -t -p1 < $SRC/lib/patch/kernel/compiler.patch | grep Reversed)" != "" ]; then if [ "$(patch --dry-run -t -p1 < $SRC/lib/patch/kernel/compiler.patch | grep Reversed)" != "" ]; then
patch --batch --silent -t -p1 < $SRC/lib/patch/kernel/compiler.patch > /dev/null 2>&1 patch --batch --silent -t -p1 < $SRC/lib/patch/kernel/compiler.patch > /dev/null 2>&1
fi fi
# this exception is needed since AW boards share single mainline kernel
[[ $LINUXFAMILY == sun*i && $BRANCH != "default" ]] && LINUXFAMILY="sunxi"
# it can be changed in this process # it can be changed in this process
grab_version "$SOURCES/$LINUXSOURCEDIR" grab_version "$SOURCES/$LINUXSOURCEDIR"
advanced_patch "kernel" "$LINUXFAMILY-$BRANCH" "$BOARD" "$LINUXFAMILY-$BRANCH $VER" advanced_patch "kernel" "$LINUXFAMILY-$BRANCH" "$BOARD" "$LINUXFAMILY-$BRANCH $VER"
#--------------------------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------------------------
# Patching u-boot # Patching u-boot
#--------------------------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------------------------