Linux第55步_根文件系统第2步_测试使用busybox生成的根文件系统

news2024/11/29 4:46:19

测试使用busybox生成的根文件系统。测试内容较多,很杂。

1、修改“nfs-kernel-server”

1)、打开终端

输入“sudo vi /etc/default/nfs-kernel-server回车”,打开“nfs-kernel-server”文件。

输入密码“123456回车”

见下图:

2)、在最后面添加内容如下:

RPCNFSDOPTS="--nfs-version 2,3,4 --debug --syslog"

修改后,见下图:

3)、按“ESC键”,输入“:wq回车

输入“sudo /etc/init.d/nfs-kernel-server restart回车”,重启“nfs-kernel-server”

4)、在串口设置“bootargs”环境变量

连接串口通讯线,开启虚拟机,打开MobaXterm,给开饭上电,等待出现“Hit any key to stop autoboot”,按下“回车键

先要保证开发板能从网络启动,然后才能测试根文件系统”。

通过设置环境变量bootcmd的值,从网络启动linux系统

出现“STM32MP>”时输入setenv bootcmd 'tftp c2000000 uImage;tftp c4000000 stm32mp157d-atk.dtb;bootm c2000000 - c4000000',设置从网络启动linux系统

出现“STM32MP>”时输入: saveenv,保存bootcmd的值

出现“STM32MP>”时输入: boot,启动 Linux 系统

输入“setenv bootargs 'console=ttySTM0,115200 root=/dev/nfs nfsroot=192.168.2.180:/home/zgq/linux/nfs/rootfs,proto=tcp rw ip=192.168.2.178:192.168.2.180:192.168.2.1:255.255.255.0::eth0:off'

回车

输入“saveenv回车

输入“boot回车

解释:

bootargs”环境变量

console=ttySTM0,115200”表示串口波特率为115200

192.168.2.180”为虚拟机IP地址

/home/zgq/linux/nfs/rootfs”为根文件系统存放路径

proto=tcp”表示使用TCP协议

rw”表示nfs挂载的根文件系统可读可写

192.168.2.178”为开发板IP地址

192.168.2.1”为网关地址

255.255.255.0”为子网掩码

eth0”为设备名/网卡名

off”不使用自动配置

举例:

setenv bootargs 'console=ttySTM0,115200 root=/dev/nfs nfsroot=192.168.2.180:/home/zgq/linux/nfs/rootfs,proto=tcp rw ip=192.168.2.178:192.168.2.180:192.168.2.1:255.255.255.0::eth0:off'

5)、串口输出结果:

Hit any key to stop autoboot:  0

STM32MP> setenv bootargs 'console=ttySTM0,115200 root=/dev/nfs nfsroot=192.168.2.180:/home/zgq/linux/nfs/rootfs,proto=tcp rw ip=192.168.2.178:192.168.2.180:192.168.2.1:255.255.255.0::eth0:off'

STM32MP> saveenv

Saving Environment to MMC... Writing to redundant MMC(1)... OK

STM32MP> boot

ethernet@5800a000 Waiting for PHY auto negotiation to complete.... done

Using ethernet@5800a000 device

TFTP from server 192.168.2.180; our IP address is 192.168.2.178

Filename 'uImage'.

Load address: 0xc2000000

Loading: #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #######################T #####################

         682.6 KiB/s

done

Bytes transferred = 7312152 (6f9318 hex)

Using ethernet@5800a000 device

TFTP from server 192.168.2.180; our IP address is 192.168.2.178

Filename 'stm32mp157d-atk.dtb'.

Load address: 0xc4000000

Loading: #####

         989.3 KiB/s

done

Bytes transferred = 63833 (f959 hex)

## Booting kernel from Legacy Image at c2000000 ...

   Image Name:   Linux-5.4.31

   Created:      2024-02-12   6:18:02 UTC

   Image Type:   ARM Linux Kernel Image (uncompressed)

   Data Size:    7312088 Bytes = 7 MiB

   Load Address: c2000040

   Entry Point:  c2000040

   Verifying Checksum ... OK

## Flattened Device Tree blob at c4000000

   Booting using the fdt blob at 0xc4000000

   XIP Kernel Image

   Loading Device Tree to cffed000, end cffff958 ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0

Linux version 5.4.31 (zgq@zgq-virtual-machine) (gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10))) #4 SMP PREEMPT Mon Feb 12 14:17:47 CST 2024

CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d

