Note:
I: Check this website. I suggest you check my previous article (Linux Startup Process), because you only have a full understanding of the Linux Startup Process and the relevance of some configuration files, only by reading this blog can you have ideas and make it easier to understand.
II: This article mainly explains how to create an embedded Linux System Based on busybox, compile and install ngnix software to provide http functions, and use dropbear to provide SSH functions.
Tip: I will inevitably encounter a writing error during the writing process, and forget the reader's suggestion and understanding. I will modify the content as soon as possible.
Create a micro-embedded Linux System Based on busybox: kernel (Compilation) + initrd (busybox) +/(busybox) + dropbear (SSH function provided)
Operating Environment Description:
Kernel version: linux-2.6.38.5.tar.bz2 (compile installation) --> http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.5.tar.bz2
Busybox version: busybox-1.20.2.tar.bz2 --> BusyBox Version Download
Dropbear: http://matt.ucc.asn.au/dropbear/dropbear.html/dropbear-2013.56.tar.bz2
Busybox introduction:
BusyBox is a software integrated with more than common linux commands and tools.
BusyBox contains some simple tools (ls, cat, echo, touch...) and complex commands (grep, find, mount ....)
Busybox was originally written by Bruce Perens in 1996 for the Debian GNU/Linux installation disk. In short, BusyBox is a treasure chest, which integrates many tools and commands in Linux.
Dropbear (Open Source Software) Introduction:
Dropbear is a relatively small SSH server and client software running on a POSIX-based platform. dropbear implements the complete ssh s/C version 2 protocol.
To put it simply, dropbear is an open-source lightweight SSH service software. (I understand)
Steps:
1. Add an IDE Hard Drive (10 Gb) and partition It (/dev/hda1 (20 M),/dev/hda2 (512 M) /dev/hda3 (128 M)-> change the file type of/dev/hda3 to 82)
All file types are ext3 (mke2fs-j/dev/hda #), you can refer to the RAID principle and step by step to create a RAID (there are examples of creating a partition and changing the partition file system type)
# Fdisk/dev/hda (/dev/hda partition)
# Partprobe/dev/hda
# Mke2fs-j/dev/hda #
2. Create a directory as the/dev/hda1 and/dev/hda2 mount points and mount them.
# Mkdir/mnt/{boot, sysroot}-pv
# Tree/mnt # view all files and Their subdirectories in the/mnt directory
# Mount/dev/hda1/mnt/boot # used for Linux boot Partition
# Mount/dev/hda2/mnt/sysroot # Linux root Partition
# Mount ## run the mount command to check whether the mounting is successful.
3. Compile the kernel source code to provide the required kernel as the new system (the source code package is located in the/usr/src directory)
# Cd/usr/src
# Tar jxvf linux-2.6.38.5.tar.bz2 # extract the source code here to download the bzip format compressed, so use the j Option
# Ln-sv linux-2.6.38.5 linux # Give a soft connection to the linux-2.6.38.5 named linux
# Cd linux
# Cp/root/kernel-2.6.38.1-i686.cfg./. config # kernel-2.6.38.1-i686.cfg (2.6.38 system used by the module, you can modify some modules)
# Make menuconfig
Note: here we will compile the ext3 and nic drivers in the file system into the kernel directly, because I am using the vmware Workstation Virtual Machine, so the NIC type is pcnet32
# Make SUBDIR = arch/
# Cp arch/x86/boot/bzImage/mnt/boot/# copy the compiled kernel file to the/mnt/boot directory
4. Compile and install busybox(busybox-1.20.2.tar.bz2)
(Busybox needs to compare the new kernel support header files in the ubi-user.h,
So we need to copy this file to/usr/src/busybox-1.20.2/iniclued/mtd.
# Cd/usr/src
# Tar jxvf busybox-1.20.2.tar.bz2
# Cd busybox-1.20.2
# Mkdir include/mtd
# Cp/usr/src/linux/include/mtd/ubi-user.h include/mtd/
# Make menuconfig # refer to "Instructions"
# Make install