packaging: exported kernel-header properly 16/115416/2 accepted/tizen/wearable/20170221.225305 submit/tizen/20170221.075612
authorJaechul Lee <jcsing.lee@samsung.com>
Fri, 17 Feb 2017 05:11:59 +0000 (14:11 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Mon, 20 Feb 2017 03:35:49 +0000 (12:35 +0900)
Orginally, kernel-header which is based on 3.18.14 was exported.
We applied some patches on the kernel therefore it need to export
patched kernel-header again. Moreover, organized spec script properly
and removed unnecessary code.

Change-Id: I8935d9cc374a2551e57a4ba4f551c047abad2814
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
packaging/linux-3.18-exynos7270.spec

index 1800c28..9f99b94 100644 (file)
@@ -29,9 +29,6 @@ Summary: Linux support headers for userspace development
 Group: System/Kernel
 Requires(post): coreutils
 
-%files -n linux-%{CHIPSET}-%{MODEL}
-/boot/kernel/dzImage
-
 %description -n linux-%{CHIPSET}-%{MODEL}
 This package provides the %{CHIPSET}_eur linux kernel image.
 
@@ -40,9 +37,6 @@ License: GPL-2.0
 Summary: Linux support debug symbol
 Group: System/Kernel
 
-%files -n linux-%{CHIPSET}-%{MODEL}-debuginfo
-/boot/kernel/kernel-%{MODEL}
-
 %description -n linux-%{CHIPSET}-%{MODEL}-debuginfo
 This package provides the %{CHIPSET}_eur linux kernel's debugging files.
 
@@ -86,80 +80,71 @@ chmod a+x release_obs.sh
 chmod a+x ./scripts/exynos_dtbtool.sh
 chmod a+x ./scripts/exynos_mkdzimage.sh
 
+# 1. make kernel image
 ./release_obs.sh
 
-cp -f arch/arm64/boot/Image %{_builddir}/Image.%{MODEL}
-cp -f arch/arm64/boot/merged-dtb %{_builddir}/merged-dtb.%{MODEL}
-cp -f arch/arm64/boot/dzImage %{_builddir}/dzImage.%{MODEL}
-cp -f System.map %{_builddir}/System.map.%{MODEL}
-cp -f .config %{_builddir}/config.%{MODEL}
-cp -f vmlinux %{_builddir}/vmlinux.%{MODEL}
+%install
 
-# prepare for devel package
-find %{_builddir}/%{name}-%{version} -name ".tmp_vmlinux*" -delete
-find %{_builddir}/%{name}-%{version} -name "\.*dtb*tmp" -delete
-find %{_builddir}/%{name}-%{version} -name "*\.*tmp" -delete
-find %{_builddir}/%{name}-%{version} -name "vmlinux" -delete
-find %{_builddir}/%{name}-%{version} -name "bzImage" -delete
-find %{_builddir}/%{name}-%{version} -name "zImage" -delete
-find %{_builddir}/%{name}-%{version} -name "dzImage" -delete
-find %{_builddir}/%{name}-%{version} -name "*.cmd" -delete
-find %{_builddir}/%{name}-%{version} -name "*\.ko" -delete
-find %{_builddir}/%{name}-%{version} -name "*\.o" -delete
-find %{_builddir}/%{name}-%{version} -name "*\.S" -delete
-find %{_builddir}/%{name}-%{version} -name "*\.c" -not -path "%{_builddir}/%{name}-%{version}/scripts/*" -delete
+# 2. copy to buildroot
+mkdir -p %{buildroot}/usr
+mkdir -p %{buildroot}/usr/share/license
+mkdir -p %{buildroot}/boot/kernel/devel
 
-#remove all changed source codes for next build
-cd %_builddir
-mv %{name}-%{version} kernel-devel-%{MODEL}
-/bin/tar -xf %{SOURCE0}
-cd %{name}-%{version}
+cp -f arch/arm64/boot/dzImage  %{buildroot}/boot/kernel/dzImage
+cp -f arch/arm64/boot/merged-dtb  %{buildroot}/boot/kernel/merged-dtb
+cp -f arch/arm64/boot/Image  %{buildroot}/boot/kernel/Image
+cp -f System.map  %{buildroot}/boot/kernel/System.map
+cp -f .config  %{buildroot}/boot/kernel/config
+cp -f vmlinux  %{buildroot}/boot/kernel/vmlinux
+cp -f COPYING %{buildroot}/usr/share/license/linux-kernel
 
-%install
-mkdir -p %{buildroot}/usr
+# 3. make kernel header
 make mrproper
 make headers_check
 make headers_install INSTALL_HDR_PATH=%{buildroot}/usr
 
+# 4. remove unnecessary files.
 find  %{buildroot}/usr/include -name ".install" -delete
 find  %{buildroot}/usr/include -name "..install.cmd" -delete
 rm -rf %{buildroot}/usr/include/scsi
 rm -f %{buildroot}/usr/include/asm*/atomic.h
 rm -f %{buildroot}/usr/include/asm*/io.h
 
-mkdir -p %{buildroot}/usr/share/license
-cp -vf COPYING %{buildroot}/usr/share/license/linux-kernel
-
-mkdir -p %{buildroot}/boot/kernel/devel
-mkdir -p %{buildroot}/boot/kernel/kernel-%{MODEL}
-mkdir -p %{buildroot}/boot/kernel/license-%{MODEL}
-
-mv %_builddir/dzImage.%{MODEL} %{buildroot}/boot/kernel/dzImage
-mv %_builddir/Image.%{MODEL} %{buildroot}/boot/kernel/kernel-%{MODEL}/Image
-mv %_builddir/merged-dtb.%{MODEL} %{buildroot}/boot/kernel/kernel-%{MODEL}/merged-dtb
-
-mv %_builddir/System.map.%{MODEL} %{buildroot}/boot/kernel/kernel-%{MODEL}/System.map
-mv %_builddir/config.%{MODEL} %{buildroot}/boot/kernel/kernel-%{MODEL}/config
-mv %_builddir/vmlinux.%{MODEL} %{buildroot}/boot/kernel/kernel-%{MODEL}/vmlinux
-mv %_builddir/kernel-devel-%{MODEL} %{buildroot}/boot/kernel/devel/kernel-devel-%{MODEL}
+find %{_builddir}/%{name}-%{version} -name ".tmp_vmlinux*" -delete
+find %{_builddir}/%{name}-%{version} -name "\.*dtb*tmp" -delete
+find %{_builddir}/%{name}-%{version} -name "*\.*tmp" -delete
+find %{_builddir}/%{name}-%{version} -name "vmlinux" -delete
+find %{_builddir}/%{name}-%{version} -name "bzImage" -delete
+find %{_builddir}/%{name}-%{version} -name "zImage" -delete
+find %{_builddir}/%{name}-%{version} -name "dzImage" -delete
+find %{_builddir}/%{name}-%{version} -name "*.cmd" -delete
+find %{_builddir}/%{name}-%{version} -name "*\.ko" -delete
+find %{_builddir}/%{name}-%{version} -name "*\.o" -delete
+find %{_builddir}/%{name}-%{version} -name "*\.S" -delete
+find %{_builddir}/%{name}-%{version} -name "*\.c" -not -path "%{_builddir}/%{name}-%{version}/scripts/*" -delete
 
+# 5. make kernel-devel
+mv %{_builddir}/%{name}-%{version} %{buildroot}/boot/kernel/devel/kernel-devel-%{MODEL}
+mkdir -p %{_builddir}/%{name}-%{version}
 ln -s kernel-devel-%{MODEL} %{buildroot}/boot/kernel/devel/tizen-devel
 
-find %{buildroot}/boot/kernel/ -name "*.h" -print0 | xargs -0 chmod 644
-find %{buildroot}/boot/kernel/ -name 'System.map' > develfiles.pre # for secure storage
-find %{buildroot}/boot/kernel/ -name 'vmlinux' >> develfiles.pre   # for TIMA
-find %{buildroot}/boot/kernel/ -name '*.ko' >> develfiles.pre      # for TIMA
-find %{buildroot}/boot/kernel/ -name '*Image' >> develfiles.pre   # for Trusted Boot
-cat develfiles.pre | sed -e "s#%{buildroot}##g" | uniq | sort > develfiles
+%files -n linux-%{CHIPSET}-%{MODEL}
+/boot/kernel/dzImage
 
-%clean
-rm -rf %_builddir
+%files -n linux-%{CHIPSET}-%{MODEL}-debuginfo
+/boot/kernel/config
+/boot/kernel/Image
+/boot/kernel/merged-dtb
+/boot/kernel/System.map
+/boot/kernel/vmlinux
 
 %files -n kernel-headers-%{CHIPSET}-%{MODEL}
+%defattr(644,root,root,-)
 /usr/include/*
 
 %files -n linux-kernel-license-%{CHIPSET}-%{MODEL}
 /usr/share/license/*
 
-%files -n kernel-devel-%{CHIPSET}-%{MODEL} -f develfiles
+%files -n kernel-devel-%{CHIPSET}-%{MODEL}
+%defattr(644,root,root,-)
 /boot/kernel/devel/*