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”

执行结果如下:

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

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【学网攻】 第(28)节 -- OSPF虚链路

系列文章目录 目录 系列文章目录 文章目录 前言 一、什么是OSPF虚链路&#xff1f; 二、实验 1.引入 实验目标 实验背景 技术原理 实验步骤 实验设备 实验拓扑图 实验配置 扩展 实验拓扑图 实验配置 实验验证 文章目录 【学网攻】 第(1)节 -- 认识网络【学网攻…

模型 4S(满意、服务、速度、诚意)理论

系列文章 分享 模型&#xff0c;了解更多&#x1f449; 模型_总纲目录。重在提升认知。以客户为中心。 1 4S(满意、服务、速度、诚意)理论的应用 1.1 4S 理论在制造业中的应用 某汽车制造企业 A 一直致力于提供高品质的汽车产品和优质的服务&#xff0c;以满足客户的需求和期…

2022年12月电子学会青少年软件编程 中小学生Python编程等级考试二级真题解析(选择题)

2022年12月Python编程等级考试二级真题解析 选择题&#xff08;共25题&#xff0c;每题2分&#xff0c;共50分&#xff09; 1、运行下列程序&#xff0c;最终输出的结果是 info {1:小明,2:小黄,3:小兰} info[4]小红 info[2]小白 print(info) A、{1:小明,2:小白,3:小红,4:小…

高德地图上绘制热力图的方法

百度地图和高德地图的JavaScript API都提供了热力图的绘制方法&#xff0c;都是将热力图作为新的图层&#xff0c;叠加到地图上。但是百度地图的经纬度体系与我们的经纬度存在偏差&#xff0c;高德的与我们相符&#xff0c;应当使用高德地图JavaScript API。 因为是JavaScript…

最长连续手牌 - 华为OD统一考试

OD统一考试&#xff08;C卷&#xff09; 分值&#xff1a; 200分 题解&#xff1a; Java / Python / C 题目描述 有这么一款单人卡牌游戏&#xff0c;牌面由颜色和数字组成&#xff0c;颜色为红、黄、蓝、绿中的一种&#xff0c;数字为 0−9 中的一个。游戏开始时玩家从手牌中…

【题解】差分

差分其实就是前缀和的逆运算。 如果数组 A 是数组 B 的前缀和数组&#xff0c;则称 B 是 A 的差分数组。 思路 由题意得&#xff0c;应该求给定数组的差分数组。 差分加速的原理 对 L 到 R 区间内的数加上 c&#xff0c;时间复杂度是O(c) &#xff0c;即O(n) 。 但是如果…

SORA:OpenAI最新文本驱动视频生成大模型技术报告解读

Video generation models as world simulators&#xff1a;作为世界模拟器的视频生成模型 1、概览2、Turning visual data into patches&#xff1a;将视觉数据转换为补丁3、Video compression network&#xff1a;视频压缩网络4、Spacetime Latent Patches&#xff1a;时空潜在…

NetMizer 日志管理系统 多处前台RCE漏洞复现

0x01 产品简介 NetMizer是提供集成应用交付和应用安全解决方案以实现业务智能网络的优秀全球供应商,为全球企业和运营商提供确保关键业务应用的全面可用性、高性能和完善的安全性的解决方案。 0x02 漏洞概述 NetMizer 日志管理系统position.php、hostdelay.php、等接口处存在…

leetcode刷题--贪心算法

七. 贪心算法 文章目录 七. 贪心算法1. 605 种花问题2. 121 买卖股票的最佳时机3. 561 数组拆分4. 455 分发饼干5. 575 分糖果6. 135 分发糖果7. 409 最长回文串8. 621 任务调度器9. 179 最大数10. 56 合并区间11. 57 插入区间13. 452 用最少数量的箭引爆气球14. 435 无重叠区间…

鸿蒙系统优缺点,能否作为开发者选择

凡是都有对立面&#xff0c;就直接说说鸿蒙的优缺点吧。 鸿蒙的缺点&#xff1a; 鸿蒙是从2019年开始做出来的&#xff0c;那时候是套壳Android大家都知晓。从而导致大家不看鸿蒙系统&#xff0c;套壳Android就是多次一举。现在鸿蒙星河版已经是纯血鸿蒙&#xff0c;但是它的…