CPU: div instructions available: patching division code

CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache

OF: fdt: Machine model: STMicroelectronics STM32MP157D eval daughter

Memory policy: Data cache writealloc

Reserved memory: created DMA memory pool at 0x10000000, size 0 MiB

OF: reserved mem: initialized node mcuram2@10000000, compatible id shared-dma-pool

Reserved memory: created DMA memory pool at 0x10040000, size 0 MiB

OF: reserved mem: initialized node vdev0vring0@10040000, compatible id shared-dma-pool

Reserved memory: created DMA memory pool at 0x10041000, size 0 MiB

OF: reserved mem: initialized node vdev0vring1@10041000, compatible id shared-dma-pool

Reserved memory: created DMA memory pool at 0x10042000, size 0 MiB

OF: reserved mem: initialized node vdev0buffer@10042000, compatible id shared-dma-pool

Reserved memory: created DMA memory pool at 0x30000000, size 0 MiB

OF: reserved mem: initialized node mcuram@30000000, compatible id shared-dma-pool

Reserved memory: created DMA memory pool at 0x38000000, size 0 MiB

OF: reserved mem: initialized node retram@38000000, compatible id shared-dma-pool

cma: Reserved 128 MiB at 0xe8000000

psci: probing for conduit method from DT.

psci: PSCIv1.1 detected in firmware.

psci: Using standard PSCI v0.2 function IDs

psci: MIGRATE_INFO_TYPE not supported.

psci: SMC Calling Convention v1.0

percpu: Embedded 20 pages/cpu s50124 r8192 d23604 u81920

Built 1 zonelists, mobility grouping on.  Total pages: 227647

Kernel command line: console=ttySTM0,115200 root=/dev/nfs nfsroot=192.168.2.180:/home/zgq/linux/nfs/rootfs,proto=tcp rw ip=192.168.2.178:192.168.2.180:192.168.2.1:255.255.255.0::eth0:off

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: 759396K/917500K available (11264K kernel code, 869K rwdata, 3408K rodata, 1024K init, 213K bss, 27032K reserved, 131072K cma-reserved, 131068K highmem)

SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1

rcu: Preemptible hierarchical RCU implementation.

rcu:    RCU event tracing is enabled.

        Tasks RCU enabled.

rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.

NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16

random: get_random_bytes called from start_kernel+0x31c/0x4f4 with crng_init=0

arch_timer: cp15 timer(s) running at 24.00MHz (virt).

clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns

sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns

Switching to timer-based delay loop, resolution 41ns

Console: colour dummy device 80x30

Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)

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

/cpus/cpu@0 missing clock-frequency property

/cpus/cpu@1 missing clock-frequency property

CPU0: thread -1, cpu 0, socket 0, mpidr 80000000

Setting up static identity map for 0xc0100000 - 0xc0100060

rcu: Hierarchical SRCU implementation.

smp: Bringing up secondary CPUs ...

CPU1: thread -1, cpu 1, socket 0, mpidr 80000001

smp: Brought up 1 node, 2 CPUs

SMP: Total of 2 processors activated (96.00 BogoMIPS).

CPU: All CPU(s) started in SVC mode.

devtmpfs: initialized

VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5

clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns

futex hash table entries: 512 (order: 3, 32768 bytes, linear)

pinctrl core: initialized pinctrl subsystem

NET: Registered protocol family 16

DMA: preallocated 256 KiB pool for atomic coherent allocations

hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.

hw-breakpoint: maximum watchpoint size is 8 bytes.

Serial: AMBA PL011 UART driver

stm32-pm-domain pm_domain: domain core-ret-power-domain registered

stm32-pm-domain pm_domain: subdomain core-power-domain registered

stm32-pm-domain pm_domain: domains probed

reg-fixed-voltage buck1: Fixed regulator specified with variable voltages

reg-fixed-voltage: probe of buck1 failed with error -22

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

EDAC MC: Ver: 3.0.0

Advanced Linux Sound Architecture Driver Initialized.

clocksource: Switched to clocksource arch_sys_counter

thermal_sys: Registered thermal governor 'step_wise'

NET: Registered protocol family 2

tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 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 protocol family 1

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.

hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available

Initialise system trusted keyrings

workingset: timestamp_bits=14 max_order=18 bucket_order=4

squashfs: version 4.0 (2009/01/31) Phillip Lougher

NFS: Registering the id_resolver key type

Key type id_resolver registered

