Friday, April 22, 2011

SBR600 Project - Release 0.3 :: How My Package Works

I thought that it can be useful if I explain about my spec file and describe the major parts of this file for more clarification. It is simple. If the Arch is ARM, it follows the lines bellow. If the Arch is not ARM, it continues as a regular kernel package like before.
You can download my spec file from this link:  SPEC File
I am going to explain the major parts. I took the following lines from spec file (explanations are after commands which are started with #:

%setup -q
mkdir -p tmp
#Here, I made a temporary file for saving module files for later use. Modules files #are created by kernel and we will use that with dracut to make initramfs or #ramdisk.
make ARCH=arm omap3_beagle_defconfig
#configuration of kernel source for a particular architecture, which is ARM in #this case, and select the config file. In this case, I selected #omap3_beagle_defconfig for my ARM board.
make clean
make uImage
#Compile the kernel. If you are testing on your own computer (different #architecture than ARM), you should use CROSS COMPILE
make modules
#Compile kernel modules
make modules_install INSTALL_MOD_PATH=tmp
#Install the modules into tmp directory that I mentioned above for later use.
mkdir -p %{buildroot}/boot
#Prepare /boot directory for installing kernel and initramfs
cp arch/arm/boot/uImage %{buildroot}/boot/uImage-%{version}
#Copy the compiled kernel to the /boot directory with proper name.
ln -f %{buildroot}/boot/uImage-%{version} %{buildroot}/boot/uImage.bin
#Keep track of each installation of kernel by using ln command and make the last #one as a default for kernel
#mkdir -p %{buildroot}/%{_sysconfdir}
#cp -p %{SOURCE1} %{buildroot}/%{_sysconfdir}
#These two lines are not usable for release 0.3, but I mentioned here because I #used in previous versions. Because I wanted to make a small initramfs, I used a #small version of dracut.conf for using during the installation of package. So, I #imported dracut.conf by SOURCE1 and copied into the /etc directory.
mkdir -p %{buildroot}/lib/modules/%{version}
#Make a directory for copying the modules from tmp directory to proper #destinations.
cp -p -r tmp/lib/modules/%{version}/* %{buildroot}/lib/modules/%{version}
#Copy modules
dracut -H -f /boot/initramfs-%{version}.img %{version}
#Making initramfs by dracut for last kernel
ln -f /boot/initramfs-%{version}.img /boot/initramfs.img
#keep track of each initramfs by using ln command and select the last one as a #default.

I hope you enjoyed from this article.
Best regards,
Khosro Taraghi

1 comment:

  1. In December 1991, Linux 0.11 was released. This version was the first to be self hosted. Linux 0.11 could be compiled by a computer running Linux 0.11. When he released version 0.12 in February 1992, Torvalds adopted the GNU General Public License (GPL) over his previous self-drafted license, which had not permitted commercial redistribution.

    legacy computer