forked from Maroc-OS/Merruk-Technology
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kernel_Make
executable file
·134 lines (112 loc) · 3.93 KB
/
Kernel_Make
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
###################################################################
# Merruk Technology Compilation/Update Kernel Make Script #
# Kernel_Make -HELP For More Infos. #
###################################################################
# Author : Yahya Lmallas #
# E-Mail : [email protected], [email protected] #
# Company : Merruk Technology, SARL. #
# Web-Site : www.merruk.ma #
# UserName : Maroc-OS #
###################################################################
# Copmile Script Declarations
KERNEL_MAKE_VERSION="v.1.0"
CPU_CORES=$(cat /proc/cpuinfo | grep processor | wc -l)
if [ "$CPU_CORES" == "" ];
then
CPU_CORES="-j2"
elif [ "$CPU_CORES" == "0" ];
then
CPU_CORES="-j2"
else
CPU_CORES="-j$CPU_CORES"
fi
sync
function Help
{
clear
echo "Welcome To Merruk Technology Kernel Tools $KERNEL_MAKE_VERSION !"
echo ""
echo " -MT : Standard Compile Option, Automatic Kernel/Modules Installation."
echo " -CF totoro_brcm21553_05_defconfig : Specefie the defconfig File you Like, PS: Must Be In 'arch/arm/configs'."
echo " -CL : Make AClean Compilation From Scratch."
echo " -CPU [Number Of Cores] : Specefie Number Of Cores You Wanna Use (By Default Script Calculate All Your's)."
echo " -Help/-H : Show This Help Prompt."
echo " MENU : Edit DefConfig File : totoro_brcm21553_05_defconfig."
exit 1
} # end help
# Make Then Kernel With Chosen Parameter
if [ "$1" == "" ];
then
Help
else
# Go Inside Working Directory
cd common
echo "Starting Kernel Make Operations ..."
if [ "$1" == "-MT" ];
then
echo ""
echo "Merruk Technology Standard Compile."
echo ""
make bcm21553_totoro_05_defconfig
make CONFIG_DEBUG_SECTION_MISMATCH=y $CPU_CORES EXTRA_AFLAGS='-mfpu=neon -ftree-vectorize -mfloat-abi=softfp' > ../kernel_log.$$ 2>&1
elif [ "$1" == "-CF" ];
then
echo ""
echo "Merruk Technology Special CONFIG_FILE."
echo ""
make $2
make CONFIG_DEBUG_SECTION_MISMATCH=y $CPU_CORES EXTRA_AFLAGS='-mfpu=neon -ftree-vectorize -mfloat-abi=softfp' > ../kernel_log.$$ 2>&1
elif [ "$1" == "-CL" ];
then
echo ""
echo "Merruk Technology Clean Compile."
echo ""
make clean
make bcm21553_totoro_05_defconfig
make CONFIG_DEBUG_SECTION_MISMATCH=y $CPU_CORES EXTRA_AFLAGS='-mfpu=neon -ftree-vectorize -mfloat-abi=softfp' > ../kernel_log.$$ 2>&1
elif [ "$1" == "-CPU" ];
then
echo ""
echo "Merruk Technology CPU Specefied Cores Compile."
echo ""
make bcm21553_totoro_05_defconfig
make CONFIG_DEBUG_SECTION_MISMATCH=y -j$2 EXTRA_AFLAGS='-mfpu=neon -ftree-vectorize -mfloat-abi=softfp' > ../kernel_log.$$ 2>&1
elif [ "$1" == "MENU" ];
then
make bcm21553_totoro_05_defconfig
make menuconfig
make CONFIG_DEBUG_SECTION_MISMATCH=y $CPU_CORES EXTRA_AFLAGS='-mfpu=neon -ftree-vectorize -mfloat-abi=softfp' > ../kernel_log.$$ 2>&1
elif [ "$1" == "-H" ];
then
Help
elif [ "$1" == "-HELP" ];
then
Help
else
Help
fi
# Go Back To Root Directory
cd ..
fi
sync
# Check if Compile has Completely Done
if [ -f "common/arch/arm/boot/zImage" ];
then
# Find All Compiled Modules And Copy Them into Output Directory
find . -name '*.ko' -exec cp -fv {} ./MerrukTechnology_Output/system/lib/modules \;
echo "Merruk Technology Kernel/Modules Are Done !"
echo "./common/arch/arm/boot/zImage & All Modules Are copied to :"
echo ""
echo "/MerrukTechnology_Output Directory"
echo ""
echo "###########################################################"
# Copy The Compiled Kernel Into Output Directory
cp -f ./common/arch/arm/boot/zImage ./MerrukTechnology_Output/
else
echo "Merruk Technology Kernel did not Compiled !!"
echo "Please Check 'kernel_log.*' File For Output Errors!!"
echo ""
echo "###########################################################"
exit 0
fi