Key type id_legacy registered

ntfs: driver 2.1.32 [Flags: R/O].

jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.

fuse: init (API version 7.31)

NET: Registered protocol family 38

Key type asymmetric registered

Asymmetric key parser 'x509' registered

bounce: pool size: 64 pages

Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)

io scheduler mq-deadline registered

io scheduler kyber registered

STM32 USART driver initialized

brd: module loaded

loop: module loaded

libphy: Fixed MDIO Bus: probed

CAN device driver interface

pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver

usbcore: registered new interface driver pegasus

usbcore: registered new interface driver asix

usbcore: registered new interface driver ax88179_178a

usbcore: registered new interface driver cdc_ether

usbcore: registered new interface driver smsc75xx

usbcore: registered new interface driver smsc95xx

usbcore: registered new interface driver net1080

usbcore: registered new interface driver cdc_subset

usbcore: registered new interface driver zaurus

usbcore: registered new interface driver cdc_ncm

ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

ehci-platform: EHCI generic platform driver

ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

ohci-platform: OHCI generic platform driver

usbcore: registered new interface driver cdc_acm

cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

usbcore: registered new interface driver usb-storage

i2c /dev entries driver

stm32-cpufreq stm32-cpufreq: Failed to get chip info: -517

sdhci: Secure Digital Host Controller Interface driver

sdhci: Copyright(c) Pierre Ossman

Synopsys Designware Multimedia Card Interface Driver

sdhci-pltfm: SDHCI platform and OF driver helper

ledtrig-cpu: registered to indicate activity on CPUs

usbcore: registered new interface driver usbhid

usbhid: USB HID core driver

arm-smc-mbox mailbox-0: ARM SMC mailbox enabled.

arm-smc-mbox mailbox-1: ARM SMC mailbox enabled.

Unable to get STM32 DDR PMU clock

drop_monitor: Initializing network drop monitor service

NET: Registered protocol family 17

can: controller area network core (rev 20170425 abi 9)

NET: Registered protocol family 29

can: raw protocol (rev 20170425)

can: broadcast manager protocol (rev 20170425 t)

can: netlink gateway (rev 20190810) max_hops=1

Key type dns_resolver registered

ThumbEE CPU extension supported.

Registering SWP/SWPB emulation handler

registered taskstats version 1

Loading compiled-in X.509 certificates

arm-scmi firmware:scmi-0: SCMI Protocol v2.0 'ST:' Firmware version 0x0

Unable to get STM32 DDR PMU clock

debugfs: Directory 'cpu0' with parent 'opp' already present!

Unable to get STM32 DDR PMU clock

stm32-mdma 58000000.dma: STM32 MDMA driver registered

stm32-dma 48000000.dma: STM32 DMA driver registered

stm32-dma 48001000.dma: STM32 DMA driver registered

reg11: supplied by regulator-dummy

reg18: supplied by regulator-dummy

usb33: supplied by regulator-dummy

stm_thermal 50028000.thermal: stm_thermal_probe: Driver initialized successfully

debugfs: Directory 'cpu0' with parent 'opp' already present!

stm32-crc32 58009000.crc: Initialized

stm32-hash 54002000.hash: will run requests pump with realtime priority

random: fast init done

stm32-hash 54002000.hash: Init HASH done HW ver 23 DMA mode 1

stm32-ddr-pmu: probed (ID=0x00140061 VER=0x00000010), DDR@533MHz

random: crng init done

/soc/interrupt-controller@5000d000: bank0

/soc/interrupt-controller@5000d000: bank1

/soc/interrupt-controller@5000d000: bank2

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOA bank added

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOB bank added

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOC bank added

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOD bank added

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOE bank added

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOF bank added

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOG bank added

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOH bank added

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOI bank added

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOJ bank added

stm32mp157-pinctrl soc:pin-controller@50002000: GPIOK bank added

stm32mp157-pinctrl soc:pin-controller@50002000: Pinctrl STM32 initialized

stm32mp157-pinctrl soc:pin-controller-z@54004000: GPIOZ bank added

stm32mp157-pinctrl soc:pin-controller-z@54004000: Pinctrl STM32 initialized

stm32-usart 40010000.serial: interrupt mode for rx (no dma)

stm32-usart 40010000.serial: interrupt mode for tx (no dma)

40010000.serial: ttySTM0 at MMIO 0x40010000 (irq = 47, base_baud = 4000000) is a stm32-usart

