裁剪openEuler 24.03根文件系统适应ramdisk模式
ramdisk, yocto, openeuler
·
----------原创不易,欢迎关注+点赞收藏。广交嵌入式开发的朋友,讨论技术或者合作-------------
嵌入式单板,虽然有硬盘,可以挂载很大(和PC一样)的根文件系统,但是如果不小心删掉或者修改掉一些重要配置文件,可能导致单板工作异常。可靠的做法是将其保存到数据可靠性更强,容量小一点的nor flash上。采用ramdisk方式,也不担心root被修改,就算修改,系统复位后也恢复了。
硬件环境飞腾E2000Q
软件环境 openEuler 24.03 ,内核5.10
文件系统 yocto定制
修改内核配方,不用的很多软件,例如gdb、蓝牙、无线、调试工具等。最终将rootfs.ext4裁剪到110MB,通过gzpi压缩到30MB。
原始的rootfs.ext4文件如下图
通过gzip压缩后,得到29MB的压缩包,如下图
通过mkimg命令加个头,支持booti命令启动,如下图


booti命令支持gzip压缩格式的img镜像
E2000#booti 91000000 92000000 90000000
## Loading init Ramdisk from Legacy Image at 92000000 ...
Image Name: E2000ROOTFS
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 30695108 Bytes = 29.3 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 90000000
Booting using the fdt blob at 0x90000000
Loading Ramdisk to f6fd5000, end f8d1aec4 ... OK
Loading Device Tree to 00000000f6fca000, end 00000000f6fd4c37 ... OK
run in ft_board_setup
fdt_addr 00000000f6fca000
mb_count = 0x2
mb_blocks[0].mb_size = 0x7c000000
mb_blocks[1].mb_size = 0x80000000
fdt : dram size 0x100000000 update successfully
Starting kernel ...
[ 0.049703] printk: console [ttyAMA1] enabled
[ 0.054069] printk: bootconsole [pl11] disabled
[ 0.065000] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[ 0.071725] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
[ 0.078424] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[ 0.085114] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
[ 0.092969] cryptd: max_cpu_qlen set to 1000
[ 0.118480] ACPI: Interpreter disabled.
[ 0.122639] phytium-ddma 28003000.ddma: phytium DDMA Controller registered
[ 0.129790] phytium-ddma 28004000.ddma: phytium DDMA Controller registered
[ 0.137275] SCSI subsystem initialized
[ 0.141143] usbcore: registered new interface driver usbfs
[ 0.146634] usbcore: registered new interface driver hub
[ 0.151958] usbcore: registered new device driver usb
[ 0.157100] pps_core: LinuxPPS API ver. 1 registered
[ 0.162069] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.171198] PTP clock support registered
[ 0.175492] NetLabel: Initializing
[ 0.178885] NetLabel: domain hash size = 128
[ 0.183230] NetLabel: protocols = UNLABELED CIPSOv4 CALIPSO
[ 0.188917] NetLabel: unlabeled traffic allowed by default
[ 0.194639] clocksource: Switched to clocksource arch_sys_counter
[ 0.222418] VFS: Disk quotas dquot_6.6.0
[ 0.226376] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.233311] FS-Cache: Loaded
[ 0.240533] NET: Registered protocol family 2
[ 0.245062] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[ 0.253960] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
[ 0.262508] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[ 0.270477] TCP bind hash table entries: 32768 (order: 7, 524288 bytes, linear)
[ 0.278087] TCP: Hash tables configured (established 32768 bind 32768)
[ 0.284709] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
[ 0.291412] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
[ 0.298621] NET: Registered protocol family 1
[ 0.302981] PCI: CLS 0 bytes, default 64
[ 0.306969] Trying to unpack rootfs image as initramfs...
[ 0.312483] rootfs image is not initramfs (no cpio magic); looks like an initrd
[ 0.350821] Freeing initrd memory: 29972K
[ 0.355236] hw perfevents: enabled with armv8_pmuv3 PMU driver, 7 counters available
[ 0.365595] workingset: timestamp_bits=46 max_order=20 bucket_order=0
[ 0.376058] ntfs: driver 2.1.32 [Flags: R/O].
[ 0.380587] jffs2: version 2.2. (NAND) (SUMMARY) 漏 2001-2006 Red Hat, Inc.
[ 0.388121] fuse: init (API version 7.33)
[ 0.392493] NET: Registered protocol family 38
[ 0.396965] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)
[ 0.405910] gpio-phytium-platform 28034000.gpio: Phytium GPIO controller @0x0000000028034000 registered
[ 0.416366] gpio-phytium-platform 28035000.gpio: Phytium GPIO controller @0x0000000028035000 registered
[ 0.426784] gpio-phytium-platform 28036000.gpio: Phytium GPIO controller @0x0000000028036000 registered
[ 0.436382] gpio-phytium-platform 28037000.gpio: Phytium GPIO controller @0x0000000028037000 registered
[ 0.445927] gpio-phytium-platform 28038000.gpio: Phytium GPIO controller @0x0000000028038000 registered
[ 0.455463] gpio-phytium-platform 28039000.gpio: Phytium GPIO controller @0x0000000028039000 registered
[ 0.465000] pci-host-generic 40000000.pcie: host bridge /soc/pcie@40000000 ranges:
[ 0.472573] pci-host-generic 40000000.pcie: IO 0x0050000000..0x0050efffff -> 0x0000000000
[ 0.481281] pci-host-generic 40000000.pcie: MEM 0x0058000000..0x007fffffff -> 0x0058000000
[ 0.489976] pci-host-generic 40000000.pcie: MEM 0x1000000000..0x1fffffffff -> 0x1000000000
[ 0.498705] pci-host-generic 40000000.pcie: ECAM at [mem 0x40000000-0x4fffffff] for [bus 00-ff]
[ 0.507442] pci-host-generic 40000000.pcie: PCI host bridge to bus 0000:00
[ 0.514307] pci_bus 0000:00: root bus resource [bus 00-ff]
[ 0.519787] pci_bus 0000:00: root bus resource [io 0x0000-0xefffff]
[ 0.526139] pci_bus 0000:00: root bus resource [mem 0x58000000-0x7fffffff]
[ 0.533002] pci_bus 0000:00: root bus resource [mem 0x1000000000-0x1fffffffff]
[ 0.540229] pci 0000:00:00.0: [1db7:dc01] type 01 class 0x060400
[ 0.546233] pci 0000:00:00.0: reg 0x10: [mem 0x58000000-0x58000fff]
[ 0.552521] pci 0000:00:00.0: supports D1 D2
[ 0.556783] pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[ 0.563570] pci 0000:00:01.0: [1db7:dc01] type 01 class 0x060400
[ 0.569578] pci 0000:00:01.0: reg 0x10: [mem 0x1000000000-0x10000fffff 64bit pref]
[ 0.577165] pci 0000:00:01.0: supports D1 D2
[ 0.581424] pci 0000:00:01.0: PME# supported from D0 D1 D2 D3hot D3cold
[ 0.588151] pci 0000:00:02.0: [1db7:dc01] type 01 class 0x060400
[ 0.594153] pci 0000:00:02.0: reg 0x10: [mem 0x1000100000-0x10001fffff 64bit pref]
[ 0.601748] pci 0000:00:02.0: supports D1 D2
[ 0.606015] pci 0000:00:02.0: PME# supported from D0 D1 D2 D3hot D3cold
[ 0.613769] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[ 0.620933] pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 02
[ 0.627615] pci 0000:03:00.0: [0755:0755] type 00 class 0x058000
[ 0.633635] pci 0000:03:00.0: reg 0x10: [mem 0x00000000-0x000fffff]
[ 0.639905] pci 0000:03:00.0: reg 0x14: [mem 0x00000000-0x00ffffff]
[ 0.675196] pci_bus 0000:03: busn_res: [bus 03-ff] end is updated to 03
[ 0.681813] pci 0000:00:02.0: BAR 8: assigned [mem 0x58000000-0x597fffff]
[ 0.688596] pci 0000:00:00.0: BAR 8: assigned [mem 0x59800000-0x599fffff]
[ 0.695379] pci 0000:00:00.0: BAR 9: assigned [mem 0x1000000000-0x10001fffff 64bit pref]
[ 0.703458] pci 0000:00:01.0: BAR 0: assigned [mem 0x1000200000-0x10002fffff 64bit pref]
[ 0.711543] pci 0000:00:01.0: BAR 8: assigned [mem 0x59a00000-0x59bfffff]
[ 0.718324] pci 0000:00:01.0: BAR 9: assigned [mem 0x1000300000-0x10004fffff 64bit pref]
[ 0.726407] pci 0000:00:02.0: BAR 0: assigned [mem 0x1000500000-0x10005fffff 64bit pref]
[ 0.734489] pci 0000:00:02.0: BAR 9: assigned [mem 0x1000600000-0x10007fffff 64bit pref]
[ 0.742572] pci 0000:00:00.0: BAR 0: assigned [mem 0x59c00000-0x59c00fff]
[ 0.749352] pci 0000:00:00.0: BAR 7: assigned [io 0x1000-0x1fff]
[ 0.755439] pci 0000:00:01.0: BAR 7: assigned [io 0x2000-0x2fff]
[ 0.761521] pci 0000:00:02.0: BAR 7: assigned [io 0x3000-0x3fff]
[ 0.767608] pci 0000:00:00.0: PCI bridge to [bus 01]
[ 0.772562] pci 0000:00:00.0: bridge window [io 0x1000-0x1fff]
[ 0.778650] pci 0000:00:00.0: bridge window [mem 0x59800000-0x599fffff]
[ 0.785429] pci 0000:00:00.0: bridge window [mem 0x1000000000-0x10001fffff 64bit pref]
[ 0.793508] pci 0000:00:01.0: PCI bridge to [bus 02]
[ 0.798466] pci 0000:00:01.0: bridge window [io 0x2000-0x2fff]
[ 0.804548] pci 0000:00:01.0: bridge window [mem 0x59a00000-0x59bfffff]
[ 0.811328] pci 0000:00:01.0: bridge window [mem 0x1000300000-0x10004fffff 64bit pref]
[ 0.819412] pci 0000:03:00.0: BAR 1: assigned [mem 0x58000000-0x58ffffff]
[ 0.826198] pci 0000:03:00.0: BAR 0: assigned [mem 0x59000000-0x590fffff]
[ 0.832978] pci 0000:00:02.0: PCI bridge to [bus 03]
[ 0.837938] pci 0000:00:02.0: bridge window [io 0x3000-0x3fff]
[ 0.844022] pci 0000:00:02.0: bridge window [mem 0x58000000-0x597fffff]
[ 0.850804] pci 0000:00:02.0: bridge window [mem 0x1000600000-0x10007fffff 64bit pref]
[ 0.859051] pcieport 0000:00:00.0: PME: Signaling with IRQ 106
[ 0.865038] pcieport 0000:00:00.0: AER: enabled with IRQ 106
[ 0.870899] pcieport 0000:00:01.0: PME: Signaling with IRQ 107
[ 0.876848] pcieport 0000:00:01.0: AER: enabled with IRQ 107
[ 0.882724] pcieport 0000:00:02.0: PME: Signaling with IRQ 108
[ 0.888707] pcieport 0000:00:02.0: AER: enabled with IRQ 108
[ 0.896179] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 0.906083] brd: module loaded
[ 0.910907] loop: module loaded
[ 0.914674] ahci 31a40000.sata: supply ahci not found, using dummy regulator
[ 0.921777] ahci 31a40000.sata: supply phy not found, using dummy regulator
[ 0.928757] ahci 31a40000.sata: supply target not found, using dummy regulator
[ 0.936039] ahci 31a40000.sata: SSS flag set, parallel bus scan disabled
[ 0.942738] ahci 31a40000.sata: AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl platform mode
[ 0.951259] ahci 31a40000.sata: flags: 64bit ncq sntf stag pm led clo only pmp pio slum part ccc sadm sds apst
[ 0.961845] scsi host0: ahci
[ 0.964882] ata1: SATA max UDMA/133 mmio [mem 0x31a40000-0x31a40fff] port 0x100 irq 80
[ 0.973421] spi-nor spi0.0: gd55b01ge (131072 Kbytes)
[ 0.978619] 9 fixed-partitions partitions found on MTD device spi0.0
[ 0.984970] Creating 9 MTD partitions on "spi0.0":
[ 0.989751] 0x000000000000-0x000000280000 : "uboot"
[ 0.994773] 0x000000280000-0x000000290000 : "env"
[ 0.999579] 0x000000290000-0x0000002a0000 : "dtb"
[ 1.004381] 0x0000002a0000-0x0000002c0000 : "rom_arg"
[ 1.009603] 0x0000002c0000-0x0000002e0000 : "ram_arg"
[ 1.014758] 0x0000002e0000-0x000000300000 : "ram_back"
[ 1.020014] 0x000000300000-0x000000900000 : "kernel"
[ 1.025183] 0x000000900000-0x000002300000 : "rootfs"
[ 1.030250] 0x000002300000-0x000008000000 : "userfs"
[ 1.041677] macb 3200c000.ethernet eth0: Cadence GEM rev 0x000c010d at 0x3200c000 irq 81 (fa:16:11:11:11:11)
[ 1.060087] macb 32010000.ethernet eth1: Cadence GEM rev 0x400c010d at 0x32010000 irq 89 (00:00:24:dc:0f:1b)
[ 1.074705] macb 32012000.ethernet eth2: Cadence GEM rev 0x400c010d at 0x32012000 irq 93 (00:00:24:dc:0f:1c)
[ 1.084892] xhci-hcd 31a08000.usb3: xHCI Host Controller
[ 1.090201] xhci-hcd 31a08000.usb3: new USB bus registered, assigned bus number 1
[ 1.097792] xhci-hcd 31a08000.usb3: hcc params 0x08007f0d hci version 0x110 quirks 0x0000800000010090
[ 1.107031] xhci-hcd 31a08000.usb3: irq 79, io mem 0x31a08000
[ 1.112859] xhci-hcd 31a08000.usb3: xHCI Host Controller
[ 1.118170] xhci-hcd 31a08000.usb3: new USB bus registered, assigned bus number 2
[ 1.125650] xhci-hcd 31a08000.usb3: Host supports USB 3.1 Enhanced SuperSpeed
[ 1.132838] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.10
[ 1.141105] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.148335] usb usb1: Product: xHCI Host Controller
[ 1.153202] usb usb1: Manufacturer: Linux 5.10.0-openeuler xhci-hcd
[ 1.159465] usb usb1: SerialNumber: 31a08000.usb3
[ 1.164418] hub 1-0:1.0: USB hub found
[ 1.168186] hub 1-0:1.0: 1 port detected
[ 1.172257] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[ 1.180401] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.10
[ 1.188664] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.195921] usb usb2: Product: xHCI Host Controller
[ 1.200788] usb usb2: Manufacturer: Linux 5.10.0-openeuler xhci-hcd
[ 1.207065] usb usb2: SerialNumber: 31a08000.usb3
[ 1.211966] hub 2-0:1.0: USB hub found
[ 1.215733] hub 2-0:1.0: 1 port detected
[ 1.219874] usbcore: registered new interface driver usb-storage
[ 1.226066] phytium-otg 31800000.usb2: Phytium Host USB Driver
[ 1.231903] phytium-otg 31800000.usb2: new USB bus registered, assigned bus number 3
[ 1.239703] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.10
[ 1.247963] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.255217] usb usb3: Product: Phytium Host USB Driver
[ 1.260344] usb usb3: Manufacturer: Linux 5.10.0-openeuler phytium-hcd
[ 1.266865] usb usb3: SerialNumber: 31800000.usb2
[ 1.271745] hub 3-0:1.0: USB hub found
[ 1.275501] hub 3-0:1.0: 1 port detected
[ 1.279647] i2c /dev entries driver
[ 1.283868] NET: Registered protocol family 10
[ 1.288978] Segment Routing with IPv6
[ 1.292658] NET: Registered protocol family 17
[ 1.297154] 8021q: 802.1Q VLAN Support v1.8
[ 1.301351] Key type dns_resolver registered
[ 1.305810] registered taskstats version 1
[ 1.310705] clk: Disabling unused clocks
[ 1.314785] uart-pl011 2800d000.uart: no DMA platform data
[ 1.464648] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 1.472363] ata1.00: ATA-9: Lenovo SSD SL700 MSATA 128G, X0509A0, max UDMA/133
[ 1.479581] ata1.00: 250069680 sectors, multi 1: LBA48 NCQ (depth 32)
[ 1.488479] ata1.00: configured for UDMA/133
[ 1.493071] scsi 0:0:0:0: Direct-Access ATA Lenovo SSD SL700 9A0 PQ: 0 ANSI: 5
[ 1.501764] sd 0:0:0:0: [sda] 250069680 512-byte logical blocks: (128 GB/119 GiB)
[ 1.509279] sd 0:0:0:0: [sda] Write Protect is off
[ 1.514107] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 1.523986] sda: sda1
[ 1.526634] sd 0:0:0:0: [sda] Attached SCSI disk
[ 1.531334] RAMDISK: gzip image found at block 0
[ 2.516313] EXT4-fs (ram0): mounted filesystem with ordered data mode. Opts: (null)
[ 2.524031] VFS: Mounted root (ext4 filesystem) on device 1:0.
[ 2.530030] devtmpfs: mounted
[ 2.533176] Freeing unused kernel memory: 640K
[ 2.554761] Run /sbin/init as init process
starting pid 983, tty '': '/bin/mount -t proc proc /proc'
[ 2.569442] mount (983) used greatest stack depth: 11744 bytes left
starting pid 984, tty '': '/bin/mount -t sysfs sysfs /sys'
starting pid 985, tty '': '/bin/mount -t devtmpfs devtmpfs /dev'
mount: /dev: devtmpfs already mounted on /dev.
dmesg(1) may have more information after failed mount system call.
starting pid 986, tty '': '/bin/mount -o remount,rw /'
[ 2.634673] EXT4-fs (ram0): re-mounted. Opts: (null)
starting pid 987, tty '': '/bin/mkdir -p /dev/shm'
starting pid 988, tty '': '/bin/mkdir -p /dev/pts'
starting pid 989, tty '': '/bin/mount -a'
starting pid 990, tty '': '/sbin/swapon -a'
starting pid 996, tty '': '/etc/init.d/rcS'
Starting mdev... OK
[ 2.768843] exFAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
xargs: modprobe: No such file or directory
[ 2.864717] EXT4-fs (ram0): re-mounted. Opts: (null)
Fri Mar 9 12:34:56 UTC 2018
[ 3.040603] random: dd: uninitialized urandom read (512 bytes read)
ALSA: Restoring mixer settings...
Configuring packages on first boot....
(This may take several minutes. Please do not power off the machine.)
Running postinst /etc/rpm-postinsts/100-busybox-inittab...
update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
Removing any system startup links for run-postinsts ...
/etc/rcS.d/S99run-postinsts
Configuring network interfaces... [ 3.292867] ip (1324) used greatest stack depth: 10624 bytes left
udhcpc: started, v1.36.1
[ 3.328199] macb 3200c000.ethernet eth0: yt8521_config_init done, phy addr: 0, chip mode = 3, polling mode = 2
[ 3.338585] macb 3200c000.ethernet eth0: PHY [3200c000.ethernet-ffffffff:00] driver [YT8521 Ethernet] (irq=POLL)
[ 3.348766] macb 3200c000.ethernet eth0: configuring for phy/sgmii link mode
[ 3.357126] pps pps0: new PPS source ptp0
[ 3.361259] macb 3200c000.ethernet: gem-ptp-timer ptp clock registered.
[ 3.368562] ip (1337) used greatest stack depth: 10160 bytes left
udhcpc: broadcasting discover
udhcpc: broadcasting discover
[ 7.534926] macb 3200c000.ethernet eth0: yt8521_read_status, phy addr: 0, link up, media: UTP, mii reg 0x11 = 0xbc00
[ 7.545609] macb 3200c000.ethernet eth0: unable to generate target frequency: 125000000 Hz
[ 7.558673] macb 3200c000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[ 7.566357] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
udhcpc: broadcasting discover
udhcpc: broadcasting select for 10.8.80.11, server 10.8.80.254
udhcpc: lease of 10.8.80.11 obtained from 10.8.80.254, lease time 86400
/etc/udhcpc.d/50default: Adding DNS 211.162.66.66
done.
[ 9.373109] random: dbus-uuidgen: uninitialized urandom read (12 bytes read)
[ 9.380212] random: dbus-uuidgen: uninitialized urandom read (8 bytes read)
Starting system message bus: [ 9.391749] random: dbus-daemon: uninitialized urandom read (12 bytes read)
dbus.
Starting OpenBSD Secure Shell server: sshd
generating ssh RSA host key...
[ 14.234641] random: crng init done
[ 14.238036] random: 1 urandom warning(s) missed due to ratelimiting
generating ssh ECDSA host key...
generating ssh ED25519 host key...
done.
Starting advanced power management daemon: No APM support in kernel
(failed.)
Starting syslogd/klogd: done
Cleaning up tmp :
Setting up interface lo:
System booting cost:16.23 54.42
No makedumpfile found.
reloading /etc/inittab
star
openEuler Embedded(openEuler Embedded Reference Distro) 24.03-LTS phytium ttyAMA1
______ _
| ____| | |
___ ____ ___ _____| |__ _ _| | ___ _ __
/ _ \| _ \ / _ \ _ | __|| | | | |/ _ \ '__|
| (_) | |_) | __/ | | | |___| |_| | | __/ |
\___/| __/ \___|_| |_|______\____|_|\___|_|
| | _____ _ _ _ _
|_| | __|_____| |_ ___ _| |_| |___ _| |
| __| | . | -_| . | . | -_| . |
|_____|_|_|_|___|___|___|___|___|___|
Authorized uses only. All activity may be monitored and reported.
Modified by bull-man, 2025-08-11
鲲鹏昇腾开发者社区是面向全社会开放的“联接全球计算开发者,聚合华为+生态”的社区,内容涵盖鲲鹏、昇腾资源,帮助开发者快速获取所需的知识、经验、软件、工具、算力,支撑开发者易学、好用、成功,成为核心开发者。
更多推荐


所有评论(0)