2 %define config_name tizen_bcmrpi3_defconfig
3 %define buildarch arm64
5 %define config_name tizen_bcm2709_defconfig
8 %define target_board rpi3
9 %define variant %{buildarch}-%{target_board}
11 Name: %{target_board}-linux-kernel
12 Summary: The Linux Kernel for Raspberry Pi3
16 ExclusiveArch: %{arm} aarch64
18 Vendor: The Linux Community
19 URL: https://www.kernel.org
20 Source0: linux-kernel-%{version}.tar.xz
21 BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root
23 %define fullVersion %{version}-%{variant}
26 BuildRequires: module-init-tools
27 BuildRequires: u-boot-tools >= 2016.03
30 The Linux Kernel, the operating system core itself
32 %package -n %{variant}-linux-kernel
34 Summary: Tizen kernel for %{target_board}
36 Provides: %{variant}-kernel-uname-r = %{fullVersion}
37 Provides: linux-kernel = %{version}-%{release}
39 %description -n %{variant}-linux-kernel
40 This package contains the Linux kernel for Tizen (arch %{buildarch}, target board %{target_board})
42 %package -n %{variant}-linux-kernel-modules
43 Summary: Kernel modules for %{target_board}
45 Provides: %{variant}-kernel-modules = %{fullVersion}
46 Provides: %{variant}-kernel-modules-uname-r = %{fullVersion}
48 %description -n %{variant}-linux-kernel-modules
49 Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board}
51 %package -n %{variant}-linux-kernel-devel
53 Summary: Linux support kernel map and etc for other packages
55 Provides: %{variant}-kernel-devel = %{fullVersion}
56 Provides: %{variant}-kernel-devel-uname-r = %{fullVersion}
58 %description -n %{variant}-linux-kernel-devel
59 This package provides kernel map and etc information.
62 %setup -q -n linux-kernel-%{version}
65 %{?asan:/usr/bin/gcc-unforce-options}
66 %{?ubsan:/usr/bin/gcc-unforce-options}
68 # Make sure EXTRAVERSION says what we want it to say
69 sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -%{variant}/" Makefile
71 # 1-1. Set config file
74 # 1-2. Build Image/Image.gz
78 make dtbs %{?_smp_mflags}
81 make modules %{?_smp_mflags}
84 QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT
86 # 2-1. Destination directories
87 mkdir -p %{buildroot}/boot
88 mkdir -p %{buildroot}/lib/modules
90 # 2-2. Install kernel binary and DTB
92 install -m 644 arch/%{buildarch}/boot/Image %{buildroot}/boot/
93 install -m 644 arch/%{buildarch}/boot/dts/broadcom/bcm*.dtb %{buildroot}/boot/
95 install -m 644 arch/%{buildarch}/boot/zImage %{buildroot}/boot/
96 install -m 644 arch/%{buildarch}/boot/dts/bcm*.dtb %{buildroot}/boot/
99 # 2-3. Install modules
100 make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install
102 # 2-4. Install boot binary files
104 install -m 644 rpi3/boot/config_64bit.txt %{buildroot}/boot/config.txt
106 install -m 644 rpi3/boot/config_32bit.txt %{buildroot}/boot/config.txt
108 install -m 644 rpi3/boot/LICENCE.broadcom %{buildroot}/boot/
109 install -m 644 rpi3/boot/bootcode.bin %{buildroot}/boot/
110 install -m 644 rpi3/boot/start*.elf %{buildroot}/boot/
111 install -m 644 rpi3/boot/fixup*.dat %{buildroot}/boot/
113 # 3-1. remove unnecessary files to prepare for devel package
114 find %{_builddir}/linux-kernel-%{version} -name ".tmp_vmlinux*" -delete
115 find %{_builddir}/linux-kernel-%{version} -name ".gitignore" -delete
116 find %{_builddir}/linux-kernel-%{version} -name "\.*dtb*tmp" -delete
117 find %{_builddir}/linux-kernel-%{version} -name "\.*dtb" -delete
118 find %{_builddir}/linux-kernel-%{version} -name "*\.*tmp" -delete
119 find %{_builddir}/linux-kernel-%{version} -name "vmlinux" -delete
120 find %{_builddir}/linux-kernel-%{version} -name "Image" -delete
121 find %{_builddir}/linux-kernel-%{version} -name "zImage" -delete
122 find %{_builddir}/linux-kernel-%{version} -name "Image.gz" -delete
123 find %{_builddir}/linux-kernel-%{version} -name "*.cmd" -delete
124 find %{_builddir}/linux-kernel-%{version} -name "*\.ko" -delete
125 find %{_builddir}/linux-kernel-%{version} -name "*\.o" -delete
126 find %{_builddir}/linux-kernel-%{version} -name "*\.S" -delete
127 find %{_builddir}/linux-kernel-%{version} -name "*\.HEX" -type f -delete
128 find %{_builddir}/linux-kernel-%{version} -name "*\.c" -not -path "%{_builddir}/linux-kernel-%{version}/scripts/*" -delete
130 # 3-2. move files for devel package
131 cp -r %{_builddir}/linux-kernel-%{version}/ %{_builddir}/kernel-devel-%{variant}/
133 # 4. Move files for each package
134 mkdir -p %{buildroot}/boot/kernel/devel
135 mv %{_builddir}/kernel-devel-%{variant} %{buildroot}/boot/kernel/devel/
141 %files -n %{variant}-linux-kernel-modules
144 %files -n %{variant}-linux-kernel-devel
147 %files -n %{variant}-linux-kernel
156 /boot/LICENCE.broadcom