printk: console [ttySTM0] enabled

stm32-dwmac 5800a000.ethernet: PTP uses main clock

stm32-dwmac 5800a000.ethernet: no reset control found

stm32-dwmac 5800a000.ethernet: No phy clock provided...

stm32-dwmac 5800a000.ethernet: User ID: 0x40, Synopsys ID: 0x42

stm32-dwmac 5800a000.ethernet:  DWMAC4/5

stm32-dwmac 5800a000.ethernet: DMA HW capability register supported

stm32-dwmac 5800a000.ethernet: RX Checksum Offload Engine supported

stm32-dwmac 5800a000.ethernet: TX Checksum insertion supported

stm32-dwmac 5800a000.ethernet: Wake-Up On Lan supported

stm32-dwmac 5800a000.ethernet: TSO supported

stm32-dwmac 5800a000.ethernet: Enable RX Mitigation via HW Watchdog Timer

stm32-dwmac 5800a000.ethernet: device MAC address 00:04:9f:04:d2:36

stm32-dwmac 5800a000.ethernet: TSO feature enabled

libphy: stmmac: probed

stm32_rtc 5c004000.rtc: registered as rtc0

stm32_rtc 5c004000.rtc: Date/Time must be initialized

stm32_rtc 5c004000.rtc: registered rev:1.2

mmci-pl18x 58005000.sdmmc: mmc0: PL180 manf 53 rev2 at 0x58005000 irq 43,0 (pio)

mmci-pl18x 58007000.sdmmc: mmc1: PL180 manf 53 rev2 at 0x58007000 irq 44,0 (pio)

mmc0: host does not support reading read-only switch, assuming write-enable

stm32-ipcc 4c001000.mailbox: ipcc rev:1.0 enabled, 6 chans, proc 0

mmc0: new high speed SDHC card at address 1234

stm32_rtc 5c004000.rtc: setting system clock to 2000-01-01T00:32:54 UTC (946686774)

stm32-dwmac 5800a000.ethernet eth0: PHY [stmmac-0:00] driver [YT8511 Gigabit Ethernet]

mmcblk0: mmc0:1234 SA16G 14.4 GiB

 mmcblk0: p1

dwmac4: Master AXI performs any burst length

stm32-dwmac 5800a000.ethernet eth0: No Safety Features support found

stm32-dwmac 5800a000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported

stm32-dwmac 5800a000.ethernet eth0: registered PTP clock

stm32-dwmac 5800a000.ethernet eth0: configuring for phy/rgmii-id link mode

mmc1: new high speed MMC card at address 0001

mmcblk1: mmc1:0001 8GTF4R 7.28 GiB

mmcblk1boot0: mmc1:0001 8GTF4R partition 1 4.00 MiB

mmcblk1boot1: mmc1:0001 8GTF4R partition 2 4.00 MiB

mmcblk1rpmb: mmc1:0001 8GTF4R partition 3 512 KiB, chardev (242:0)

 mmcblk1: p1 p2

stm32-dwmac 5800a000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx

IP-Config: Complete:

     device=eth0, hwaddr=00:04:9f:04:d2:36, ipaddr=192.168.2.178, mask=255.255.255.0, gw=192.168.2.1

     host=192.168.2.178, domain=, nis-domain=(none)

     bootserver=192.168.2.180, rootserver=192.168.2.180, rootpath=

ALSA device list:

  No soundcards found.

VFS: Mounted root (nfs filesystem) on device 0:16.

devtmpfs: mounted

Freeing unused kernel memory: 1024K

Run /sbin/init as init process

can't run '/etc/init.d/rcS': No such file or directory

Please press Enter to activate this console.

/ #

6)、在串口终端,输入“ls回车

串口可以执行“ls”命令

2、解决“can't run '/etc/init.d/rcS': No such file or directory

rcS是个shell脚本,Linux内核启动以后需要启动一些服务,而rcS就是规定启动哪些文件的脚本文件。因此,需要在rootfs中创建“/etc/init.dhcS”文件。

1)、在串口终端,输入“ls回车

输入“cd etc/回车”,切换得到“etc”目录

输入“ls回车”, 查询“etc”目录下的文件和文件夹

输入“mkdir init.d回车”,创建“init.d”目录

输入“ls回车”, 查询“etc”目录下的文件和文件夹

输入“cd init.d/回车”,切换得到“init.d”目录

2)、输入“vi rcS回车”,创建“rcS”文件

