設置 | 登錄 | 註冊

作者共發了2篇帖子。

瑞芯微RV1106从SD卡启动自己的busybox1.36.1根文件系统

8樓 巨大八爪鱼 2025-6-20 14:24
【开机自动从网络获取日期和时间】
在电脑linux虚拟机上交叉编译ntpdate。
参考资料:https://blog.csdn.net/ZLK1214/article/details/120262773
cd ~/Downloads
wget https://downloads.nwtime.org/ntp/ntp-4.2.8p18.tar.gz
tar xf ntp-4.2.8p18.tar.gz
cd ntp-4.2.8p18
export PATH=$PATH:/home/oct1158/Downloads/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-linux-gnueabihf/bin
./configure --host=arm-none-linux-gnueabihf --with-yielding-select=yes --with-openssl-incdir=/home/oct1158/Downloads/openssl-1.1.1w/_install/usr/local/include --with-openssl-libdir=/home/oct1158/Downloads/openssl-1.1.1w/_install/usr/local/lib
make
make install DESTDIR=$(pwd)/_install
cd _install
sudo chown -R root:root usr
tar czf ntp-4.2.8p18-binary.tar.gz usr
cp ntp-4.2.8p18-binary.tar.gz /var/www/html/oct1158

fedora42编译ntp-4.2.8p18时,提示configure: error: could not locate pthread_detach()。
解决方案:
修改configure文件,找到第23134行的pthread_detach(NULL),改成pthread_detach(0)。
sntp/configure的第13735行也要做同样的修改。

板子上:
mount /dev/mmcblk1p2 /mnt
cd /mnt
wget https://192.168.2.140/oct1158/ntp-4.2.8p18-binary.tar.gz --no-check-certificate
(板子上自己编译的busybox的wget是支持https的,但幸狐的buildroot根文件系统的wget不支持https)
tar xzf ntp-4.2.8p18-binary.tar.gz -C /
(板子上自己编译的busybox的tar是支持gzip压缩格式的,但幸狐的buildroot根文件系统的tar不支持gzip格式)
cd ~
umount /dev/mmcblk1p2

测试命令:
[root@luckfox-rv1106 ~]# ntpdate cn.pool.ntp.org
20 Jun 06:05:55 ntpdate[595]: step time server 84.16.73.33 offset -28799.489413 sec
[root@luckfox-rv1106 ~]# date
Fri Jun 20 06:05:59 UTC 2025
[root@luckfox-rv1106 ~]#

可将/usr/local/sbin/ntpdate cn.pool.ntp.org加入/etc/init.d/rcS,开机自动校对时间。
巨大八爪鱼 2025-6-20 16:21
/etc/init.d/rcS里面的ntpdate指令最好加上&:/usr/local/sbin/ntpdate cn.pool.ntp.org &
以免影响开机。

內容轉換:

回覆帖子
內容:
用戶名: 您目前是匿名發表。
驗證碼:
看不清?換一張
©2010-2025 Purasbar Ver3.0 [手機版] [桌面版]
除非另有聲明,本站採用知識共享署名-相同方式共享 3.0 Unported許可協議進行許可。