Home > System Tutorial > LINUX > Versatile virtual machine product prototype development experiment purpose: learn how to compile through this experiment

Versatile virtual machine product prototype development experiment purpose: learn how to compile through this experiment

WBOY
Release: 2024-03-29 08:16:12
forward
903 people have browsed it

How to compile and run an ARMLinux kernel

1. Purpose

Through this experiment, learn how to compile an ARM version of the kernel image and run it on the QEMU virtual machine.

2. Experimental steps

In order to speed up the development process, ARM provides the VersatileExpress development platform. Customers can develop product prototypes based on the VersatileExpress platform. As an individual learner, there is no need to purchase the VersatileExpress development platform or other ARM development boards. You can use QEMU to simulate the development platform linux and develop arm, which can also achieve the purpose of learning.

(1) Planning tools

Download the following code package.

(2) Compile the minimum file system

First use busybox to manually compile a minimal file system.

$ cd busybox
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabi-
$ make menuconfig
Copy after login

After entering menuconfig, configure it to static compilation.

Busybox Settings --->
 Build Options --->
 [*] Build BusyBox as a static binary (no shared libs)
Copy after login

After make&&makeinstall is compiled, there will be an "_install" directory in the root directory of busybox, which stores some command sets required by the compiled file system.

linux 开发arm_开发linux软件_开发linux系统

Copy the _install directory to the linux-4.0 directory. Step into the _install directory and first create etc, dev and other directories.

#mkdir etc
#mkdir dev
#mkdir mnt
#mkdir –p etc/init.d/
Copy after login

Create a new rcS file in the _install/etc/init.d/ directory and write the following content.

mkdir –p /proc
mkdir –p /tmp
mkdir -p /sys
mkdir –p /mnt
/bin/mount -a
mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev –s
Copy after login

Changing the _install/etc/init.d/rcS file requires executable permissions, which can be achieved by using the chmod command, such as "chmod x_install/etc/init.d/rcS".

Create a new fstab file in the _install/etc directory and write the following content.

开发linux系统_linux 开发arm_开发linux软件

proc /proc proc defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /dev tmpfs defaults 0 0
debugfs /sys/kernel/debug debugfs defaults 0 0
Copy after login

Create a new inittab file in the _install/etc directory and write the following content.

::sysinit:/etc/init.d/rcS
::respawn:-/bin/sh
::askfirst:-/bin/sh
::ctrlaltdel:/bin/umount -a –r
Copy after login

Create the following device node in the _install/dev directoryLinux development arm, this time requires root permissions.

$ cd _install/dev/
$ sudo mknod console c 5 1
$ sudo mknod null c 1 3
Copy after login

(3) Compile kernel

开发linux系统_linux 开发arm_开发linux软件

$ cd linux-4.0
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabi-
$ make vexpress_defconfig
$ make menuconfig
Copy after login

配置initramfs,在initramfssourcefile中填入_install,并把Defaultkernelcommandstring清空。

General setup --->
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
 (_install) Initramfs source file(s)
Boot options -->
 ()Default kernel command string
Copy after login

配置memorysplit为“3G/1Guser/kernelsplit”,并打开高档显存。

Kernel Features --->
Memory split (3G/1G user/kernel split) --->
[ *] High Memory Support
Copy after login

开始编译内核。

$ make bzImage –j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
$ make dtbs
Copy after login

(4)运行QEMU虚拟机

运行QEMU虚拟机来模拟4核Cortex-A9的VersatileExpress开发平台。

$ qemu-system-arm -M vexpress-a9 -smp 4 -m 200M -kernel arch/arm/boot/zImage -append "rdinit=/linuxrc console=ttyAMA0 loglevel=8" -dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb -nographic
Copy after login

运行结果与实验3相同。

The above is the detailed content of Versatile virtual machine product prototype development experiment purpose: learn how to compile through this experiment. For more information, please follow other related articles on the PHP Chinese website!

source:itcool.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template