#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/usr/lib

export PATH LD_LIBRARY_PATH

mount -a

mkdir /dev/pts

mount -t devpts devpts /dev/pts

echo /sbin/mdev > /proc/sys/kernel/hotplug

3)、按“ESC键”,输入“:wq回车”,保存退出

4)、输入“chmod 777 rcS回车”,给rcS赋可执行权限

输入“ls回车”, 查询“init.d”目录下的文件和文件夹

输入“reboot回车”,重启

运行结果:

stm32-dwmac 5800a000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx

IP-Config: Complete:

     device=eth0, hwaddr=00:04:9f:04:d2:36, ipaddr=192.168.2.178, mask=255.255.255.0, gw=192.168.2.1

     host=192.168.2.178, domain=, nis-domain=(none)

     bootserver=192.168.2.180, rootserver=192.168.2.180, rootpath=

ALSA device list:

  No soundcards found.

VFS: Mounted root (nfs filesystem) on device 0:16.

devtmpfs: mounted

Freeing unused kernel memory: 1024K

Run /sbin/init as init process

mount: can't read '/etc/fstab': No such file or directory

/etc/init.d/rcS: line 11: can't create /proc/sys/kernel/hotplug: nonexistent directory

Please press Enter to activate this console.

3、解决“mount: can't read '/etc/fstab': No such file or directory

1)、在串口终端,输入“ls回车

输入“cd etc/回车”,切换得到“etc”目录

输入“ls回车”, 查询“etc”目录下的文件和文件夹

输入“vi fstab回车”,创建“fstab”文件

2)、添加内容如下:

#<file system>  <mount point>   <type>  <options>       <dump>  <pass>

proc    /proc   proc    defaults        0       0

tmpfs   /tmp    tmpfs   defaults        0       0

sysfs   /sys    sysfs   defaults        0       0

3)、按“ESC键”,输入“:wq回车”,保存退出

输入“ls回车”, 查询“etc”目录下的文件和文件夹

输入“reboot回车”,重启

运行结果:

VFS: Mounted root (nfs filesystem) on device 0:16.

devtmpfs: mounted

Freeing unused kernel memory: 1024K

Run /sbin/init as init process

/etc/init.d/rcS: line 11: can't create /proc/sys/kernel/hotplug: nonexistent directory

Please press Enter to activate this console.

4、创建“/etc/inittab”

1)、在串口终端,输入“ls回车

输入“cd etc/回车”,切换得到“etc”目录

输入“ls回车”, 查询“etc”目录下的文件和文件夹

输入“vi inittab回车”,创建“inittab”文件

2)、添加内容如下:

#etc/inittab

::sysinit:/etc/init.d/rcS

#系统启动以后运行/etc/init.drcs 这个脚本文件

console::askfirst:-/bin/sh

#将console作为控制台终端,也就是 ttySTM0

::restart:/sbin/init

#重启的话运行/sbin/imit

::ctrlaltdel:/sbin/reboot

#按下ctrl+alt+del组合键就运行/sbinreboot,看来ctrl+alt+del组合键用于重启系统

::shutdown:/bin/umount -a -r

#关机的时候执行/bin/umount,也就是卸载各个文件系统

::shutdown:/sbin/swapoff -a

#关机的时候执行/sbin/swapof,也就是关闭交换分区

3)、按“ESC键”,输入“:wq回车”,保存退出

输入“ls回车”, 查询“etc”目录下的文件和文件夹

至此,根文件系统要创建的文件就已经全部完成了

5、使能内核uevet helper

1)、打开虚拟机终端

输入“ls回车

输入“cd linux/回车”,切换到“linux”目录

输入“ls回车”,列出“linux”目录下的文件和文件夹

输入“cd atk-mp1/回车”,切换到“atk-mp1”目录

输入“ls回车”,列出“atk-mp1”目录下的文件和文件夹

输入“cd linux/回车”,切换到“linux”目录

输入“ls回车”,列出“linux”目录下的文件和文件夹

输入“cd my_linux/回车”,切换到“my_linux”目录

输入“ls回车”,列出“my_linux”目录下的文件和文件夹

输入“cd linux-5.4.31/回车”,切换到“linux-5.4.31”目录

输入“ls回车”,列出“linux-5.4.31”目录下的文件和文件夹

输入“make menuconfig回车”,打开linux的图形配置化界面

2)、移动向下光标键,找到“Device Drivers”

