Grandma, a bear, got killed by a stupid error for several nights and did not compile it into a static file. After running it, the system prompts no init file.
In fact, the whole process is quite simple, that is, the details are not noticed. I have written a script (for reference only, work is not OK) for your reference:
#! /Bin/ Bash # In order not to affect others, create a directory for our work Mkdir Kerneldbgcd kerneldbg # Use the GIT Version Management System to download the Linux kernel source code. Git: // Git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git # Use the GIT Version Management System to download the busybox source code git clone git: // Busybox.net/busybox.git # Check whether qemu is installed in the system. If not, install dpkg. -L | Grep Qemu If [$? EQ 1 ] Echo " Please install qemu first! " Echo " Usage: sudo apt-Get install qemu " Fi # Compile busybox first. Set busybox to static link before compilation. Otherwise, hum, kill you @ # You can manually set. CD busybox through make menuconfig If [- F. config] Sed " Config_staic = y " # Modify to static compilation. Code ! Else Echo " Missing. config, please \ "make menuconfig \" first " Fi # Compile busybox and install it. A _ install directory is generated under the current directory. Make Make Install # Go To The Linux directory CD .. CD Linux - Stable # After necessary Configuration Make Bzimage # create a disk image Dd If =/Dev/Zero of = rootfs. img bs = 1 m COUNT = 20 # Format the disk mkfs. ext3 rootfs. IMG # create a rootfs directory to mount rootfs. img Mkdir Rootfs # Mount rootfs. img Sudo Mount - O loop rootfs. IMG rootfs # copy all the content in the _ install directory generated by busybox to the rootfs directory. # This is actually the so-called root file system. CP -RV./busybox/_ install /* . /Rootfs # create the necessary device file CD rootfssudo mknod rootfs/dev/console C 5 1 sudo mknod rootfs/dev/Ram B 1 0 # copy the bzimage compiled by Linux to CD .. CP. /Linux-stable/ARCH/x86/boot/bzimage # Start qemu and load the generated root file system and Kernel File qemu-hda. /rootfs. IMG-kernel. /bzimage-APPEND "root =/dev/SDA"