如何把文件系统烧到EMMC并从EMMC加载

之前文章介绍了如何下载并从sd卡加载文件系统,提到过可以从emmc引导系统,本篇将为您介绍如何把文件系统烧到emmc,并从emmc加载。
接之前操作,系统已经从sd卡正常启动(本文方案需要借助sd卡):
version: 3.0.3 
smarc-rzg2l login: root 
last login: sun sep 20 1003 utc 2020
root@smarc-rzg2l:~#
已经可以接上网线,并借助网路(如ssh服务)把相关文件拷贝到sd卡,为后边做准备。
需要的文件如下:
root@smarc-rzg2l:~# ls
image-r9a07g044l2-smarc.dtb image-smarc-rzg2l.bin core-image-qt-smarc-rzg2l.tar.bz2  
emmc创建分区:
左右滑动查看完整内容
root@smarc-rzg2l:~# fdisk /dev/mmcblk0welcome to fdisk (util-linux 2.35.1).changes will remain in memory only, until you decide to write them.be careful before using the write command.command (m for help): ocreated a new dos disklabel with disk identifier 0xf23e9318.command (m for help): npartition type   p   primary (0 primary, 0 extended, 4 free)   e   extended (container for logical partitions)select (default p): (push the enter key)using default response p.partition number (1-4, default 1): (push the enter key)first sector (2048-124321791, default 2048): (push the enter key)last sector, +/-sectors or +/-size{k,m,g,t,p} (2048-124321791, default 124321791): +500mcreated a new partition 1 of type 'linux' and of size 500 mib.command (m for help): npartition type   p   primary (1 primary, 0 extended, 3 free)   e   extended (container for logical partitions)select (default p): (push the enter key)using default response p.partition number (2-4, default 2): (push the enter key)first sector (1026048-124321791, default 1026048): (push the enter key)last sector, +/-sectors or +/-size{k,m,g,t,p} (1026048-124321791, default 124321791): (push the enter key)created a new partition 2 of type 'linux' and of size 58.8 gib.command (m for help): pdisk /dev/mmcblk0: 59.29 gib, 63652757504 bytes, 124321792 sectorsunits: sectors of 1 * 512 = 512 bytessector size (logical/physical): 512 bytes / 512 bytesi/o size (minimum/optimal): 512 bytes / 512 bytesdisklabel type: dosdisk identifier: 0xf23e9318device         boot   start       end   sectors  size id type/dev/mmcblk0p1         2048   1026047   1024000  500m 83 linux/dev/mmcblk0p2      1026048 124321791 123295744 58.8g 83 linuxcommand (m for help): wthe partition table has been altered.calling ioctl() to re-read partition table.syncing disks.root@smarc-rzg2l:~#  
格式化emmc:
左右滑动查看完整内容
root@smarc-rzg2l:~# mkfs.ext4 /dev/mmcblk0p1mke2fs 1.45.7 (28-jan-2021)discarding device blocks: donecreating filesystem with 512000 1k blocks and 128016 inodesfilesystem uuid: cd3a51a9-ef38-4399-888e-9773fcc41eccsuperblock backups stored on blocks:        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409allocating group tables: donewriting inode tables: donecreating journal (8192 blocks): donewriting superblocks and filesystem accounting information: doneroot@smarc-rzg2l:~# mkfs.ext4 /dev/mmcblk0p2mke2fs 1.45.7 (28-jan-2021)discarding device blocks: donecreating filesystem with 15411968 4k blocks and 3858432 inodesfilesystem uuid: 07d98391-d70c-4eed-a3af-4227a7460a32superblock backups stored on blocks:        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,        4096000, 7962624, 11239424allocating group tables: donewriting inode tables: donecreating journal (65536 blocks): donewriting superblocks and filesystem accounting information: doneroot@smarc-rzg2l:~#  
挂载emmc,拷贝内核、设备树、文件系统:
左右滑动查看完整内容
root@smarc-rzg2l:~# mount /dev/mmcblk0p1 /mnt/root@smarc-rzg2l:~# cp image-smarc-rzg2l.bin /mnt/root@smarc-rzg2l:~# cp image-r9a07g044l2-smarc.dtb /mnt/root@smarc-rzg2l:~# umount /dev/mmcblk0p1root@smarc-rzg2l:~# mount /dev/mmcblk0p2 /mnt/root@smarc-rzg2l:~# tar xf core-image-qt-smarc-rzg2l.tar.bz2 -c /mnt/root@smarc-rzg2l:~# umount /dev/mmcblk0p2  
关机,设置开发板sw11/sw1拨码开关模式:
重启开发板,设置环境变量:
左右滑动查看完整内容
notice:  bl2: v2.7(release):203c783-dirtynotice:  bl2: built : 06:57:02, nov 10 2022notice:  bl2: emmc boot from partition 1notice:  bl2: load dst=0x1f840 src=(p:1)0x20000(256) len=0x10(1)notice:  bl2: emmc boot from partition 1notice:  bl2: load dst=0x1f9a0 src=(p:1)0x20010(256) len=0x28(1)notice:  bl2: emmc boot from partition 1notice:  bl2: load dst=0x44000000 src=(p:1)0x20090(256) len=0x6069(49)notice:  bl2: emmc boot from partition 1notice:  bl2: load dst=0x1f840 src=(p:1)0x20000(256) len=0x10(1)notice:  bl2: emmc boot from partition 1notice:  bl2: load dst=0x1f9a0 src=(p:1)0x20010(256) len=0x28(1)notice:  bl2: load dst=0x1f9a0 src=(p:1)0x20038(256) len=0x28(1)notice:  bl2: emmc boot from partition 1notice:  bl2: load dst=0x50000000 src=(p:1)0x26100(304) len=0xb0238(1410)notice:  bl2: booting bl31notice:  bl31: v2.7(release):203c783-dirtynotice:  bl31: built : 06:57:02, nov 10 2022u-boot 2021.10 (mar 15 2023 - 07:34:17 +0000)cpu:   renesas electronics k rev 2.1model: smarc-rzg2ldram:  1.9 gibwdt:   watchdog@0000000012800800wdt:   started with servicing (60s timeout)mmc:   sd@11c00000: 0, sd@11c10000: 1loading environment from mmc... okin:    serial@1004b800out:   serial@1004b800err:   serial@1004b800u-boot wdt started!net:error: ethernet@11c20000 address not set.no ethernet found.hit any key to stop autoboot:  0hit any key to stop autoboot:  0=> env default -a## resetting to default environment=> setenv bootargs 'root=/dev/mmcblk0p2 rootwait'=> setenv bootcmd 'mmc dev 1; ext4load mmc 0:1 0x48080000 image-smarc-rzg2l.bin; ext4load mmc 0:1 0x48000000 image-r9a07g044l2-smarc.dtb; booti 0x48080000 - 0x48000000'=> saveenvsaving environment to mmc... writing to mmc(0)... ok  
重启开发板,从emmc成功加载:
bsp: rzg2l/rzg2l-smarc-evk/3.0.3lsi: rzg2lversion: 3.0.3smarc-rzg2l login: rootlast login: mon sep 18 02:29:32 utc 2023root@smarc-rzg2l:~# df -hfilesystem            size  used avail use% mounted on/dev/root              58g  1.2g   54g   3% /devtmpfs              740m     0  740m   0% /devtmpfs                 933m     0  933m   0% /dev/shmtmpfs                 933m  9.7m  924m   2% /runtmpfs                 933m     0  933m   0% /sys/fs/cgrouptmpfs                 933m     0  933m   0% /tmptmpfs                 933m   28k  933m   1% /var/volatiletmpfs                 187m     0  187m   0% /run/user/0root@smarc-rzg2l:~#  


华为畅享9S评测 实际体验如何
sp3232引脚及功能
机器人市场的发展在几年后将迎来大爆发
相敏整流解调器
将你的手臂变成触摸屏的智能手表LumiWatch
如何把文件系统烧到EMMC并从EMMC加载
电机的生产流程 电机生产厂家七大排行榜
华为P30系列评测 工艺先进性能强悍拍照顶级
核能发电的优点及缺点_核能发电是什么变化
安徽省发布了支持5G发展的若干政策
Starkey Hearing发布多用途AI助听器
R&S矢网在信号完整性测试中的应用解析
地铁AFC系统中的射频卡读写器技术方案
荣耀V30评测 压轴登场的5G顶级旗舰
印制电路板PCB机械加工有什么特点
中微半导体回应被美“拉黑”:和中国军方毫无关系
米粉好消息不断!音质、配置集体大提升,只为小米6
绿的谐波机器人零部件生产商的发展现在及存在问题
电力系统的远程自动化
Polestar 2全速前进与特斯拉Model 3正面较量