1 # Ignore double dash in version for rpmbuild
2 %define _wrong_version_format_terminate_build 0
4 %define config_name tizen_bcm2711_defconfig
6 %define buildarch arm64
10 %define target_board rpi4
11 %define variant %{buildarch}-%{target_board}
13 Name: rpi4-linux-kernel
14 Summary: The Linux Kernel for Raspberry Pi4
18 ExclusiveArch: %{arm} aarch64
20 Vendor: The Linux Community
21 URL: https://www.kernel.org
22 Source0: linux-kernel-%{version}.tar.xz
23 BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root
25 %define fullVersion %{version}-%{variant}
28 BuildRequires: module-init-tools
31 BuildRequires: libopenssl1.1-devel
35 The Linux Kernel, the operating system core itself
37 %package -n %{variant}-linux-kernel
39 Summary: Tizen kernel for %{target_board}
41 Provides: %{variant}-kernel-uname-r = %{fullVersion}
42 Provides: linux-kernel = %{version}-%{release}
44 %description -n %{variant}-linux-kernel
45 This package contains the Linux kernel for Tizen (arch %{buildarch}, target board %{target_board})
47 %package -n %{variant}-linux-kernel-modules
48 Summary: Kernel modules for %{target_board}
50 Provides: %{variant}-kernel-modules = %{fullVersion}
51 Provides: %{variant}-kernel-modules-uname-r = %{fullVersion}
53 %description -n %{variant}-linux-kernel-modules
54 Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board}
56 %package -n %{variant}-linux-kernel-devel
58 Summary: Linux support kernel map and etc for other packages
60 Provides: %{variant}-kernel-devel = %{fullVersion}
61 Provides: %{variant}-kernel-devel-uname-r = %{fullVersion}
63 %description -n %{variant}-linux-kernel-devel
64 This package provides kernel map and etc information.
66 %package -n %{variant}-linux-kernel-headers
68 Summary: Linux support headers for userspace development
70 Provides: kernel-headers-tizen-dev
72 %description -n %{variant}-linux-kernel-headers
73 This package provides userspaces headers from the Linux kernel. These
74 headers are used by the installed headers for GNU glibc and other system
81 %{?asan:/usr/bin/gcc-unforce-options}
82 %{?ubsan:/usr/bin/gcc-unforce-options}
84 # 0. extract uapi headers
85 make headers_check %{?_smp_mflags}
86 make headers_install %{?_smp_mflags}
88 # 1-1. Set config file
89 make %{config_name} %{?_smp_mflags}
90 if ! grep -q "^CONFIG_LOCALVERSION=\"-%{variant}" .config; then
91 ./scripts/config --set-str CONFIG_LOCALVERSION "-%{variant}$(eval $(grep ^CONFIG_LOCALVERSION= .config); echo $CONFIG_LOCALVERSION)"
94 # 1-2. Build Image/Image.gz
98 make dtbs %{?_smp_mflags}
101 make modules %{?_smp_mflags}
104 QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT
106 # 2-1. Destination directories
107 mkdir -p %{buildroot}/boot
108 mkdir -p %{buildroot}/lib/modules
110 # 2-2. Install kernel binary and DTB
112 install -m 644 arch/%{buildarch}/boot/Image %{buildroot}/boot/
113 install -m 644 arch/%{buildarch}/boot/dts/broadcom/bcm*.dtb %{buildroot}/boot/
115 install -m 644 arch/%{buildarch}/boot/zImage %{buildroot}/boot/
116 install -m 644 arch/%{buildarch}/boot/dts/bcm*.dtb %{buildroot}/boot/
119 # 2-3. Install modules
120 make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install
122 # 2-4. Install boot binary files
124 install -m 644 rpi4/boot/config_64bit.txt %{buildroot}/boot/config.txt
126 install -m 644 rpi4/boot/config.txt %{buildroot}/boot/
128 install -m 644 rpi4/boot/LICENCE.broadcom %{buildroot}/boot/
129 install -m 644 rpi4/boot/start*.elf %{buildroot}/boot/
130 install -m 644 rpi4/boot/fixup*.dat %{buildroot}/boot/
132 # 2-5. Install kernel headers
133 make headers_install %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr
135 # 3. Copy files for devel package
136 mkdir -p %{buildroot}/boot/kernel/devel/kernel-devel-%{variant}
138 --include "/scripts/**.c" \
139 --exclude "/debug*.list" \
140 --exclude "/documentation.list" \
141 --exclude "/*.manifest" \
142 --exclude "/packaging/" \
143 --exclude "/.gbs.conf" \
144 --exclude "/.git**" \
145 --exclude ".gitignore" \
147 --exclude ".tmp_vmlinux*" \
148 --exclude ".*dtb*tmp" \
151 --exclude "vmlinux" \
154 --exclude "Image.gz" \
160 %{_builddir}/%{name}-%{version}/ %{buildroot}/boot/kernel/devel/kernel-devel-%{variant}
165 %files -n %{variant}-linux-kernel-modules
168 %files -n %{variant}-linux-kernel-devel
171 %files -n %{variant}-linux-kernel
180 /boot/LICENCE.broadcom
184 %files -n %{variant}-linux-kernel-headers