Initial commit: Linux kernel 4.19 for Unplugged OS

This commit is contained in:
ziv committed 2025-10-06 13:52:42 +00:00
commit d30235b04c
80519 files changed
+35800681

No files matched your search

+148
View File
@@ -0,0 +1,148 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
green='\e[0;32m'
red='\e[0;31m'
eol='\e[0m'
BASE_DIR=$PWD
ABIGAIL_DIR=$BASE_DIR/../kernel/build/abi
ABIGAIL_BUILD_SCRIPT=$ABIGAIL_DIR/bootstrap_src_build
ABI_XML_DIR=$BASE_DIR/scripts/abi/abi_xml
ABI_RESULT_DIR=$BASE_DIR/scripts/abi/abi_xml
ORI_ABI_XML=abi_$src_defconfig.xml
TARGET_ABI_XML=abi_target.xml
ABI_REPORT=abi-report.out
FINAL_ABI_REPORT=abi-report-final.out
TARGET_KERNEL_DIR=$BASE_DIR/out
TARGET_VMLINUX_DIR=$BASE_DIR/out_vmlinux
echo "Get ABIGAIL_VERSION from $ABIGAIL_BUILD_SCRIPT"
ABIGAIL_VERSION=`grep "ABIGAIL_VERSION=" $ABIGAIL_BUILD_SCRIPT | cut -f2- -d=`
ABIGAIL_DIR_RELEASE=$ABIGAIL_DIR/abigail-inst/$ABIGAIL_VERSION
echo "ABIGAIL_DIR_RELEASE=$ABIGAIL_DIR_RELEASE"
function print_usage(){
echo -e "${green}Script for auto generate target_branch's ABI xml \
based on src_defconfig and compare with abi_{src_defconfig}.xml${eol}"
echo ""
echo -e "${red}Command for local test:${eol}"
echo "[src_defconfig] mode=m ./scripts/abi/CompareABI.sh"
echo ""
echo -e "${green}Description:${eol}"
echo "[src_defconfig]: source project defconfig"
echo ""
echo -e "${green}Example:${eol} ${red}src_defconfig=\
k79v1_64_gki_debug_defconfig mode=m \
./scripts/abi/CompareABI.sh 2>&1 | tee buildABI.log${eol}"
echo ""
echo -e "${green}Script for auto generate target_branch's ABI xml \
based on src_defconfig and compare with abi_{src_defconfig}.xml and save abi \
monitor result to [abi_result_path]${eol}"
echo ""
echo -e "${red}Command for local test:${eol}"
echo "[src_defconfig] mode=m [abi_result_path] \
./scripts/abi/CompareABI.sh"
echo ""
echo -e "${green}Description:${eol}"
echo "[src_defconfig]: source project defconfig"
echo ""
echo "[abi_result_path]: absolute path to put abi monitor result"
echo ""
echo -e "${green}Example:${eol} ${red}src_defconfig=\
k79v1_64_gki_debug_defconfig mode=m abi_result_path=absolute_path \
./scripts/abi/CompareABI.sh 2>&1 | tee buildABI.log${eol}"
echo ""
echo -e "${red}Command for delete temp files:${eol}"
echo "mode=d ./scripts/abi/CompareABI.sh"
echo ""
echo -e "${green}Description:${eol}"
echo ""
echo -e "${green}Example:${eol} ${red}mode=d \
./scripts/abi/CompareABI.sh${eol}"
}
function del_temp_files(){
echo "Delete temp files $TARGET_KERNEL_DIR"
rm -rf $TARGET_KERNEL_DIR
echo "Delete temp files $TARGET_VMLINUX_DIR"
rm -rf $TARGET_VMLINUX_DIR
echo "Delete temp files $ABI_RESULT_DIR/$TARGET_ABI_XML"
rm -rf $ABI_RESULT_DIR/$TARGET_ABI_XML
echo "Delete temp files $ABI_RESULT_DIR/$ABI_REPORT"
rm -rf $ABI_RESULT_DIR/$ABI_REPORT
echo "Delete temp files $ABI_RESULT_DIR/$FINAL_ABI_REPORT"
rm -rf $ABI_RESULT_DIR/$FINAL_ABI_REPORT
}
if [[ "$1" == "h" ]] || [[ "$1" == "help" ]] || [ -z "mode" ]
then
print_usage
fi
if [ -z "$abi_result_path" ]
then
echo "ABI_XML_DIR=$ABI_XML_DIR"
echo "ABI_RESULT_DIR=$ABI_RESULT_DIR"
else
ABI_RESULT_DIR=$abi_result_path
echo "ABI_XML_DIR=$ABI_XML_DIR"
echo "ABI_RESULT_DIR=$ABI_RESULT_DIR"
fi
if [ "$mode" == "d" ]
then
del_temp_files
fi
if [ "$mode" == "m" ]
then
#Check Terminal server support "mosesq" or "dockerq"
echo "Start to test sever queue..."
mosesq ls -al
if [ $? -eq 0 ];
then
SERVER_QUEUE=mosesq
else
SERVER_QUEUE=dockerq
fi
echo "This sever is using queue: $SERVER_QUEUE"
#Build libabigail first
$ABIGAIL_BUILD_SCRIPT
#remove temp files first
del_temp_files
echo "Generate .config from src_defconfig:$src_defconfig"
cd ..
export PATH=$PWD\
/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/:\
$PWD/prebuilts/clang/host/linux-x86/clang-r377782c/bin/:$PATH
cd $BASE_DIR
make ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=aarch64-linux-android- CC=clang $src_defconfig O=out
$SERVER_QUEUE make ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=aarch64-linux-android- CC=clang O=out -j24 -k
echo "Generate ABI xml:$TARGET_ABI_XML from kernel \
tree:$TARGET_VMLINUX_DIR"
#Use abi_dump to generate $TARGET_ABI_XML
#export $ABIGAIL_DIR_RELEASE bin and lib
export PATH=${ABIGAIL_DIR_RELEASE}/bin:${PATH}
export LD_LIBRARY_PATH=${ABIGAIL_DIR_RELEASE}/lib:\
${ABIGAIL_DIR_RELEASE}/lib/elfutils:${LD_LIBRARY_PATH}
echo "Copy vmlinux from $TARGET_KERNEL_DIR to $TARGET_VMLINUX_DIR"
mkdir -p $TARGET_VMLINUX_DIR
cp $TARGET_KERNEL_DIR/vmlinux $TARGET_VMLINUX_DIR
cd $ABIGAIL_DIR
python dump_abi --linux-tree $TARGET_VMLINUX_DIR --out-file \
$ABI_RESULT_DIR/$TARGET_ABI_XML
echo "Generate ABI report:$ABI_REPORT from \
--baseline:$ABI_XML_DIR/$ORI_ABI_XML --new:$ABI_RESULT_DIR/$TARGET_ABI_XML"
python diff_abi --baseline $ABI_XML_DIR/$ORI_ABI_XML \
--new $ABI_RESULT_DIR/$TARGET_ABI_XML \
--report $ABI_RESULT_DIR/$ABI_REPORT
cd $BASE_DIR
echo "Generate $FINAL_ABI_REPORT"
abi_result_path=$abi_result_path ./scripts/abi/FinalABI.sh
fi
+106
View File
@@ -0,0 +1,106 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
green='\e[0;32m'
red='\e[0;31m'
eol='\e[0m'
BASE_DIR=$PWD
ABI_DIR=$BASE_DIR/scripts/abi
ABI_XML_DIR=$BASE_DIR/scripts/abi/abi_xml
ABI_RESULT_DIR=$BASE_DIR/scripts/abi/abi_xml
ORI_ABI_XML=abi_ori.xml
TARGET_ABI_XML=abi_target.xml
ABI_REPORT=abi-report.out
FINAL_ABI_REPORT=abi-report-final.out
#include abi_white_list to bypass violations
source $ABI_DIR/abi_white_list
#Find Delete/Changed/Added and leaf type change
#check_arr=("\[D\]" "\[C\]" "\[A\]" "^'.*' changed:$")
#Find Delete/Changed and leaf type change
check_arr=("\[D\]" "\[C\]" "^'.*' changed:$")
is_abi_violation_bypass=0
declare -i abi_violation_count=0
function print_usage(){
echo -e "${green}Script for auto generate \
$ABI_RESULT_DIR/$FINAL_ABI_REPORT from $ABI_RESULT_DIR/$ABI_REPORT ${eol}"
echo ""
echo -e "${red}Command for local test:${eol}"
echo ""
echo -e "${green}Example:${eol} ${red}./scripts/abi/FinalABI.sh${eol}"
echo ""
echo -e "${green}Script for auto generate \
$FINAL_ABI_REPORT by specified abi_result_path ${eol}"
echo ""
echo -e "${red}Command for local test:${eol}"
echo "[abi_result_path] ./scripts/abi/FinalABI.sh"
echo ""
echo -e "${green}Description:${eol}"
echo "[abi_result_path]: absolute path to generate fianl abi report"
echo ""
echo -e "${green}Example:${eol} ${red}abi_result_path=absolute_path \
/scripts/abi/FinalABI.sh${eol}"
exit -1
}
if [ -z "$abi_result_path" ]
then
echo "ABI_XML_DIR=$ABI_XML_DIR"
echo "ABI_RESULT_DIR=$ABI_RESULT_DIR"
else
ABI_RESULT_DIR=$abi_result_path
echo "ABI_XML_DIR=$ABI_XML_DIR"
echo "ABI_RESULT_DIR=$ABI_RESULT_DIR"
fi
if [[ "$1" == "h" ]] || [[ "$1" == "help" ]]
then
print_usage
fi
#remove temp files first
rm -rf $ABI_RESULT_DIR/$FINAL_ABI_REPORT
exec < $ABI_RESULT_DIR/$ABI_REPORT
while read line
do
for ((i=0; i < ${#check_arr[@]}; i++))
do
if [[ $line =~ ${check_arr[$i]} ]]
then
is_abi_violation_bypass=0
for ((j=0; j < ${#bypass_arr[@]}; j++))
do
if [[ $line =~ ${bypass_arr[$j]} ]]
then
is_abi_violation_bypass=1
break
fi
done
if [[ $is_abi_violation_bypass == 0 ]]
then
abi_violation_count+=1
fi
break
fi
done
#write $line to $FINAL_ABI_REPORT if $is_abi_violation = 0
if [[ $is_abi_violation_bypass == 0 ]]
then
echo $line >> $ABI_RESULT_DIR/$FINAL_ABI_REPORT
fi
done
if [[ $abi_violation_count == 0 ]]
then
echo "ABI Monitor check PASS!!!"
else
echo "ABI Monitor check FAILED!!!\
Final abi_violation_count=$abi_violation_count!!!"
echo "Please check report: $ABI_RESULT_DIR/$FINAL_ABI_REPORT for details."
fi
exit $abi_violation_count
+32
View File
@@ -0,0 +1,32 @@
#Add symbols to bypass ABI Monitor here
bypass_arr=(\
"function long int __probe_kernel_read" \
"function void ion_device_add_heap" \
"function int ufshcd_" \
"function int v4l2_" \
"function int phy_set_mode" \
"net init_net" \
"const vm_operations_struct drm_gem_cma_vm_ops" \
"vm_event_state vm_event_states" \
"struct ci_hdrc_platform_data " \
"struct mem_cgroup " \
"struct mem_cgroup_stat_cpu " \
"struct mm_struct " \
"struct musb " \
"struct musb_io " \
"struct musb_platform_ops " \
"struct phy_ops " \
"struct net " \
"struct net_device " \
"struct rfkill " \
"struct ufs_dev_info " \
"struct ufs_hba " \
"struct ufs_stats " \
"struct ufs_vreg " \
"struct ufshcd_lrb " \
"struct utp_task_req_desc " \
"struct vm_area_struct " \
"struct vm_event_state " \
"struct vm_fault " \
"struct vm_operations_struct " \
"struct mmc_request ")
+7
View File
@@ -0,0 +1,7 @@
Leaf changes summary: 8 artifacts changed (1 filtered out)
Changed leaf types summary: 7 (1 filtered out) leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 1 Changed, 0 Added function (1284 filtered out)
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable (106 filtered out)
1 function with some sub-type change:
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+187
View File
@@ -0,0 +1,187 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
green='\e[0;32m'
red='\e[0;31m'
eol='\e[0m'
BASE_DIR=$PWD
ABI_DIR=$BASE_DIR/scripts/abi
ABIGAIL_DIR=$BASE_DIR/../kernel/build/abi
ABIGAIL_BUILD_SCRIPT=$ABIGAIL_DIR/bootstrap_src_build
ABI_XML_DIR=$BASE_DIR/scripts/abi/abi_xml
#target_kernel must create outside current kernel's repo
TARGET_KERNEL_DIR=$BASE_DIR/../../target_kernel_r0_trunk
TARGET_DEFCONFIG=mtk_gki_defconfig
TARGET_DEFCONFIG_PATCH=$ABI_DIR/mtk_gki_defconfig_patch
TARGET_ABI_XML=abi_$src_defconfig.xml
TARGET_VMLINUX_DIR=$TARGET_KERNEL_DIR/common/out_vmlinux
echo "Get ABIGAIL_VERSION from $ABIGAIL_BUILD_SCRIPT"
ABIGAIL_VERSION=`grep "ABIGAIL_VERSION=" $ABIGAIL_BUILD_SCRIPT | cut -f2- -d=`
ABIGAIL_DIR_RELEASE=$ABIGAIL_DIR/abigail-inst/$ABIGAIL_VERSION
echo "ABIGAIL_DIR_RELEASE=$ABIGAIL_DIR_RELEASE"
cd $TARGET_KERNEL_DIR
TARGET_KERNEL_DIR_RELATED_PATH=`pwd`
TARGET_KERNEL_OUT_DIR_RELATED_PATH=$TARGET_KERNEL_DIR_RELATED_PATH/common/out/..
echo "TARGET_KERNEL_DIR_RELATED_PATH=$TARGET_KERNEL_DIR_RELATED_PATH"
echo "TARGET_KERNEL_OUT_DIR_RELATED_PATH=$TARGET_KERNEL_OUT_DIR_RELATED_PATH"
cd $BASE_DIR
function print_usage(){
echo -e "${green}Script for auto generate target_branch's ABI xml \
based on src_defconfig ${eol}"
echo ""
echo -e "${red}Command for local test:${eol}"
echo "[src_commit] [src_defconfig] [target_branch] [target_commit] \
mode=m ./scripts/abi/genOriABIxml.sh"
echo ""
echo -e "${green}Description:${eol}"
echo "[src_commit]: source kernel commit id"
echo "[src_defconfig]: source project defconfig"
echo "[target_branch]: target branch"
echo "[target_commit]: target kernel commit id"
echo ""
echo -e "${green}Example:${eol} ${red}src_commit=491f0e3 \
src_defconfig=k79v1_64_gki_debug_defconfig \
target_branch=common-android-4.19 target_commit=f232ce6 mode=m \
./scripts/abi/genOriABIxml.sh 2>&1 | tee buildOriABI.log${eol}"
echo ""
echo -e "${green}Script for auto generate target_branch's ABI xml \
for preflight based on src_defconfig ${eol}"
echo ""
echo -e "${red}Command for local test:${eol}"
echo "[src_defconfig] [target_branch] mode=p \
./scripts/abi/genOriABIxml.sh"
echo ""
echo -e "${green}Description:${eol}"
echo "[src_defconfig]: source project defconfig"
echo "[target_branch]: target branch"
echo ""
echo -e "${green}Example:${eol} ${red}src_defconfig=\
k79v1_64_gki_debug_defconfig \
target_branch=common-android-4.19 mode=p \
./scripts/abi/genOriABIxml.sh 2>&1 | tee buildOriABI.log${eol}"
echo ""
echo -e "${red}Command for delete temp files:${eol}"
echo "mode=d ./scripts/abi/genOriABIxml.sh"
echo ""
echo -e "${green}Example:${eol} ${red}mode=d \
./scripts/abi/genOriABIxml.sh${eol}"
}
function del_temp_files(){
echo "Start delete temp files..."
echo "Delete temp files $BASE_DIR/out"
rm -rf $BASE_DIR/out
echo "Delete temp files $TARGET_KERNEL_DIR"
rm -rf $TARGET_KERNEL_DIR
#rm -rf $ABI_XML_DIR/$TARGET_ABI_XML
}
if [[ "$1" == "h" ]] || [[ "$1" == "help" ]] || [ -z "mode" ]
then
print_usage
fi
if [ "$mode" == "d" ]
then
del_temp_files
fi
if [ "$mode" == "p" ]
then
target_commit=83b584a #ACK4.19.102
echo src_commit=$src_commit
echo target_commit=$target_commit
fi
if [ "$mode" == "m" ] || [ "$mode" == "p" ]
then
#Check Terminal server support "mosesq" or "dockerq"
echo "Start to test sever queue..."
mosesq ls -al
if [ $? -eq 0 ];
then
SERVER_QUEUE=mosesq
else
SERVER_QUEUE=dockerq
fi
echo "This sever is using queue: $SERVER_QUEUE"
#Build libabigail first
$ABIGAIL_BUILD_SCRIPT
#remove temp files first
del_temp_files
echo "Generate .config from src_defconfig:$src_defconfig with kernel \
commit id:$src_commit"
cd ..
export PATH=\
$PWD/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/:\
$PWD/prebuilts/clang/host/linux-x86/clang-r377782c/bin/:$PATH
cd $BASE_DIR
git checkout $src_commit
make ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=aarch64-linux-android- \
CC=clang $src_defconfig O=out
echo "Generate ABI xml:$TARGET_ABI_XML of target_branch:$target_branch \
with commit id:$target_commit"
mkdir $TARGET_KERNEL_DIR
cd $TARGET_KERNEL_DIR
repo init -u http://gerrit.mediatek.inc:8080/kernel/manifest -b $target_branch
$SERVER_QUEUE mtk_repo sync -f -j8 --no-clone-bundle -c --no-tags
export PATH=\
$PWD/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/:\
$PWD/prebuilts-master/clang/host/linux-x86/clang-r377782c/bin/:$PATH
cd common
git checkout $target_commit
echo "Move .config from $BASE_DIR/out to \
$PWD/arch/arm64/configs/$TARGET_DEFCONFIG"
cp $BASE_DIR/out/.config arch/arm64/configs/$TARGET_DEFCONFIG
#Modify $TARGET_DEFCONFIG configs according to $TARGET_DEFCONFIG_PATCH
exec < $TARGET_DEFCONFIG_PATCH
while read line
do
#get string before "="
config_=${line%%=*}
#replace matched string
sed -i "/$config_/c\\$line" \
$PWD/arch/arm64/configs/$TARGET_DEFCONFIG
done
make ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=aarch64-linux-android- CC=clang $TARGET_DEFCONFIG O=out
$SERVER_QUEUE make ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=aarch64-linux-android- CC=clang O=out -j24 -k
#Only use vmlinux to generate ABI xml
echo "Copy vmlinux from $PWD/out to $PWD/out_vmlinux"
mkdir out_vmlinux
cp out/vmlinux out_vmlinux
#Use abi_dump to generate $TARGET_ABI_XML
#export $ABIGAIL_DIR bin and lib
echo "Generate $ABI_XML_DIR/$TARGET_ABI_XML from vmlinux \
in $TARGET_VMLINUX_DIR"
export PATH=${ABIGAIL_DIR_RELEASE}/bin:${PATH}
export LD_LIBRARY_PATH=${ABIGAIL_DIR_RELEASE}/lib:\
${ABIGAIL_DIR_RELEASE}/lib/elfutils:${LD_LIBRARY_PATH}
cd $ABIGAIL_DIR
python dump_abi --linux-tree $TARGET_VMLINUX_DIR \
--out-file $ABI_XML_DIR/$TARGET_ABI_XML
# sanitize the abi.xml by removing any occurences of the kernel path
cd $TARGET_KERNEL_DIR
sed -i "s#$TARGET_KERNEL_OUT_DIR_RELATED_PATH/##g" \
$ABI_XML_DIR/$TARGET_ABI_XML
# now also do that with any left over paths sneaking in
# (e.g. from the prebuilts)
sed -i "s#$TARGET_KERNEL_DIR_RELATED_PATH/##g" \
$ABI_XML_DIR/$TARGET_ABI_XML
#remove temp files
del_temp_files
fi
+1
View File
@@ -0,0 +1 @@
CONFIG_MEDIA_SUPPORT=m