20250517让NanoPi NEO core开发板在Ubuntu core16.04.2下支持TF卡的热插拔

20250517让NanoPi NEO core开发板在Ubuntu core16.04.2下支持TF卡的热插拔

2025/5/17 17:52

缘起:实测NanoPi NEO core开发板上电之后,后插入的TF卡不认/不支持热插拔。

Ubuntu core16.04.2

Ubuntu core20.04

Ubuntu core16.04.3

用NanoPi NEO core开发板 接入4G模块EC200A-CN。

有一个移远提供的上网应用程序:quectel-CM需要拷贝到Ubuntu core系统中。

【还没有来得及集成到IMG固件/系统中】

不想使用RJ45以太网线了!

插上网线是可以通过DHCP自动分配局域网的IP地址。

然后通过ssh/scp、samba就可以拷贝文件进去了!

如果H3通过EMMC启动,上电之后再插入 有程序的TF卡 拷贝文件。

系统启动完成之后就不会/不识别你所插入的TF卡。

必须上电之前插入?

linux内核是支持 热插拔的呀?

感觉是你们/友善之臂没有做好!

现在使用的ubuntu core 20.04测试的。

记忆中ubuntu core 16.04.2/Ubuntu22.04.2都有这个问题的。

貌似Android系统是有一个daemon应用程序,一秒钟扫描一次是否有TF卡插入。

在H3上做一个这种daemon应用程序很简单的!

我们只提供底层软件和基础的系统,因为不同客户需求是不同的,

至于自动挂载,按需自行配置udev规则即可,或者有些systemd服务可以达到同样的目的,

怀疑linux内核没有识别SD插入,可以打印一下dmesg信息看看。

【贵司邮件服务器异常,从2025-05-10开始不接受带附件的E-MAIL了!^_无法 发送附加了】

NanoPi NEO core开发板在ubuntu core22.04.3下

查看/比对了一下插入前后的dmesg,发现/确认你们提供的kernel:linux内核没有识别SD插入。

由于对SD/TF卡的热插拔检测是很基本的功能,我希望贵司最好能够加入这个功能。

2015年,我就开始做全志R16的FAE,和A33/H3同一个级别的SOC。

记得当时全志R16在Android4.4.2/tina下都可以支持SD/TF卡的热插拔的。

至少可以提供一下方向,让我知道该如何加入?

参考资料:

https://blog.51cto.com/u_16099268/13875998

Android TF卡热拔插

https://blog.csdn.net/fun_tion/article/details/142613803

嵌入式Linux系统TF卡热插拔检测问题

是否是因为没有配置SDHCI_EXT_CD检测引脚?或者没有配置正确呢?

root@NanoPi-NEO-Core:/# cat /sys/kernel/debug/gpio

gpiochip0: GPIOs 0-223, parent: platform/1c20800.pinctrl, 1c20800.pinctrl:

gpio-10 ( |status_led ) out lo

gpio-204 ( |usb0_id_det ) in hi IRQ

gpiochip1: GPIOs 352-383, parent: platform/1f02c00.pinctrl, 1f02c00.pinctrl:

gpio-354 ( |usb0-vbus ) out lo

gpio-355 ( |k1 ) in hi IRQ

gpio-358 ( |? ) out lo

gpio-360 ( |vcc1v2 ) out hi

gpio-361 ( |vcc-dram ) out hi

gpio-362 ( |LED2 ) out hi

root@NanoPi-NEO-Core:/#

非常抱歉,由于一些历史原因,我们提供的系统默认禁用了 TF卡插拔检测。

用户可以参考下面这个 commit 的内容,自行使能该特性:

https://github.com/friendlyarm/linux/commit/6fe15de8c8d042677b2962fe06c15f3c3f017ae7

https://github.com/friendlyarm/linux/commit/6fe15de8c8d042677b2962fe06c15f3c3f017ae7

1 file changed

+1

-2

lines changed

Search within code

?arch/arm/boot/dts/sun8i-h3-nanopi.dtsi

+1

-2

Original file line number Diff line number Diff line change

@@ -283,8 +283,7 @@

