-
Notifications
You must be signed in to change notification settings - Fork 0
/
genlinuxpro
executable file
·108 lines (88 loc) · 2.43 KB
/
genlinuxpro
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
#!/bin/bash -e
set -e
builddir="$1"
if [ -z "$builddir" ]
then
builddir="."
fi
cd $builddir
echo "entering $PWD"
kconfig2qmk
mv autoconf.qmk ..
cd ..
echo "entering $PWD"
builddir=$(basename $builddir)
PRO=${builddir}-linux.pro
SRC_DIR=$(readlink $builddir/source)
if [ -z "$SRC_DIR" ]
then
echo "This Makefile is meant to be invoked in a pre-prepared kernel build tree, run \"make prepare modules-prepare\" in this directory first." >&2
exit 1
fi
# find drivers -type d -maxdepth 1 |xargs -I{} echo '$SRC_DIR/{} \' |sort
SRC_DIRS=" \
$builddir/arch \
$builddir/drivers \
$SRC_DIR/arch/arm64 \
$SRC_DIR/block \
$SRC_DIR/kernel \
$SRC_DIR/fs \
$SRC_DIR/include \
$SRC_DIR/init \
$SRC_DIR/ipc \
$SRC_DIR/kernel \
$SRC_DIR/lib \
$SRC_DIR/mm \
$SRC_DIR/sound \
$SRC_DIR/drivers \
"
#SRC_DIRS=" \
#$SRC_DIRS \
#$SRC_DIR/arch/x86 \
#"
PRUNES=(\
-path $SRC_DIR/drivers/gpu/drm/amd -prune -o \
-path $SRC_DIR/drivers/staging/media -prune -o \
-path $SRC_DIR/drivers/media -prune -o \
)
OTHER_FILES="\
$SRC_DIR/arch/arm/boot \
"
cat <<EOF > $PRO
# This file was automatically generated by $0
# $(date)
include(./autoconf.qmk)
INCLUDEPATH += $builddir/include $builddir/include/uapi $builddir/source/include $builddir/source/arch/arm64/include
DEFINES += DEBUG __KERNEL__ \
class=klass new=New private=Private protected=Protected \
IS_ENABLED(x)=defined(x) \
IS_REACHABLE(x)=defined(x) \
IS_MODULE(x)=0 \
__user= __must_check= \
EXPORT_SYMBOL_GPL(x)= \
MODULE \
EOF
echo "SOURCES += \\" >> $PRO
find $SRC_DIRS ${PRUNES[*]} \( \( -type f -name '*.c' -not -name '*.mod.c' \) -o -iname '*.s' \) -printf '%p \\\n' >> $PRO
echo >> $PRO
echo "HEADERS += \\" >> $PRO
find $SRC_DIRS ${PRUNES[*]} \( -type f -name '*.h' \) -printf '%p \\\n' >> $PRO
find $builddir/include -type f -printf "%p \\\\\\n" >> $PRO
echo >> $PRO
echo "OTHER_FILES += $0 \\" >> $PRO
echo "$builddir/autoconf.qmk \\" >> $PRO
find $SRC_DIR/Documentation -type f -printf "%p \\\\\\n" >> $PRO
find $SRC_DIR/arch -type f -name "*.dts*" -printf "%p \\\\\\n" >> $PRO
find $builddir/include -type f -not -name "*.h" -printf "%p \\\\\\n" >> $PRO
find $OTHER_FILES -type f -not -name "*.h" -printf "%p \\\\\\n" >> $PRO
find $SRC_DIR/ -name Makefile -printf "%p \\\\\\n" >> $PRO
find $SRC_DIR/ -name Kconfig -printf "%p \\\\\\n" >> $PRO
find $SRC_DIR/ -name "*.yml" -printf "%p \\\\\\n" >> $PRO
cat <<EOF >>$PRO
$SRC_DIR/README \\
$SRC_DIR/MAINTAINERS \\
$builddir/.config \\
EOF
echo >> $PRO
echo -n "Done. "
wc -l $PRO