Linux Kernel Driver (III): 1. Linux kernel creation and root file system creation

Source: Internet
Author: User

1. Create a kernel for the embedded platform (the 6410 Development Board is used as an example here)

1. Clear the original configuration and intermediate files

(1) x86: Make distclean

(2) arm: Make distclean

2. Configure the kernel

(1) x86: Make menuconfig

(2) arm: Make menuconfig arch = arm (platform to be specified)

3. Compile the kernel

(1) x86: Make bzimage

(2) arm: Make uimage arch = arm cross_compile = arm-Linux-. uimage will leave a header for ubbot in the kernel image header.

Ii. File System

In general, creating an embedded file system can be divided into two steps (1) creating directories and files (2) creating management data for the created directories and files

1. create directories and files

(1) Create the root file system directory and Its subdirectories

I. mkdir rootfs (rootfs is your own root directory name)

Ii. Run CD rootfs to enter the root directory.

Iii. mkdir bin Dev etc lib proc sbin sys usr mnt tmp var, mkdir usr/bin usr/lib usr/sbin lib/modules

(2) create a device file

I, CD DEV/

Ii. mknod-M 666 console C 5 1

Mknod-M 666 null C 1 3

CD ..

(3) install/etc (the ETC configuration file does not change with the platform, so the configuration file on the PC can also be used on the Development Board)

Tar etc.tar.gz-C/XXX/rootfs

(4) Compile the kernel module: Enter the Linux Kernel Directory (Linux 2.6.36)

Make modules arch = arm cross_compile = arm-Linux-

(5) install the kernel module

Make modules_install arch = arm install_mod_path =/XXX/rootfs

(6) Configure busybox

I. Go to the busybox directory and execute: Make menuconfig

A. Go to busybox settings --> build options,

= Select build busybox as a static binary, and compile busybox using static links

= Cross compiler Prefix: sets the cross tool chain of busybox. Here we use arm-Linux-

B. Go to installation options and set the directory to which the compiled busybox will be installed (this directory is the rootfs we created above)

= Select "Don't use/usr" and select this option to prevent busybox from being installed to the/usr directory of the host system and damage the host system

= Busybox installation prefix (/XXX/rootfs). This option is used to set the installation location of the compiled busybox.

(7) Compile and install busybox

I. Make arch = arm cross compile = arm-Linux-

Ii. make install

 

 

 

 

 

 

 

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.