当应用程序从 inittab 自动启动时,在 buildroot 中使用 cifs-mount 时出现问题

问题描述 投票:0回答:1

我正在构建一个基于 buildroot (2024-02)、init (busybox) 和 Raspberry-pi CM4 的系统。 “自制”应用程序不会给出任何登录提示,所以我自动启动我的 来自 inittab 的应用程序(就在“getty”启动之前):

inittab 的最后一部分:

::sysinit:/bin/hostname -F /etc/hostname
::sysinit:/etc/init.d/rcS

#Start my "home-made" application
/root/appl

#Put a getty on the serial port
console::respawn:/sbin/getty -L  console 0 vt100 # GENERIC_SERIAL
tty1::respawn:/sbin/getty -L  tty1 0 vt100 # HDMI console

#Stuff to do for the 3-finger salute
#::ctrlaltdel:/sbin/reboot

#Stuff to do before rebooting
::shutdown:/etc/init.d/rcK

我可以退出应用程序并返回 inittab 以输入 getty(登录提示符)。

应用程序负责:

  • 启动 Wlan0 接口(似乎有效,我获得了 IP)。
  • 将文件保存到 Windows 共享时运行“mount -t cifs”、“save”和“umount”。

问题是我必须退出回到 inittab(登录)并重新启动应用程序才能使 cifs 工作。

  • 失败:启动 -> autostart-appl -> save-to-win-share。
  • 这有效:启动 -> autostart-appl -> 退出登录 -> 登录 -> start-appl -> save-to-win-share

我尝试同时使用“mount.cifs”和“mount -t cifs”,但问题仍然存在。

有什么建议吗?

mount buildroot busybox autostart cifs
1个回答
0
投票

解决方案是使用 shell 和脚本启动应用程序:

::sysinit:/bin/hostname -F /etc/hostname
::sysinit:/etc/init.d/rcS

#Start my "home-made" application
::sysinit:/bin/sh -c /root/StartAppl.sh

#Put a getty on the serial port
console::respawn:/sbin/getty -L  console 0 vt100 # GENERIC_SERIAL
tty1::respawn:/sbin/getty -L  tty1 0 vt100 # HDMI console

StartAppl.sh 是一个调用“appl”的脚本。不知道为什么我必须添加一个调用“appl”的脚本,而不是直接调用“appl”......

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.