summaryrefslogtreecommitdiff
path: root/packaging/linux-tizen-modules.spec
blob: fecb84ce63f6280a00174f240207cace562fd2b4 (plain)
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
%define KMOD_PATH /lib/modules
%define KMOD_PATH_TM1 /boot/kernel/mod_tizen_tm1/lib/modules

%ifarch aarch64
%define buildarch arm64
%else
%define buildarch arm
%endif

Name:           linux-tizen-modules
Version:        7.0.2
Release:        0
License:        GPL-2.0+
Source0:        %{name}-%{version}.tar.xz
Source1:        %{name}.manifest
Summary:        Tizen-specific kernel modules
Group:          System/Kernel
ExclusiveArch:  %{arm} aarch64
BuildRequires:  kmod
BuildRequires:  linux-tizen-modules-source
BuildRequires:  %{buildarch}-rpi3-linux-kernel-devel
BuildRequires:  %{buildarch}-rpi4-linux-kernel-devel
%ifarch aarch64
BuildRequires:  kernel-devel-exynos9110-tw3
%endif
%ifnarch aarch64
BuildRequires:  kernel-devel-3.10-sc7730
%endif
%description

%package        rpi3
Summary:        Tizen modules for RaspberryPI 3
AutoReqProv:    no
Requires:       %{buildarch}-rpi3-linux-kernel-modules
Requires(post): bash
Requires(post): coreutils
Requires(post): findutils
Requires(post): kmod-compat
Provides:       stability-monitor-kernel-module
%description    rpi3

%package        rpi4
Summary:        Tizen modules for RaspberryPI 4
AutoReqProv:    no
Requires:       %{buildarch}-rpi4-linux-kernel-modules
Requires(post): bash
Requires(post): coreutils
Requires(post): findutils
Requires(post): kmod-compat
Provides:       stability-monitor-kernel-module
%description    rpi4

%ifarch aarch64
%package        tw3
Summary:        Tizen modules for TW3
AutoReqProv:    no
Provides:       stability-monitor-kernel-module
%description    tw3
%endif

%ifnarch aarch64
%package        tm1
Summary:        Tizen modules for TM1
Requires:       linux-3.10-sc7730_tizen_tm1
AutoReqProv:    no
Requires(post): bash
Requires(post): coreutils
Requires(post): findutils
Requires(post): kmod-compat
%description    tm1
%endif

%prep
%setup -q
cp %{SOURCE1} ./%{name}.manifest
cp -a /usr/src/linux-tizen-modules-source ./kernel

%build
# Force not to build with sanitizers because this is kernel
%{?asan:/usr/bin/gcc-unforce-options}
%{?ubsan:/usr/bin/gcc-unforce-options}

export BUILD_logger=m
export BUILD_proc_tsm=m
export BUILD_kdbus=m

make -C kernel clean KERNELDIR=/boot/kernel/devel/kernel-devel-%{buildarch}-rpi4
make -C kernel KERNELDIR=/boot/kernel/devel/kernel-devel-%{buildarch}-rpi4
make -C kernel modules_install KERNELDIR=/boot/kernel/devel/kernel-devel-%{buildarch}-rpi4 INSTALL_MOD_STRIP=1

export BUILD_kdbus=n

make -C kernel clean KERNELDIR=/boot/kernel/devel/kernel-devel-%{buildarch}-rpi3
make -C kernel KERNELDIR=/boot/kernel/devel/kernel-devel-%{buildarch}-rpi3/
make -C kernel modules_install KERNELDIR=/boot/kernel/devel/kernel-devel-%{buildarch}-rpi3 INSTALL_MOD_STRIP=1

%ifarch aarch64
make -C kernel clean KERNELDIR=/boot/kernel/devel/kernel-devel-tw3
make -C kernel KERNELDIR=/boot/kernel/devel/kernel-devel-tw3
make -C kernel modules_install KERNELDIR=/boot/kernel/devel/kernel-devel-tw3 INSTALL_MOD_STRIP=1
%endif

export BUILD_proc_tsm=n

