首页 > 系统相关 >kernel6.5.7+busybox1.36.1制作一个Mini Linux (没启动起来)

kernel6.5.7+busybox1.36.1制作一个Mini Linux (没启动起来)

时间:2023-10-15 13:11:51浏览次数:55  
标签:busybox non rambo Mini kernel6.5 free busybox1.36 debian 1.36

目录
.
.
.
有兴趣的同学可参考该文档将其完善
.
.
.

前奏

rambo@debian:~$ cat /etc/issue
Debian GNU/Linux 12 \n \l
 
rambo@debian:~$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       718Mi        14Gi       4.7Mi       370Mi        14Gi
Swap:          975Mi          0B       975Mi
 
# 查看逻辑CPU的个数
rambo@debian:~$ cat /proc/cpuinfo| grep "processor"| wc -l
8
 
 
 
rambo@debian:~$ cat /etc/apt/sources.list
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
 
deb https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
 
 
 
rambo@debian:~$ sudo apt -y update
 
rambo@debian:~$ sudo apt install -y make gcc libncurses-dev build-essential flex bison libssl-dev libelf-dev dwarves time
 

下载linux内核源码并编译

rambo@debian:~$ wget https://mirror.bjtu.edu.cn/kernel/linux/kernel/v6.x/linux-6.5.7.tar.gz
rambo@debian:~$ tar -zxvf linux-6.5.7.tar.gz
rambo@debian:~$ cd linux-6.5.7/
rambo@debian:~/linux-6.5.7$ make menuconfig
General setup  --->
       ----> [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support

    Device Drivers  --->
       [*] Block devices  --->
            <*>   RAM block device support
           (65536) Default RAM disk size (kbytes) 



rambo@debian:~/linux-6.5.7$ make -j10
编译成功后的内核位置:
rambo@debian:~$ ls linux-6.5.7/arch/x86_64/boot/bzImage

下载busybox的源代码

rambo@debian:~$ wget https://www.busybox.net/downloads/busybox-1.36.1.tar.bz2
rambo@debian:~$ tar -jxvf busybox-1.36.1.tar.bz2
rambo@debian:~$ cd busybox-1.36.1
rambo@debian:~/busybox-1.36.1$ make menuconfig
注:将buxybox设置成静态编译,如下项打开
Settings --->[*] Build static binary (no shared libs)


rambo@debian:~/busybox-1.36.1$ make && make install
注:编译完成后的busybox就安装在源码根目录下的_install目录了,我们进入_install目录,补充一些必要的文件或目录

rambo@debian:~/busybox-1.36.1$ cd _install/
rambo@debian:~/busybox-1.36.1$ mkdir -p etc dev mnt proc sys tmp mnt etc/init.d/
rambo@debian:~/busybox-1.36.1$ vim etc/fstab
proc     /proc   proc     defaults   0  0
tmpfs    /tmp    tmpfs    defaults   0  0
sysfs    /sys    sysfs    defaults   0  0

rambo@debian:~/busybox-1.36.1$ vim etc/init.d/rcS
echo -e "WELCOME TO TEST_LINUX"
/bin/mount -a
echo -e "Remounting the root filesystem"
mount  -o  remount,rw  /
mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s


rambo@debian:~/busybox-1.36.1$ chmod 755 etc/init.d/rcS
rambo@debian:~/busybox-1.36.1$ vim etc/inittab
::sysinit:/etc/init.d/rcS
::respawn:-/bin/sh
::askfirst:-/bin/sh
::ctrlaltdel:/bin/umount -a -r

rambo@debian:~/busybox-1.36.1$ chmod 755 etc/inittab
rambo@debian:~/busybox-1.36.1/_install$ cd dev
rambo@debian:~/busybox-1.36.1/_install/dev$ 


rambo@debian:~/busybox-1.36.1/_install/dev$ 
sudo mknod console c 5 1
sudo mknod null  c 1 3
sudo mknod tty1  c 4 1
sudo mknod ttyS0 c 4 64


rambo@debian:~/busybox-1.36.1/_install/dev$ cd ../..

制作根文件系统镜像文件

rambo@debian:~/busybox-1.36.1$ dd if=/dev/zero of=./rootfs.ext4 bs=1M count=32
rambo@debian:~/busybox-1.36.1$ sudo mkfs.ext4 rootfs.ext4
rambo@debian:~/busybox-1.36.1$ mkdir fs
rambo@debian:~/busybox-1.36.1$ sudo mount -t ext4 -o loop rootfs.ext4  ./fs
rambo@debian:~/busybox-1.36.1$ df -h | grep busybox
/dev/loop0       26M   14K   23M   1% /home/rambo/busybox-1.36.1/fs

rambo@debian:~/busybox-1.36.1$ sudo cp -rf ./_install/* ./fs
rambo@debian:~/busybox-1.36.1$ sudo umount ./fs
rambo@debian:~/busybox-1.36.1$ gzip --best -c rootfs.ext4 > rootfs.img.gz
rambo@debian:~/busybox-1.36.1$ ls -alh rootfs.img.gz 
-rw-r--r-- 1 rambo rambo 1.3M Oct 13 09:15 rootfs.img.gz

rambo@debian:~/busybox-1.36.1$ cd

安装qemu

rambo@debian:~$ sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils qemu-system-ppc64 vim

rambo@debian:~$ sudo qemu-system-x86_64 \
  -kernel  ~/linux-6.5.7/arch/x86_64/boot/bzImage  \
  -initrd  ~/busybox-1.36.1/rootfs.img.gz   \
  -append "console=ttyS0"  \
  -nographic -enable-kvm



sudo qemu-system-x86_64 \
-kernel ~/linux-6.5.7/arch/x86_64/boot/bzImage \
-initrd ~/initramfs.cpio.gz \
-nographic -enable-kvm \
-append "console=ttyS0" 



启动不成功....


标签:busybox,non,rambo,Mini,kernel6.5,free,busybox1.36,debian,1.36
From: https://www.cnblogs.com/smlile-you-me/p/17763316.html

相关文章

  • Codeforces Round 903 (Div. 3) F. Minimum Maximum Distance(图论)
    CodeforcesRound903(Div.3)F.MinimumMaximumDistance思路对标记点更新fg,从0开始进行bfs,更新d1为所有点到0的距离获得到0最远的标记点L,从L开始bfs,更新d2为所有点到L的距离获得距离L最远的标记点R,从R开始bfs,更新d3为所有点到R的距离遍历所有点,这个点与标记点的最大距......
  • Atcoder beginner constest319 Minimum Width
    因为要求窗口的最小宽度,当宽度为w时满足条件,那么宽度为w+1时也满足条件,有此可见是有单调性的,那么可以用二分搜的方法,且此题目一定有解。因为M最大为2乘以10的5次方,Li最大为10的9次方,所以宽度最大为2乘以10的14次方,单词每次间隔1,所以这里设成10的17次方。之后就是套二分模板解暴力......
  • centos7搭建minio
    minio官网https://min.io/download#/linux官网启动wgethttps://dl.min.io/server/minio/release/linux-amd64/miniochmod+xminioMINIO_ROOT_USER=adminMINIO_ROOT_PASSWORD=password./minioserver/mnt/data--console-address":9001" 手动配置minio服务1.Linu......
  • CF1881F Minimum Maximum Distance
    给定一棵树,树上的一些点被打上了标记,定义一个节点的贡献为其到所有标记节点距离的最大值,求最小贡献。\(n\le2\times10^5\)。这道题的原题是CF337D(甚至要更困难一些)。很套路的换根DP啊。我们考虑设\(f_i\)为\(i\)子树内的标记节点到\(i\)的最大距离,\(g_i\)为子......
  • cerbos minio s3 存储试用
    cerbos支持blob存储,以下是关于minios3的集成试用环境准备docker-composeversion:"3"services:minio:image:minio/minioports:-"9000:9000"-"9001:9001"command:server......
  • [AGC030F] Permutation and Minimum 题解
    PermutationandMinimum看到300的数据范围,再加上计数题,很容易就往计数DP方向去想。为方便,我们将\(n\)乘二。因为是两个位置取\(\min\),于是我们便想到从小往大把每个数填入序列。于是DP数组第一维的意义便出来了:当前已经填入了前\(i\)小个数。考虑当前填入一个数。这......
  • Maximums and Minimums (CF E)
      思路:分别求出最小区间和最大区间,利用单调zai处理即可然后在利用调和级数,求最小值的倍数 后记:为什么我不2个元素都求一个区间呢?......
  • 开源DNN加速器Gemmini
      ucb-bar/gemmini:Berkeley'sSpatialArrayGenerator(github.com) GemminiTheGemminiprojectisdevelopingafull-system,full-stackDNNhardwareexplorationandevaluationplatform.Gemminienablesarchitectstomakeusefulinsightsintohowd......
  • 统一图像和文字生成的MiniGPT-5来了:Token变Voken,模型不仅能续写,还会自动配图了
    前言 OpenAI的GPT-5大模型似乎还遥遥无期,但已经有研究者率先推出了创新视觉与语言交叉生成的模型MiniGPT-5。这对于生成具有连贯文本描述的图像具有重要意义。本文转载自机器之心仅用于学术分享,若侵权请联系删除欢迎关注公众号CV技术指南,专注于计算机视觉的技术总结、最新......
  • 关于微信小程序VM22:2 (in promise) MiniProgramError {“errMsg“:“hideLoading:fai
    参考地址:https://blog.csdn.net/qq_41227106/article/details/108465104 出现错误的原因如下1、是微信小程序2、把请求接口统一封装,开始请求接口时showLoading,请求接口后hideLoading3、一个页面同时请求多个接口,由于请求是异步的,很有可能上一个开启了showLoading还没请求完......