Moblin: Kernel compilation and RPM packaging (1): replacing Kernel

Source: Internet
Author: User
Tags rpmbuild

The USB boot made by moblin mic2 has two methods: liveos, direct boot, and traditional installation of Linux OS on the device. I want to install moblin2 on mid (menlow) and need to rebuild the kernel. You can use moblin-chroot to compile the kernel development environment or KVM.

  1. Get the source code for the kernel from the moblin repo site, such as the wget http://repo.moblin.org/moblin/development/core/source/kernel-2.6.29.5-8.1.moblin2.src.rpm

  2. Expand rpm package: rpm-ivh kernel-2.6.29.5-8.1.moblin2.src.rpm, in ~ /Rpmbuild/to open the SPECS/directory. The kernel. spec file is displayed below. The source code and patches are available under the SOURCES/directory. With rpmbuild-bp kernel. spec, you can extract the source code and install patches.
  3. Go ~ In the/rpmbuild/BUILD/directory, the source code of the kernel is used. This can be done based on the traditional kernel compilation method.

Based on the kernel compilation, we successfully installed the kernel modules under/lib/modules, and provided vmlinuz and system. Map under/boot. However, when using mic2 to make them into usbimg, the following error occurs:

Problem 1: Error creating Live CD: Unable to copy valid kernels or initrds, please check the repo

Try 1: I used to think it was caused by not generating initrd, so I used the mkinitrd command to create initrd. However, although there was no error, it was not actually generated. This is very strange. However, according to previous experiments, initrd is not mandatory, so give up.

Try 2: Under/boot, there are two kernel, the old (netbook) and the new (menlow), delete the old version, and delete the/lib/moudules related folders at the same time. If no error is reported, the problem is resolved. The cause of this problem is that multiple kernel exists.

Question 2: We have successfully created usbimg and used it to start the MID. For direct Boot, there is no problem. You can start it directly. However, there is an error in the installation method.

After the installation is successful, the following occurs at startup:

Error 15 file note found
Then, "press any key to continue .... ", go to grub and find that there is only one option moblin (2.6.29.5-8.1.moblin2-netbook, and the old kernel). You need to edit it to the new kernel before entering it. This indicates that there may be omissions in the process of compiling the kernel or making the usbimg, but it is not directed to the new kernel.

Attempt 1: I thought a configuration was wrong, so I went to grep netbook in a wide range and did not find any valid clues. I gave up.

Attempt 2: I thought it was a production problem, so I tracked the py script in mic2, just to prove that the correct version is obtained in live OS. No valid clues are found. Give up.

Try 3: Use rpm-e kernel-netbook to completely delete the old version and re-create usbimg. The prompt that the kernel package cannot be found appears during installation. This is an important information. On the surface, this problem occurs because we didn't make the new kernel into RPM, and the system installation was based on the package and requires the kernel rpm. An effective solution is to create the new kernel with RPM.

  
Based on this information, I checked on the internet how to create RPM files. My original intention was that I had kernel modules and the vmlinz files of kernel, if I had to pack them into RPM packages. However, it seems that all data is displayed in spec mode, and the make and build processes are discussed. That is to say, it is suitable for source code, it is not suitable for directly encapsulating binary files or other target files. The source we downloaded from the moblin website has a spec and can be used directly to generate an RPM.

  
Read spec and retrieve IVI or netbook. Then add the menlow script. Using rpmbuild-Ba kernel. spec, after a long wait ~ /Rpmbuild/RPM/i386 contains related RPM generation. We have also generated netbook, IVI, and menlow versions. Delete the original kernel of the system and install the new menlow rpm. We can re-create usbimg. Everything works normally.

Let's think about the following questions:

1. If it is some of our application software, do we have to make the relevant RPM package to install it?

No. At the beginning, we did not pack or delete the old package. We can use the edit grub method to enter the system. This means that the relevant files can be put into the file system, yes. Only the kernel package is an important RPM of the system. If it is not available at startup, grub cannot be enabled. However, using RPM to manage our software is not only a version issue, but also important for software upgrades and software downloads.

2. If we get a new version of the official Linux kernel, this is only tar. BZ, not the RPM mode of moblin. Without spec, how can we compile and package it?

In any case, it is necessary to learn the rpm packaging method.

 

Related Links: Moblin: kernel compilation and rpm packaging (2): RPM Packaging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.