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

测试使用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.mzph.cn/news/684564.shtml

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

相关文章

Filezilla:文件无法传输的问题

问题 解决方法 我发现我站点管理器原本设置的是FTP, 改成了SFTP就可以正常传输 FTP和SFTP 安全通道&#xff1a;FTP不提供安全通道&#xff0c;SFTP提供安全通道。 传输协议&#xff1a;FTP使用TCP/IP协议&#xff0c;SFTP是SSH协议的一部分。 最后由于SFTP使用了加密解密技…

【并发编程】AQS原理

&#x1f4dd;个人主页&#xff1a;五敷有你 &#x1f525;系列专栏&#xff1a;并发编程 ⛺️稳中求进&#xff0c;晒太阳 1. 概述 全称是 AbstractQueuedSynchronizer&#xff0c;是阻塞式锁和相关的同步器工具的框架 特点&#xff1a; 用 state 属性来表示资源的状…

用HTML Canvas和JavaScript创建美丽的花朵动画效果

目录 一、程序代码 二、代码原理 三、运行效果 一、程序代码 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>炫酷花朵</title><style>* {margin: 0;padding: 0;overflow: hidden;bac…

vue中mapState应用场景及代码示例

这篇文章我们讨论 Vue.js 中 mapState 的详细解释、应用场景、示例代码和使用优势。 mapState 详解&#xff1a; mapState 是 Vuex 中的一个辅助函数&#xff0c;用于将状态映射到组件的计算属性或 methods 中。它允许组件更方便地访问和使用 Vuex 存储中的状态。 通过 map…

H5 粒子特效引导页源码

H5 粒子特效引导页源码 源码介绍&#xff1a;一款粒子特效引导页源码&#xff0c;带彩色文字和4个按钮。 下载地址&#xff1a; https://www.changyouzuhao.cn/10222.html

红色警戒 3 修改游戏速度

原文&#xff1a;https://blog.iyatt.com/?p13852 红警 2 是有提供游戏速度修改的&#xff0c;红警 3 没有&#xff0c;而且游戏速度似乎和 FPS 关联的&#xff0c;在配置低一些的电脑上会变慢&#xff0c;FPS 也降低&#xff0c;我电脑上开最高画质 FPS 不超过 30&#xff0c…

抽象的问题1

vue3&#xff0c;在使用v-mode绑定属性时&#xff0c;发生了奇怪的问题&#xff0c;渲染失败了 代码如下 <template><div><form><div>账号<input v-model"form_user_Data.username" type"text"></div><div>密…

【Python--Web应用框架大比较】

&#x1f680; 作者 &#xff1a;“码上有前” &#x1f680; 文章简介 &#xff1a;Python &#x1f680; 欢迎小伙伴们 点赞&#x1f44d;、收藏⭐、留言&#x1f4ac; Django Django太重了&#xff0c;除了web框架&#xff0c;自带ORM和模板引擎&#xff0c;灵活和自由度不…

nba2k24 丁彦雨航面补

nba2k24 丁彦雨航面补 nba2k23-nba2k24通用 丁彦雨航面补 下载地址&#xff1a; https://www.changyouzuhao.cn/9528.html

free pascal:fpwebview 组件通过 JSBridge 调用本机TTS

从 https://github.com/PierceNg/fpwebview 下载 fpwebview-master.zip 简单易用。 先请看 \fpwebview-master\README.md cd \lazarus\projects\fpwebview-master\demo\js_bidir 学习 js_bidir.lpr &#xff0c;编写 js_bind_speak.lpr 如下&#xff0c;通过 JSBridge 调用本…

vue3 中使用pinia 数据状态管理(在Taro 京东移动端框架中的使用)

1.pinia 介绍 pinia 是 Vue 的存储库&#xff0c;它允许您跨组件/页面共享状态。就是和vuex一样的实现数据共享。 依据Pinia官方文档&#xff0c;Pinia是2019年由vue.js官方成员重新设计的新一代状态管理器&#xff0c;更替Vuex4成为Vuex5。 Pinia 目前也已经是 vue 官方正式的…

【自然语言处理】:实验1布置,Word2VecTranE的实现

清华大学驭风计划 因为篇幅原因实验答案分开上传&#xff0c;答案链接http://t.csdnimg.cn/5cyMG 如果需要详细的实验报告或者代码可以私聊博主 有任何疑问或者问题&#xff0c;也欢迎私信博主&#xff0c;大家可以相互讨论交流哟~~ 实验1&#xff1a; Word2Vec&TranE的…

模拟算法总结(Java)

目录 模拟算法概述 练习 练习1&#xff1a;替换所有的问号 练习2&#xff1a;提莫攻击 练习3&#xff1a;Z字形变换 模拟算法概述 模拟&#xff1a;根据题目要求的实现过程进行编程模拟&#xff0c;即题目要求什么就实现什么 解决这类题目&#xff0c;需要&#xff1a; 1…

猫头虎分享已解决Bug ‍ || Rust Error: the trait bound is not satisfied

博主猫头虎的技术世界 &#x1f31f; 欢迎来到猫头虎的博客 — 探索技术的无限可能&#xff01; 专栏链接&#xff1a; &#x1f517; 精选专栏&#xff1a; 《面试题大全》 — 面试准备的宝典&#xff01;《IDEA开发秘籍》 — 提升你的IDEA技能&#xff01;《100天精通鸿蒙》 …

C语言学习day15:数组定义的格式

数组的写法格式有很多种 int arr1[6] { 1,2,3,4,5,6 }; int arr[] { 1,2,3,4,5,6 }; int arr[10] { 1,2,3,4,5 }; int arr[10]; arr[0] 1; 这些都有差别 代码&#xff1a; int main() {//int arr1[6] { 1,2,3,4,5,6 };//int arr[] { 1,2,3,4,5,6 };//int arr[10]…

部门协作、沟通壁垒、上下级偏差……组织内部如何沟通?

工作中最常遇到的问题就是沟通。 如何能在最短的时间做到令对方明白您的目的&#xff1f; 彼此确认好双方的需求&#xff1f; 确保大家都明确任务最终想要达成的效果&#xff1f; 这需要极强的沟通和协作能力&#xff0c;而高效沟通几乎是现下每个团队的管理盲点。 团队沟通是…

(2024,DiS,扩散,状态空间主干,Mamba)具有状态空间主干的可扩展扩散模型

Scalable Diffusion Models with State Space Backbone 公和众和号&#xff1a;EDPJ&#xff08;进 Q 交流群&#xff1a;922230617 或加 VX&#xff1a;CV_EDPJ 进 V 交流群&#xff09; 目录 0. 摘要 2. 方法 2.1 基础 2.2 模型结构设计 3. 实验 0. 摘要 这篇论文提出…

超详细的介绍Python语句

一、 常用命令 在介绍Python语句之前&#xff0c;先介绍一下几个有用的Python命令。 dir(模块名或类名或变量名或表达式名)&#xff1a;获得当前模块、变量对应类型、表达式计算值对应类的属性列表 type&#xff08;变量名或表达式名&#xff09;:获取变量或表达式计算值的对…

Java学习第十四节之冒泡排序

冒泡排序 package array;import java.util.Arrays;//冒泡排序 //1.比较数组中&#xff0c;两个相邻的元素&#xff0c;如果第一个数比第二个数大&#xff0c;我们就交换他们的位置 //2.每一次比较&#xff0c;都会产生出一个最大&#xff0c;或者最小的数字 //3.下一轮则可以少…

进程状态

广义概念&#xff1a; 从广义上来讲&#xff0c;进程分为新建、运行、阻塞、挂起、退出五个状态&#xff0c;其中新建和退出两个状态可以直接理解字面意思。 运行状态&#xff1a; 这里涉及到运行队列的概念&#xff0c;CPU在读取数据的时候&#xff0c;需要把内存中的进程放入…