3)、按回车键,移动向下光标键,找到“Generic Driver Options”

4)、按回车键,移动向下光标键,找到“Support for uevent helper”,按“Y”

5)、按“ESC键”,直到出现下面的对话框

6)、按“Y”保存

输入“make menuconfig回车”,打开linux的图形配置化界面

移动向右光标键至“Save”

7)、按“回车键”

8)、删除“.config”,改为“./arch/arm/configs/stm32mp1_atk_defconfig

9)、移动向下光标键至“Ok”,按“O”保存

10)、按“ESC键”关闭对话框

由于设备树dtbs没有被修改,我们只需编译uImage

输入“make  uImage LOADADDR=0XC2000040 -j8回车

#编译镜像文件,linux内核在DDR中的加载地址为0XC2000040,-j8表示采用8线程编译

11)、输入“cp arch/arm/boot/uImage /home/zgq/linux/tftpboot/ -f回车”,执行文件拷贝;

12)、在串口输入“reboot回车”,重启

运行结果:

 mmcblk1: p1 p2

stm32-dwmac 5800a000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx

IP-Config: Complete:

     device=eth0, hwaddr=00:04:9f:04:d2:36, ipaddr=192.168.2.178, mask=255.255.255.0, gw=192.168.2.1

     host=192.168.2.178, domain=, nis-domain=(none)

     bootserver=192.168.2.180, rootserver=192.168.2.180, rootpath=

ALSA device list:

  No soundcards found.

VFS: Mounted root (nfs filesystem) on device 0:16.

devtmpfs: mounted

Freeing unused kernel memory: 1024K

Run /sbin/init as init process

Please press Enter to activate this console.

运行正确。

6、在根文件系统下创建“drivers”目录,将来编写的驱动就可以放到“drivers”目录中

在串口终端,输入“ls回车

输入“mkdir drivers回车”,创建“drivers”目录

输入“ls回车”,查询根目录下的文件和文件夹

7、软件运行测试

1)、输入“ls回车

输入“cd linux/回车”,切换到“linux”目录

输入“ls回车”,列出“linux”目录下的文件和文件夹

输入“cd nfs/回车”,切换到“nfs”目录

输入“ls回车”,列出“nfs”目录下的文件和文件夹

输入“vi hello.c回车”,创建hello.c

2)、输入内容如下:

#include <stdio.h>

int main(void)

{

        while(1) {

                printf("hello world!\r\n"); //串口输出“hello world!”

                sleep(2); //延时2妙

        }

        return 0;

}

3)、按“ESC键”,输入“:wq”保存退出

输入“arm-none-linux-gnueabihf-gcc hello.c -o hello回车”,使用交叉编译“hello.c”

输入“file hello回车”,查看hello的文件类型以及编码格式

输入“sudo cp hello /home/zgq/linux/nfs/rootfs/drivers/回车”,将“hello”拷贝到“/home/zgq/linux/nfs/rootfs/drivers/”目录中

输入“ls回车”,列出“linux”目录下的文件和文件夹

输入“cd rootfs/回车”,切换到“rootfs”目录

输入“ls回车”,列出“rootfs”目录下的文件和文件夹

输入“cd drivers/回车”,切换到“drivers”目录

输入“ls回车”,列出“drivers”目录下的文件和文件夹

4)、在串口终端输入“cd drivers/回车

输入“ls/回车

输入“./hello回车

得到下面的界面

5)、按“CTRL+C”暂停

输入“./hello &回车”将“hello”放到后台执行

6)、关闭后台运行,输入“ps回车”查看“hello”的ID

7)、输入“kill -9 154回车”,就可以删除“hello运行”

8)、再次输入“ps回车”查看“hello”是不是没有了

8、中文字符测试

1)、输入“cd ..回车”,返回到“/linux/nfs/rootfs”目录下

输入“mkdir 中文测试”,创建“中文测试目录”

输入“ls回车

输入“cd 中文测试

输入“vi 中文测试.txt”,这个中文文档只能建在中文目录下

输入内容如下:

这是中文测试文档

测试时间:2024年2月14

按“ESC键”,输入“:wq回车”,保存

2)、在串口终端

输入“ls”

输入“cd 中文测试”
输入“ls”

输入“cat  中文测试.txt”

9、开机自动启动hello程序

1)、输入“cd 中文测试..

输入“ls

输入“cd etc/

输入“ls

输入“cd init.d/

输入“ls