%ifnarch aarch64
make -C kernel clean KERNELDIR=/boot/kernel/devel/kernel-devel-tizen_tm1
make -C kernel KERNELDIR=/boot/kernel/devel/kernel-devel-tizen_tm1
make -C kernel modules_install KERNELDIR=/boot/kernel/devel/kernel-devel-tizen_tm1 INSTALL_MOD_STRIP=1
%endif

%install
mkdir -p %{buildroot}/%{KMOD_PATH}

pushd lib/modules
find -name "*.ko" -exec cp -a --parents {} %{buildroot}/%{KMOD_PATH}/ \;
popd

# module load config
mkdir -p %{buildroot}/%{KMOD_PATH}/modprobe.d
install -m 644 conf/tizen-modprobe-rpi3.conf %{buildroot}/%{KMOD_PATH}/modprobe.d
install -m 644 conf/tizen-modprobe-rpi4.conf %{buildroot}/%{KMOD_PATH}/modprobe.d

mkdir -p %{buildroot}/%{KMOD_PATH}/modules-load.d
install -m 644 conf/tizen-modules-rpi3.conf %{buildroot}/%{KMOD_PATH}/modules-load.d
install -m 644 conf/tizen-modules-rpi4.conf %{buildroot}/%{KMOD_PATH}/modules-load.d

%ifarch aarch64
mkdir -p %{buildroot}/aarch64/modules
mv %{buildroot}/%{KMOD_PATH}/4.9.59 %{buildroot}/aarch64/modules/

mkdir -p %{buildroot}/aarch64/modules/modprobe.d
install -m 644 conf/tizen-modprobe-tw3.conf %{buildroot}/aarch64/modules/modprobe.d

mkdir -p %{buildroot}/aarch64/modules/modules-load.d
install -m 644 conf/tizen-modules-tw3.conf %{buildroot}/aarch64/modules/modules-load.d
%endif

%ifnarch aarch64
mkdir -p %{buildroot}/%{KMOD_PATH_TM1}/modules-load.d
install -m 644 conf/tizen-modules-tm1.conf %{buildroot}/%{KMOD_PATH_TM1}/modules-load.d
mv -v %{buildroot}/%{KMOD_PATH}/*3.10* %{buildroot}/%{KMOD_PATH_TM1}
%endif

%clean
rm -rf %{buildroot}
rm -rf %{_builddir}/%{name}-%{version}/lib

%post rpi3
RELEASEVERSION=$(basename $(dirname `find /lib/modules -name extra | head -1`))
/sbin/depmod -a $RELEASEVERSION

%post rpi4
RELEASEVERSION=$(basename $(dirname `find /lib/modules -name extra | head -1`))
/sbin/depmod -a $RELEASEVERSION

%ifnarch aarch64
%post tm1
KMOD_PATH_TM1=%{KMOD_PATH_TM1}
KMOD_BASEPATH=${KMOD_PATH_TM1%%%{KMOD_PATH}}
RELEASEVERSION=$(basename $(dirname `find $KMOD_PATH_TM1 -name extra | head -1`))
/sbin/depmod -b ${KMOD_BASEPATH} -a $RELEASEVERSION
%endif

%files rpi3
%manifest %{name}.manifest
%license COPYING
%{KMOD_PATH}/*rpi3*/extra
%{KMOD_PATH}/modprobe.d/tizen-modprobe-rpi3.conf
%{KMOD_PATH}/modules-load.d/tizen-modules-rpi3.conf

%files rpi4
%manifest %{name}.manifest
%license COPYING
%{KMOD_PATH}/*rpi4*/extra
%{KMOD_PATH}/modprobe.d/tizen-modprobe-rpi4.conf
%{KMOD_PATH}/modules-load.d/tizen-modules-rpi4.conf

%ifarch aarch64
%files tw3
%manifest %{name}.manifest
%license COPYING
/aarch64/modules/4.9.59/extra
/aarch64/modules/modprobe.d/tizen-modprobe-tw3.conf
/aarch64/modules/modules-load.d/tizen-modules-tw3.conf
%endif

%ifnarch aarch64
%files tm1
%manifest %{name}.manifest
%license COPYING
%{KMOD_PATH_TM1}/*3.10*/extra
%{KMOD_PATH_TM1}/modules-load.d/tizen-modules-tm1.conf
%endif