Add support for building Android kernel images required for some Amlogic-based projects

This commit is contained in:
Alex Deryskyba 2015-03-13 15:37:57 +01:00
parent 08c1eed971
commit 2495d063e8
3 changed files with 92 additions and 1 deletions

View File

@ -56,6 +56,10 @@ else
KERNEL_IMAGE="bzImage"
fi
if [ "$BUILD_ANDROID_BOOTIMG" = "yes" ]; then
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET mkbootimg:host"
fi
post_patch() {
if [ -f $PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_NAME.$TARGET_ARCH.conf ]; then
KERNEL_CFG_FILE=$PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_NAME.$TARGET_ARCH.conf
@ -70,7 +74,9 @@ post_patch() {
$PKG_BUILD/Makefile
cp $KERNEL_CFG_FILE $PKG_BUILD/.config
sed -i -e "s|^CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"$ROOT/$BUILD/image/initramfs.cpio\"|" $PKG_BUILD/.config
if [ ! "$BUILD_ANDROID_BOOTIMG" = "yes" ]; then
sed -i -e "s|^CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"$ROOT/$BUILD/image/initramfs.cpio\"|" $PKG_BUILD/.config
fi
# set default hostname based on $DISTRONAME
sed -i -e "s|@DISTRONAME@|$DISTRONAME|g" $PKG_BUILD/.config
@ -140,6 +146,12 @@ make_target() {
fi
LDFLAGS="" make $KERNEL_IMAGE $KERNEL_MAKE_EXTRACMD
if [ "$BUILD_ANDROID_BOOTIMG" = "yes" ]; then
LDFLAGS="" mkbootimg --kernel arch/arm/boot/$KERNEL_IMAGE --ramdisk $ROOT/$BUILD/image/initramfs.cpio \
--second "$ANDROID_BOOTIMG_SECOND" --output arch/arm/boot/boot.img
mv -f arch/arm/boot/boot.img arch/arm/boot/$KERNEL_IMAGE
fi
}
makeinstall_target() {

View File

@ -0,0 +1,38 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# OpenELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="mkbootimg"
PKG_VERSION="6668fc2"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="https://android.googlesource.com/platform/system/core/+/master/mkbootimg/"
PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz"
PKG_DEPENDS_HOST=""
PKG_PRIORITY="optional"
PKG_SECTION="tools"
PKG_SHORTDESC="mkbootimg: Creates kernel boot images for Android"
PKG_LONGDESC="mkbootimg: Creates kernel boot images for Android"
PKG_IS_ADDON="no"
PKG_AUTORECONF="no"
makeinstall_host() {
mkdir -p $SYSROOT_PREFIX/usr/include
cp mkbootimg $ROOT/$TOOLCHAIN/bin/
}

41
tools/mkpkg/mkpkg_mkbootimg Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# OpenELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
echo "getting sources..."
if [ ! -d mkbootimg.git ]; then
git clone https://github.com/codesnake/mkbootimg.git mkbootimg.git
fi
cd mkbootimg.git
git pull
GIT_REV=`git log -n1 --format=%h`
cd ..
echo "copying sources..."
rm -rf mkbootimg-$GIT_REV
cp -R mkbootimg.git mkbootimg-$GIT_REV
echo "cleaning sources..."
rm -rf mkbootimg-$GIT_REV/.git
echo "packing sources..."
tar cvJf mkbootimg-$GIT_REV.tar.xz mkbootimg-$GIT_REV
echo "remove temporary sourcedir..."
rm -rf mkbootimg-$GIT_REV