输入“vi rsS

添加内容如下:

cd /drivers

./hello &

cd /

2)、输入“reboot”重启

3)、测试正确后,先停止hello程序,然后打开“etc/init.d/rcS”修改如下图:

4)、按“ESC键”,输入“:wq回车”,保存

10、使用ping命令测试外网连接

1)、在rootfs中新建文件/etc/resolv.conf,然后在里面输入如下内容:

输入“ls

输入“cd etc/

输入“ls

输入“vi resolv.conf”

2)、输入内容如下:

meserver 114.114.114.114

nameserver 192.168.2.1

3)、按“ESC键”,输入“:wq回车”,保存

输入“reboot”,重启

输入“ping www.baidu.com”

执行结果如下:

至此,“根文件系统”制作完成了

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1450260.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

模拟电子技术——基本放大电路

文章目录 前言一、三极管输入输出特性三极管放大作用三极管电流放大关系三极管的特性曲线 二、基本放大电路-电路结构与工作原理基本放大电路的构成基本放大电路放大原理三种基本放大电路比较 三、基本放大电路静态工作点什么是静态工作点&#xff1f;静态工作点的作用估算法分…

OpenCV Mat实例详解 一

OpenCV中的Mat是一个类&#xff0c;它用存储图像信息。由两部分数据组成&#xff1a;矩阵头和像素值矩阵。矩阵头包含矩阵尺寸、存储方法、存储地址等信息&#xff0c;而像素值矩阵则存储实际的像素值数据。 Mat类在OpenCV中有十分重要的作用&#xff0c;图像信息的载入、保存、…

2024 CKS 题库 | 6、创建 Secret

不等更新题库 CKS 题库 6、创建 Secret Task 在 namespace istio-system 中获取名为 db1-test 的现有 secret 的内容 将 username 字段存储在名为 /cks/sec/user.txt 的文件中&#xff0c;并将password 字段存储在名为 /cks/sec/pass.txt 的文件中。 注意&#xff1a;你必须创…

ubuntu22.04@laptop OpenCV Get Started: 009_image_thresholding

ubuntu22.04laptop OpenCV Get Started: 009_image_thresholding 1. 源由2. image_thresholding应用Demo2.1 C应用Demo2.2 Python应用Demo 3. 重点分析3.1 Binary Thresholding ( THRESH_BINARY )3.2 Inverse-Binary Thresholding ( THRESH_BINARY_INV )3.3 Truncate Threshold…

【AIGC】Stable Diffusion的采样器入门

在 Stable Diffusion 中&#xff0c;采样器&#xff08;Sampler&#xff09;是指用于生成图像的一种技术或方法&#xff0c;它决定了模型如何从潜在空间中抽样并生成图像。采样器在生成图像的过程中起着重要作用&#xff0c;影响着生成图像的多样性、质量和创造性。以下是对 St…

WebStorm | 如何修改webstorm中新建html文件默认生成模板中title的初始值

在近期的JS的学习中&#xff0c;使用webstorm&#xff0c;总是要先新建一个html文件&#xff0c;然后再到里面书写<script>标签&#xff0c;真是麻烦&#xff0c;而且标题也是默认的title&#xff0c;想改成文件名还总是需要手动去改 经过小小的研究&#xff0c;找到了修…

问题:如果要编辑建好的建筑和空间,需要在分级按钮( )和细分操作按钮楼层下,才能选中建筑物和空间; #微信#媒体#其他

问题&#xff1a;如果要编辑建好的建筑和空间&#xff0c;需要在分级按钮&#xff08; &#xff09;和细分操作按钮楼层下&#xff0c;才能选中建筑物和空间&#xff1b; A、楼层 B、规划图 C、全景 D、建筑物 参考答案如图所示

【单总线与DS18B20总结和代码实现】

单总线介绍与总结 单总线介绍单总线时序图DS18B20的操作流程代码 读温度代码思路代码实现 单总线介绍 单总线应用案例&#xff1a;Ds18B20、温湿度传感器用到的就是这个&#xff0c;这里Ds18B20从当的角色是从机部分&#xff0c;而开发板充当的部分人是主机部分。 Ds18B20内部结…

红队打靶练习:HACK ME PLEASE: 1

信息收集 1、arp ┌──(root㉿ru)-[~/kali] └─# arp-scan -l Interface: eth0, type: EN10MB, MAC: 00:0c:29:69:c7:bf, IPv4: 192.168.61.128 Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan) 192.168.61.2 00:50:56:f0:df:20 …