树莓派5 EEPROM引导加载程序恢复镜像

树莓派5不能正常启动&#xff0c;可以通过电源led灯的闪码来判断错误发生的大致情形。 LED警告闪码 如果树莓派由于某种原因无法启动&#xff0c;或者不得不关闭&#xff0c;在许多情况下&#xff0c;LED会闪烁特定的次数来指示发生了什么。LED会闪烁几次长闪烁&#xff0c;然…

02 c++入门

目录 c关键字命名空间c输入&输出缺省参数函数重载引用内联函数auto关键字(c11)基于范围的for循环(c11)指针空值—nullptr(c11) 0. 本节知识点安排目的 c是在c的基础上&#xff0c;容纳进去了面向对象编程思想&#xff0c;并增加了许多有用的库&#xff0c;以及编程范式等…

【HTML】过年不能放烟花,那就放电子烟花

闲谈 大家回家过年可能都多多少少放过些&#x1f9e8;&#xff0c;但是有些在城市上过年的小伙伴可能就没有机会放鞭炮了。不过没关系&#xff0c;我们懂技术&#xff0c;我们用技术自娱自乐&#xff0c;放电子烟花&#xff0c;总不可能被警长叔叔敲门问候吧。 开干 首先&…

【Linux】初步使用makefile

makefile 1 快速使用1.1 认识makefile1.2 使用makefile 2 深入理解理解 **依赖关系 与 依赖方法**如何实现源代码修改了才会重新编译 3 内置符号理解Thanks♪(&#xff65;ω&#xff65;)&#xff89;谢谢阅读&#xff01;&#xff01;&#xff01;下一篇文章见&#xff01;&a…

C语言程序设计(第四版)—习题7程序设计题

目录 1.选择法排序。 2.求一批整数中出现最多的数字。 3.判断上三角矩阵。 4.求矩阵各行元素之和。 5.求鞍点。 6.统计大写辅音字母。 7.字符串替换。 8.字符串转换成十进制整数。 1.选择法排序。 输入一个正整数n&#xff08;1&#xff1c;n≤10&#xff09;&#xf…

【学习心得】Python好库推荐——captcha

Captcha的全称是"Completely Automated Public Turing test to tell Computers and Humans Apart",完全自动化的图灵测试,用于区分计算机和人类。说直白点就是验证码&#xff0c;验证你是人而不是爬虫。 Captcha的原理就是利用计算机目前还无法进行实时视觉辨识和字符…

情人节到了,写一份爱心程序(python)

前言 情人节到了&#xff0c;写一份爱心代码给喜欢的人呀 公式 首先我们介绍下爱心的公式的参数方程&#xff1a; x 16 s i n 3 ( t ) x 16sin^3(t) x16sin3(t) y 13 c o s ( t ) − 5 c o s ( 2 t ) − 2 c o s ( 3 t ) − c o s ( 4 t ) y 13cos(t) - 5cos(2t) - 2co…

linux学习进程控制【创建-终止-等待】

目录 1.进程创建 1.1fork函数 1.2写时拷贝 2.进程终止 2.1进程退出场景 2.2进程退出方式 3.进程等待 3.1进程等待的必要性 3.2等待方式 3.2.1wait&#xff08;&#xff09; 3.2.2waitpid&#xff08;&#xff09; 3.3轮训等待 总结&#xff1a; 1.进程创建 …

新火种AI|2024,得AI芯片者得天下。

作者&#xff1a;小岩 编辑&#xff1a;彩云 北京时间2月11日&#xff0c;国内阖家团圆的大年初二&#xff0c;OpenAI创始人Sam Altman通过社交平台向外界宣布了一件重大事项&#xff1a;OpenAI 即将启动“造芯计划”&#xff0c;他还并表示&#xff0c;“建设大规模的 AI 基…

数据类型与变量

目录 作业回顾 有关JDK, JRE, JVM三者&#xff1a; 判断题 新课学习 字面常量 数据类型 变量 整型变量 长整型变量 短整型变量 字节型变量 浮点型变量 字符型变量 布尔型变量 类型转换 自动类型转换&#xff08;隐式&#xff09; 强制类型转换&#xff08;显式…