[Samsung Galaxy Nexus] Android-Andi:
Reserved

As requested, here's my setup to compile tuna kernel.

01.05.2020

Follow https://github.com/andi34/android_build-bot/blob/manifest/README.md and https://github.com/andi34/android_build-bot/blob/kernelcompile/README.md

What do you need

Kernel Source (you can get our latest kernel source on SlimRoms, OmniRoms or CyanogenMods github, "tuna kernel")

GCC ( https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7 )

pvr source, added to omap4-common device repo and hardware_ti_omap4 repo (can be found on SlimRoms, OmniRoms or CyanogenMods github)

you can use my scripts put below (update some paths, marked red )

AnyKernel2 Source from osm0sis (update for tuna needed)

build-gcc4.7.env

export CROSS_COMPILE=[COLOR="Red"]'/home/andi/android2/kernelcompile/arm-eabi-4.7/bin/arm-eabi-'[/COLOR]
export LDFLAGS=''
export CFLAGS=''
export SUBARCH=arm
export ARCH=arm
export STRIP=[COLOR="Red"]/home/andi/android2/kernelcompile/arm-eabi-4.7/bin/arm-eabi-strip[/COLOR]

alias 'stm'='$STRIP --strip-unneeded *.ko'

compile-tuna.sh

#!/bin/bash

readonly red=$(tput setaf 1) # red
readonly grn=$(tput setaf 2) # green
readonly ylw=$(tput setaf 3) # yellow
readonly blu=$(tput setaf 4) # blue
readonly cya=$(tput setaf 6) # cyan
readonly txtbld=$(tput bold) # Bold
readonly bldred=$txtbld$red # red
readonly bldgrn=$txtbld$grn # green
readonly bldylw=$txtbld$ylw # yellow
readonly bldblu=$txtbld$blu # blue
readonly bldcya=$txtbld$cya # cyan
readonly txtrst=$(tput sgr0) # Reset

err() {
echo "$txtrst${red}$*$txtrst" >&2
}

warn() {
echo "$txtrst${ylw}$*$txtrst" >&2
}

info() {
echo "$txtrst${grn}$*$txtrst"
}

setbuildjobs() {
# Set build jobs
JOBS=$(expr 0 + $(grep -c ^processor /proc/cpuinfo))
info "Set build jobs to $JOBS"
}

info "Kernel source path: $KERNELSOURCE"
info "PVR Source path: $PVRSAUCE"
info "Working directory: $WORKINGDIR"
info "resulting zImage and modules stored at: $WORKINGOUTDIR"

setbuildjobs

info "Moving to kernel source"
cd $KERNELSOURCE

info "Import toolchain environment setup"
info "Toolchain: $TOOLCHAIN"
source $SAUCE/build-$TOOLCHAIN.env

info "Create a buid directory, known as KERNEL_OUT directory"
# then always use "O=$SAUCE/tuna" in kernel compilation

info "create working directory"
mkdir -p $WORKINGDIR

warn "Make sure the kernel source clean on first compilation"
make O=$WORKINGDIR mrproper

warn "Rebuild the kernel after a change, maybe we want to reset the compilation counter"
echo 0 > $WORKINGDIR/.version

info "Import kernel config file: $DEFCONFIGNAME"
make O=$WORKINGDIR $DEFCONFIGNAME
info "Change kernel configuration if needed using:"
info " make O=$WORKINGDIR menuconfig "

info "lets build the kernel"
make -j$JOBS O=$WORKINGDIR

if [ -f $WORKINGDIR/arch/arm/boot/zImage ]; then
info "Copying the resulting zImage and modules to: $WORKINGOUTDIR"
info "Creating directory..."
mkdir -p $WORKINGOUTDIR
mkdir -p $WORKINGOUTDIR/modules
cp $WORKINGDIR/arch/arm/boot/zImage $WORKINGOUTDIR/
find $WORKINGDIR/ -type f -name *.ko -exec cp {} $WORKINGOUTDIR/modules/ \;

info "Files moved!"

info "Pointing KERNELDIR to KERNEL_OUT directory"
export KERNELDIR=$WORKINGDIR

warn "Make sure the PVR source clean."
warn "Running 'make clean'..."
make clean -C $PVRSAUCE/build/linux2/omap4430_android

info "Building the PVR module..."
make -j8 -C $PVRSAUCE/build/linux2/omap4430_android TARGET_PRODUCT="blaze_tablet" BUILD=release TARGET_SGX=540 PLATFORM_VERSION=4.1

info "Copying the resulting PVR module to: $WORKINGOUTDIR"
cp -fr $PVRSAUCE/binary2_omap4430_android_release/target/pvrsrvkm.ko $WORKINGOUTDIR/modules/pvrsrvkm_sgx540_120.ko
mv $PVRSAUCE/binary2_omap4430_android_release/target/pvrsrvkm.ko $WORKINGOUTDIR/modules/

warn "Don't leave any module objects in PVR source!"
warn "Running 'make clean'..."
make clean -C $PVRSAUCE/build/linux2/omap4430_android

info "Properly stripping the kernel modules for smaller size (implified as stm command inside build.env)..."
cd $WORKINGOUTDIR/modules
stm

info "####################"
info "# Done! #"
info "####################"
else
warn "####################"
warn "# FAILED! #"
warn "####################"
fi

cd $SAUCE

tuna_k.sh

#!/bin/bash

[COLOR="Red"]SAUCE=~/android2/kernelcompile
PVRSAUCE=~/android2/official/omap4/stable/pvr-source/eurasiacon
KERNELSOURCE=~/android2/official/kernel/android_kernel_ti_omap4[/COLOR]
TOOLCHAIN="gcc4.7"
DEFCONFIGNAME=tuna_kitkat_defconfig
WORKINGDIR=$SAUCE/tuna-kitkat
WORKINGOUTDIR=$WORKINGDIR-bin
. `dirname $0`/compile-tuna.sh

tuna_m.sh

#!/bin/bash

[COLOR="Red"]SAUCE=~/android2/kernelcompile
PVRSAUCE=~/android2/official/omap4/stable/pvr-source/eurasiacon
KERNELSOURCE=~/android2/official/kernel/android_kernel_ti_omap4[/COLOR]
TOOLCHAIN="gcc4.7"
DEFCONFIGNAME=tuna_defconfig
WORKINGDIR=$SAUCE/tuna-marshmallow
WORKINGOUTDIR=$WORKINGDIR-bin
. `dirname $0`/compile-tuna.sh