ubuntu22.04@laptop OpenCV Get Started: 010_blob_detection

ubuntu22.04laptop OpenCV Get Started: 010_blob_detection 1. 源由2. blob应用Demo2.1 C应用Demo2.2 Python应用Demo 3. 重点分析3.1 Threshold3.2 Area3.3 Circularity3.4 Convexity3.5 Inertia Ratio 4. 总结5. 参考资料6. 补充 1. 源由 Blob是图像中的一组连接像素&#…

Git 初学

目录 一、需求的产生 二、版本控制系统理解 1. 认识版本控制系统 2. 版本控制系统分类 &#xff08;1&#xff09;集中式版本控制系统 缺点&#xff1a; &#xff08;2&#xff09;分布式版本控制系统 三、初识 git 四、git 的使用 例&#xff1a;将 “ OLED文件夹 ”…

STM32物联网(ESP-01S模块及STM32和ESP-01S通信方式介绍)

文章目录 前言一、ESP-01S模块介绍二、STM32和ESP-01S通信方式介绍三、什么是AT指令四、创建基础工程总结 前言 本篇文章我们开始正式进入STM32物联网的专栏&#xff0c;在这个专栏中将会带大家学习使用STM32进行联网&#xff0c;联网模块的话主要就是使用到了ESP-01S WIFI模块…

嵌入式STM32 单片机 GPIO 的工作原理详解

STM32的 GPIO 介绍 GPIO 是通用输入/输出端口的简称&#xff0c;是 STM32 可控制的引脚。GPIO 的引脚与外部硬件设备连接&#xff0c;可实现与外部通讯、控制外部硬件或者采集外部硬件数据的功能。 以 STM32F103ZET6 芯片为例子&#xff0c;该芯片共有 144 脚芯片&#xff0c…

[word] word技巧分享_word自动编号的标题 #知识分享#知识分享#其他

word技巧分享_word自动编号的标题 日常办公&#xff0c;我们时时都在使用 word 软件。 word 软件内容的组织是通过一节一节的标题进行的。 我们常常需要处理的是下图一样的章节目录

计算机设计大赛 深度学习OCR中文识别 - opencv python

文章目录 0 前言1 课题背景2 实现效果3 文本区域检测网络-CTPN4 文本识别网络-CRNN5 最后 0 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 &#x1f6a9; **基于深度学习OCR中文识别系统 ** 该项目较为新颖&#xff0c;适合作为竞赛课题方向&#xff0c;…

挑战杯 python图像检索系统设计与实现

0 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 &#x1f6a9; python图像检索系统设计与实现 &#x1f947;学长这里给一个题目综合评分(每项满分5分) 难度系数&#xff1a;3分工作量&#xff1a;3分创新点&#xff1a;4分 该项目较为新颖&#xff0c…

【C深度解剖】取模与取余

简介&#xff1a;本系列博客为C深度解剖系列内容&#xff0c;以某个点为中心进行相关详细拓展 适宜人群&#xff1a;已大体了解C语法同学 作者留言&#xff1a;本博客相关内容如需转载请注明出处&#xff0c;本人学疏才浅&#xff0c;难免存在些许错误&#xff0c;望留言指正 作…

AJAX——接口文档

1 接口文档 接口文档&#xff1a;描述接口的文章 接口&#xff1a;使用AJAX和服务器通讯时&#xff0c;使用的URL&#xff0c;请求方法&#xff0c;以及参数 传送门&#xff1a;AJAX阶段接口文档 <!DOCTYPE html> <html lang"en"><head><meta c…

【论文精读】GPT2

摘要 在单一领域数据集上训练单一任务的模型是当前系统普遍缺乏泛化能力的主要原因&#xff0c;要想使用当前的架构构建出稳健的系统&#xff0c;可能需要多任务学习。但多任务需要多数据集&#xff0c;而继续扩大数据集和目标设计的规模是个难以处理的问题&#xff0c;所以只能…

【AIGC】Stable Diffusion的ControlNet参数入门

Stable Diffusion 中的 ControlNet 是一种用于控制图像生成过程的技术&#xff0c;它可以指导模型生成特定风格、内容或属性的图像。下面是关于 ControlNet 的界面参数的详细解释&#xff1a; 低显存模式 是一种在深度学习任务中用于处理显存受限设备的技术。在这种模式下&am…