&mmc0 {

bus-width = <4>;

cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;

cd-inverted;

non-removable;

pinctrl-names = "default";

pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;

boot_device = <0>;

Z:\sd-fuse_h3\kernel\arch\arm\boot\dts\sun8i-h3-nanopi-neo-core.dts

Z:\sd-fuse_h3\kernel\arch\arm\boot\dts\sun8i-h3-nanopi - 副本.dtsi

&mmc0 {

bus-width = <4>;
non-removable;

pinctrl-names = "default";

pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;

boot_device = <0>;

status = "okay";

vmmc-supply = <&reg_vcc3v3>;

};

修改成为:

Z:\sd-fuse_h3\kernel\arch\arm\boot\dts\sun8i-h3-nanopi.dtsi

&mmc0 {

bus-width = <4>;
cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
cd-inverted;
//non-removable;

pinctrl-names = "default";

pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;

boot_device = <0>;

status = "okay";

vmmc-supply = <&reg_vcc3v3>;

};

确认DTS的编译结果:

Z:\61临时了sd-fuse_h3\kernel\arch\arm\boot\dts\.sun8i-h3-nanopi-neo-core.dtb.dts.tmp

&mmc0 {

bus-width = <4>;
non-removable;

pinctrl-names = "default";

pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;

boot_device = <0>;

status = "okay";

vmmc-supply = <&reg_vcc3v3>;

};

Z:\sd-fuse_h3\kernel\arch\arm\boot\dts\.sun8i-h3-nanopi-neo-core.dtb.dts.tmp

&mmc0 {

bus-width = <4>;
cd-gpios = <&pio 5 6 0>;
cd-inverted;

pinctrl-names = "default";

pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;

boot_device = <0>;

status = "okay";

vmmc-supply = <&reg_vcc3v3>;

};

更新zImage和sun8i-h3-nanopi-neo-core.dtb文件,打包boot.img之后:更新:

Z:\sd-fuse_h3\kernel\arch\arm\boot\dts\sun8i-h3-nanopi-neo-core.dtb

Z:\sd-fuse_h3\BOOT\sun8i-h3-nanopi-neo-core.dtb

F:\zImage

H:\friendlycore\boot.img

LOG/dmesg比对:

9.389957\] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready \[ 9.439609\] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready \[ 9.492517\] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready \[ 43.113836\] mmc1: host does not support reading read-only switch, assuming write-enable \[ 43.115915\] mmc1: new high speed SDHC card at address b368 \[ 43.117776\] mmcblk1: mmc1:b368 SDABC 29.1 GiB \[ 43.119536\] mmcblk1: p1 \[ 55.087946\] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready \[ 55.153190\] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready root@NanoPi-NEO-Core:/# dmesg ![](https://i-blog.csdnimg.cn/direct/48caa4ead38a4d928cae2d47c176b161.png) 挂载/热插拔TF卡: root@NanoPi-NEO-Core:/# root@NanoPi-NEO-Core:/# fdisk -l Disk /dev/mmcblk0: 7.3 GiB, 7818182656 bytes, 15269888 sectors Units: sectors of 1 \* 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x2294ea6c Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 49152 131071 81920 40M 83 Linux /dev/mmcblk0p2 131072 2621439 2490368 1.2G 83 Linux /dev/mmcblk0p3 2621440 15269887 12648448 6G 83 Linux Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 \* 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 \* 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mmcblk1: 29.1 GiB, 31273779200 bytes, 61081600 sectors Units: sectors of 1 \* 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xdca40288 Device Boot Start End Sectors Size Id Type /dev/mmcblk1p1 8192 61081599 61073408 29.1G c W95 FAT32 (LBA) root@NanoPi-NEO-Core:/# root@NanoPi-NEO-Core:/# root@NanoPi-NEO-Core:/# mount /dev/mmcblk1p1 /mnt root@NanoPi-NEO-Core:/# root@NanoPi-NEO-Core:/# cd /mnt/ root@NanoPi-NEO-Core:/mnt# root@NanoPi-NEO-Core:/mnt# ls -l total 615936 -rwxr-xr-x 1 root root 1936 Aug 8 2015 default.script1 -rwxr-xr-x 1 root root 852 Jun 18 2021 default.script2 drwxr-xr-x 3 root root 32768 May 9 2025 etc drwxr-xr-x 2 root root 32768 May 8 2025 linux-ppp-scripts -rwxr-xr-x 1 root root 183564 Mar 30 2024 quectel-CM -rwxr-xr-x 1 root root 630311248 May 10 2025 rootfs.tar.gz drwxr-xr-x 2 root root 32768 May 8 2025 System Volume Information drwxr-xr-x 3 root root 32768 May 9 2025 usr root@NanoPi-NEO-Core:/mnt# ![](https://i-blog.csdnimg.cn/direct/edd3356084814a85a2c6bdeaa4c3ab8f.png)

相关推荐
默心9 分钟前
运维工程师面试经验分享
运维·经验分享·面试
weixin_4342556119 分钟前
命令行快速上传文件到SFTP服务器(附参考示例)
linux·运维·服务器
Dontla24 分钟前
Webpack DefinePlugin插件介绍(允许在编译时创建JS全局常量,常量可以在源代码中直接使用)JS环境变量
运维·javascript·webpack
掘金-我是哪吒36 分钟前
分布式微服务系统架构第133集:运维服务器6年经验,高并发,大数据量系统
运维·服务器·分布式·微服务·系统架构
麟城Lincoln1 小时前
【Linux笔记】nfs网络文件系统与autofs(nfsdata、autofs、autofs.conf、auto.master)
linux·网络·笔记·nfs·autofs
云计算-Security1 小时前
Jenkins 执行器(Executor)如何调整限制?
运维·jenkins
***似水流年***1 小时前
Linux任务管理与守护进程
linux·运维·服务器
python算法(魔法师版)1 小时前
.NET NativeAOT 指南
java·大数据·linux·jvm·.net
天天爱吃肉82182 小时前
车载以太网驱动智能化:域控架构设计与开发实践
java·运维·网络协议·微服务
正经教主2 小时前
【基础】Windows开发设置入门4:Windows、Python、Linux和Node.js包管理器的作用和区别(AI整理)
linux·windows·python·包管理器