Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Commit

Permalink
build.sh: add optional embedding into the kernel
Browse files Browse the repository at this point in the history
This allows adding mali into the kernel and compile it as built-in driver

embedding example:
$ export KDIR=<your-kernel-dir>
$ build.sh -r r8p1 -e

building example:
$ cd <your-kernel-dir>
$ export ARCH=arm32
$ export CROSS_COMPILE=arm-linux-gnueabihf-
$ make sunxi_defconfig
$ ./scripts/config -e MALI400

Profiling support wasn't ported correctly and doesn't support the latest kernel,
and it should be disabled to get success build

$ ./scripts/config -d MALI400_PROFILING
$ make olddefconfig
$ make

Signed-off-by: Roman Stratiienko <[email protected]>
  • Loading branch information
Roman Stratiienko committed Feb 4, 2019
1 parent 45336fb commit e4aa2b7
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ build_driver() {
cp $driver_dir/mali.ko .
}

embed_driver() {
local driver_dir=$(pwd)/$RELEASE/src/devicedrv/mali/
local kernel_driver_dir=$KDIR/drivers/gpu/drm/mali/
local Kconfig_append='source "drivers/gpu/drm/mali/Kconfig"'
local Makefile_append="obj-y += mali/"

rm -rf $kernel_driver_dir/*
mkdir -p $kernel_driver_dir

cp -r $driver_dir/* $kernel_driver_dir

fgrep -q "$Kconfig_append" $kernel_driver_dir../Kconfig || echo -e "\n$Kconfig_append" >> $kernel_driver_dir../Kconfig
fgrep -q "$Makefile_append" $kernel_driver_dir../Makefile || echo $Makefile_append >> $kernel_driver_dir../Makefile
}

install_driver() {
local driver_dir=$(pwd)/$RELEASE/src/devicedrv/mali/

Expand All @@ -58,7 +73,7 @@ clean_driver() {
make JOBS=$JOBS $BUILD_OPTS -C $driver_dir clean
}

while getopts "j:r:aubcit" opt
while getopts "j:r:aubcite" opt
do
case $opt in
a)
Expand All @@ -75,6 +90,11 @@ do
unapply_patches $(pwd)/patches $RELEASE
clean_driver $RELEASE
;;
e)
echo "embedding into the kernel..."
apply_patches $(pwd)/patches $RELEASE
embed_driver $RELEASE
;;
i)
echo "installing..."
install_driver $RELEASE
Expand Down

0 comments on commit e4aa2b7

Please sign in to comment.