arm linux 启动后 can not find /dev/tty*

2023-11-30 12:58
文章标签 linux 启动 find arm dev tty

本文主要是介绍arm linux 启动后 can not find /dev/tty*,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

qemu + rootfs(buildroot) + linux3.18  

实验环境搭建参考博客:https://blog.csdn.net/qq_24188351/article/details/77921653 (ntfs uboot 的方式没搞定) 


运行起来后提示can not open /dev/ttyAMA0  no such file or directory

google 了下好像跟CONFIG_DEVTMPFS_MOUNT这个config 有关,打开后问题解决。


config信息来看专门为/dev创建的文件系统,为什么需要这个文件系统,与sysfs什么区别?

devtmpfs 在kernel中的位置是drivers/base/devtmpfs.c,查看文件中devtmpfs的接口就知道它的基本作用

对该文件的分析:http://blog.chinaunix.net/uid-27717694-id-3574368.html

Sysfs mainly contains files that provide information about devices, as well as some files that allow processes to control how devices operate. But for the most part devices cannot be used through what sysfs provides.

Let's take a hard disk, for example. There's a directory for it somewhere under /sys/devices, with a path that depends on how it's connected to the computer (e.g. /sys/devices/pci0000:00/… for a disk connected to a controller that's connected to the computer's primary PCI bus). In that directory, you can find various information such as its size, whether it's removable, its power state, etc. There are subdirectories for partitions as well. But there's nothing in there that provides access to the content of the disk. Elsewhere in /sys, there are symbolic links to the directory corresponding to that disk: in /sys/block, in /sys/class/block, etc. But still nothing to access the content of the disk.

In /dev, the entry for the disk is a special file — a block device. This file allows processes to read and write the content of the disk. (Though for a disk that usually doesn't happen; instead the content of the disk — or of a partition — is mounted, so the kernel is accessing the device, processes don't.)

Device files allow some operations other than reading and writing content to be made through ioctl. It would be possible to provide all the information and control interfaces that sysfs provides through ioctl on the device file. However this would be less convenient for several reasons:

With separate files in /sys, permissions can be set on a fine-grained basis. With a single file per device in /dev, it's all or nothing.
Separate files can be read and written easily by applications. You can just use cat or echo. With ioctl, it's a lot harder: there's no shell interface, often no interface in other high-level languages.
With ioctl, the command has to be encoded in a number rather than a name, and the format of the arguments has to be defined at a binary level. Using names and simple text formats makes it easier to write software.
Going in the other direction, it would be possible to provide access to the device content via a file in sysfs. But this would require extra work in the kernel: sysfs is designed primarily to serve small files and symbolic links, and without the ioctl support that existing applications expect. I don't think there would be a significant benefit to expanding sysfs to support existing device types, hence the continued existence of device files.

Sysfs is automatically populated by the kernel, reflecting the actually available devices in real time. The meaning of a file in sysfs comes from its path, which is chosen by the driver that provides that file. /dev works differently: the meaning of a file comes from the device file's type (block or character) and its major and minor numbers (that's what ls -l lists instead of the file size for a device). Traditionally, /dev was static, with device files created during system installation; but that doesn't work so well when devices can be hotplugged, hence the wish for a dynamic /dev that reflects connected devices in real time.

Linux has gone through several iterations of a dynamic /dev. Linux 2.4 has devfs, where the kernel automatically created entries to reflect connected devices. But that was not so nice, because it hard-coded device naming and permission policies into the kernel, so it was replaced by the userland program udev to manage policy, and /dev on a simple tmpfs filesystem (an in-memory filesystem with no special meaning to the kernel). And then devfs made a partial comeback, with devtmpfs, which is an instance of tmpfs where entries for available devices are automatically created by the kernel, but udev does all the management it wants on top of that.

这篇关于arm linux 启动后 can not find /dev/tty*的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/437111

相关文章

Linux使用nload监控网络流量的方法

《Linux使用nload监控网络流量的方法》Linux中的nload命令是一个用于实时监控网络流量的工具,它提供了传入和传出流量的可视化表示,帮助用户一目了然地了解网络活动,本文给大家介绍了Linu... 目录简介安装示例用法基础用法指定网络接口限制显示特定流量类型指定刷新率设置流量速率的显示单位监控多个

ElasticSearch+Kibana通过Docker部署到Linux服务器中操作方法

《ElasticSearch+Kibana通过Docker部署到Linux服务器中操作方法》本文介绍了Elasticsearch的基本概念,包括文档和字段、索引和映射,还详细描述了如何通过Docker... 目录1、ElasticSearch概念2、ElasticSearch、Kibana和IK分词器部署

Linux流媒体服务器部署流程

《Linux流媒体服务器部署流程》文章详细介绍了流媒体服务器的部署步骤,包括更新系统、安装依赖组件、编译安装Nginx和RTMP模块、配置Nginx和FFmpeg,以及测试流媒体服务器的搭建... 目录流媒体服务器部署部署安装1.更新系统2.安装依赖组件3.解压4.编译安装(添加RTMP和openssl模块

linux下多个硬盘划分到同一挂载点问题

《linux下多个硬盘划分到同一挂载点问题》在Linux系统中,将多个硬盘划分到同一挂载点需要通过逻辑卷管理(LVM)来实现,首先,需要将物理存储设备(如硬盘分区)创建为物理卷,然后,将这些物理卷组成... 目录linux下多个硬盘划分到同一挂载点需要明确的几个概念硬盘插上默认的是非lvm总结Linux下多

Android里面的Service种类以及启动方式

《Android里面的Service种类以及启动方式》Android中的Service分为前台服务和后台服务,前台服务需要亮身份牌并显示通知,后台服务则有启动方式选择,包括startService和b... 目录一句话总结:一、Service 的两种类型:1. 前台服务(必须亮身份牌)2. 后台服务(偷偷干

linux进程D状态的解决思路分享

《linux进程D状态的解决思路分享》在Linux系统中,进程在内核模式下等待I/O完成时会进入不间断睡眠状态(D状态),这种状态下,进程无法通过普通方式被杀死,本文通过实验模拟了这种状态,并分析了如... 目录1. 问题描述2. 问题分析3. 实验模拟3.1 使用losetup创建一个卷作为pv的磁盘3.

Windows设置nginx启动端口的方法

《Windows设置nginx启动端口的方法》在服务器配置与开发过程中,nginx作为一款高效的HTTP和反向代理服务器,被广泛应用,而在Windows系统中,合理设置nginx的启动端口,是确保其正... 目录一、为什么要设置 nginx 启动端口二、设置步骤三、常见问题及解决一、为什么要设置 nginx

springboot启动流程过程

《springboot启动流程过程》SpringBoot简化了Spring框架的使用,通过创建`SpringApplication`对象,判断应用类型并设置初始化器和监听器,在`run`方法中,读取配... 目录springboot启动流程springboot程序启动入口1.创建SpringApplicat

树莓派启动python的实现方法

《树莓派启动python的实现方法》本文主要介绍了树莓派启动python的实现方法,文中通过图文介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 目录一、RASPBerry系统设置二、使用sandroidsh连接上开发板Raspberry Pi三、运

Linux环境变量&&进程地址空间详解

《Linux环境变量&&进程地址空间详解》本文介绍了Linux环境变量、命令行参数、进程地址空间以及Linux内核进程调度队列的相关知识,环境变量是系统运行环境的参数,命令行参数用于传递给程序的参数,... 目录一、初步认识环境变量1.1常见的环境变量1.2环境变量的基本概念二、命令行参数2.1通过命令编程