linux_内核移植方法及错误
linux cpu任务迁移机制

linux cpu任务迁移机制Linux是一个开源的操作系统内核,具有良好的可移植性和扩展性。
在Linux系统中,CPU任务迁移机制是其中一个重要的特性。
任务迁移是指将正在运行的任务从一个CPU核心转移到另一个CPU核心的过程。
本文将详细介绍Linux的CPU任务迁移机制。
1. 任务迁移的定义和目的任务迁移是指将正在运行的任务从一个CPU核心转移到另一个CPU核心的过程。
任务迁移的目的在于平衡系统负载,提高系统性能和资源利用率。
通过任务迁移,可以将负载较重的CPU核心上的任务迁移到负载较轻的CPU核心上,从而实现负载均衡。
2. 任务调度器Linux系统中的任务调度器负责任务的调度和分配。
任务调度器根据任务的优先级和调度策略,决定将任务分配给哪个CPU核心执行。
当系统负载不均衡时,任务调度器会触发任务迁移机制,将任务从负载较重的CPU核心迁移到负载较轻的CPU核心上,以实现负载均衡。
3. 任务迁移的触发条件任务迁移并非无条件触发,而是需要满足一定的条件才能执行。
Linux系统中任务迁移的触发条件主要包括负载差异、任务优先级和负载均衡策略。
负载差异是任务迁移的主要触发条件之一。
当某个CPU核心的负载高于设定的阈值时,任务调度器会触发任务迁移,将负载较重的任务迁移到负载较轻的CPU核心上。
任务的优先级也会影响任务迁移的触发。
当系统中存在高优先级的任务时,任务调度器会优先考虑将高优先级任务迁移到适合的CPU 核心上执行,以保证高优先级任务的及时响应。
负载均衡策略也是触发任务迁移的重要因素。
Linux系统中有多种负载均衡策略可供选择,如最小平均负载、最小任务数等。
任务调度器根据所选的负载均衡策略,判断是否需要进行任务迁移。
4. 任务迁移的过程任务迁移的过程可以分为两个阶段:选择目标CPU核心和迁移任务。
任务调度器会选择一个合适的目标CPU核心。
选择目标CPU核心的方式取决于所采用的负载均衡策略。
例如,如果采用最小平均负载策略,任务调度器会选择负载最轻的CPU核心作为目标。
Linux下运行C++程序出现段错误(核心已转储)的原因

Linux下运⾏C++程序出现段错误(核⼼已转储)的原因 今天写程序出现了“段错误(核⼼已转储)"的问题,查了⼀下资料,加上⾃⼰的实践,总结了以下⼏个⽅⾯的原因。
1.内存访问出错
这类问题的典型代表就是数组越界。
2.⾮法内存访问
出现这类问题主要是程序试图访问内核段内存⽽产⽣的错误。
3.栈溢出
Linux默认给⼀个进程分配的栈空间⼤⼩为8M。
c++申请变量时,new操作申请的变量在堆中,其他变量⼀般在存储在栈中。
因此如果你数组开的过⼤变会出现这种问题。
⾸先我们先看⼀下系统默认分配的资源:
1 ulimit -a
可以看到默认分配的栈⼤⼩为8M。
如果真的需要更⼤的栈空间,可以⽤指令ulimit -s XXXX来申请更⼤的栈空间。
Linux内核编译生成bzImage的详细方法步骤及错误解决

Linux内核编译⽣成bzImage的详细⽅法步骤及错误解决什么是bzImagebzImage诚如其名是big image的意思,不是压缩的image。
在⽹络中,不少服务器采⽤的是Linux系统。
为了进⼀步提⾼服务器的性能,可能需要根据特定的硬件及需求重新编译Linux内核。
编译Linux 内核,需要根据规定的步骤进⾏,编译内核过程中涉及到⼏个重要的⽂件。
编译过RedHat Linux内核的⼈对其中的System.map、vmlinuz、initrd-2.4.7-10.img印象可能⽐较深刻,因为编译内核过程中涉及到这些⽂件的建⽴等操作。
那么这些⽂件是怎么产⽣的呢?以vmlinuz为例。
vmlinuz是可引导的、压缩的内核。
“vm”代表“Virtual Memory”。
Linux ⽀持虚拟内存,不像⽼的操作系统⽐如DOS有640KB内存的限制。
Linux能够使⽤硬盘空间作为虚拟内存,因此得名“vm”。
vmlinuz是可执⾏的Linux内核,它位于/boot/vmlinuz,它⼀般是⼀个软链接。
vmlinuz的建⽴有两种⽅式。
⼀是编译内核时通过“make zImage”创建,⼿动拷贝到/boot⽬录下⾯。
zImage适⽤于⼩内核的情况,它的存在是为了向后的兼容性。
⼆是内核编译时通过命令make bzImage创建,然后⼿动拷贝⾄/boot⽬录下。
bzImage是压缩的内核映像,需要注意,bzImage不是⽤bzip2压缩的,bzImage中的bz容易引起误解,bz表⽰“big zImage”。
bzImage中的b是“big”意思。
zImage(vmlinuz)和bzImage(vmlinuz)都是⽤gzip压缩的。
它们不仅是⼀个压缩⽂件,⽽且在这两个⽂件的开头部分内嵌有 gzip解压缩代码。
所以你不能⽤gunzip 或 gzip –dc解包vmlinuz。
内核⽂件中包含⼀个微型的gzip⽤于解压缩内核并引导它。
移植过程出现错误解析

每做一次实验,你就会发现很多在书本上学不到的东西,切记多做实验NAND_ECC_NONE selected by board driver. This is not recommended !! Scanning device for bad blocksCreating 5 MTD partitions on "NAND 64MiB 3,3V 8-bit":0x00000000-0x00020000 : "vivi"0x00020000-0x00030000 : "param"0x00030000-0x00300000 : "kernel"0x00300000-0x00330000 : "root"0x00600000-0x03600000 : "user"mice: PS/2 mouse device common for all miceNET: Registered protocol family 2IP route cache hash table entries: 1024 (order: 0, 4096 bytes)TCP established hash table entries: 4096 (order: 2, 16384 bytes)TCP bind hash table entries: 4096 (order: 2, 16384 bytes)TCP: Hash tables configured (established 4096 bind 4096)TCP reno registeredTCP bic registeredNET: Registered protocol family 1Root-NFS: No NFS server available, giving up.VFS: Unable to mount root fs via NFS, trying floppy.VFS: Cannot open root device "bon/3" or unknown-block(2,0)Please append a correct "root=" boot optionKernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)错误分析:从错误来看,vivi和kernel都算移植成功,最后发现文件系统无法挂载。
Linux内核配置移植及编译实验

return platform_driver_register(&dm9k_driver); } 7.添加 YAFFS 文件系统支持 将我们提供的 YAFFS 的源代码 yaffs2.tar.gz 拷贝到 linux-2.6.24.4 的同 级目录下,解压该源码包,获得 YAFFS 源码: # pwd /root/2410-s # cp /mnt/hgfs/e/yaffs2.tar.gz ./ # tar zxvf yaffs2.tar.gz 然后进入 yaffs2 目录,运行./patch-ker.sh 给内核打上补丁: # cd yaffs2 # ./patch-ker.sh c ../linux-2.6.24.4/ 这样打好补丁以后,再做正确的配置,内核就可以支持 YAFFS 文件系统了。 8.配置和编译内核 到现在,一个简单的内核就准备好了,我们还需要做一些配置,然后编译, 内核才能正常使用。 在内核源代码的根目录下运行 make menuconfig 命令,进入配置界面: # make menuconfig (1)选择硬件系统 做如下选择: System Type --->
S3C2410 Machines ---> [*] SMDK2410/A9M2410 [ ] IPAQ H1940 [ ] Acer N30 [ ] Simtec Electronics BAST (EB2410ITX) [ ] NexVision OTOM Board [ ] AML M5900 Series [ ] Thorcom VR1000
.size = SZ_4M, }, [3] = {
.name = "User Space", .offset = 0x680000, .size = 0x1980000, }, }; 这样就把我们的 64M 的 NAND Flash 分为四个区: 第一个区从 0x00000000 到 0x00080000,大小为 0.5M 第二个区从 0x00080000 到 0x00280000,大小为 2M 第三个区从 0x00280000 到 0x00680000,大小为 4M 第四个区从 0x00680000 到 0x02000000,大小为 25.5M 5.添加 LCD 支持 我们的开发平台上配置有 640*480 的液晶屏,我们来为它加上驱动支持。 需要在 arch/arm/mach-s3c2410/mach-smdk2410.c 中添加一些内容。 # vi arch/arm/mach-s3c2410/mach-smdk2410.c 首先要包含我们的 LCD 使用的数据结构的头文件,增加如下内容: #include <asm-arm/arch-s3c2410/fb.h> #include <linux/platform_device.h> 然后添加如下内容: static struct s3c2410fb_display up2410_fb[] __initdata = { { .lcdcon5 = (1<<12)|(1<<11)|(1<<9)|(1<<8)|(1<<0), .type = (3<<5), .width = 640, .height = 480, .pixclock = 39721,
简述内核移植的具体步骤

简述内核移植的具体步骤嘿,朋友们!今天咱就来唠唠内核移植这档子事儿。
啥是内核移植呢?就好比你有个超级棒的灵魂,想给它换个新身体,让它在新环境里继续大展拳脚。
首先呢,你得把原来的内核好好研究研究,就像了解一个老朋友一样,知道它的脾气、喜好。
这可不能马虎,不然咋知道该怎么给它挪窝呀!然后呢,选好新的目标环境,这就跟给灵魂找新家似的,得合适才行。
你可不能随随便便找个地儿就塞进去,那可不行。
接下来,就是最关键的一步啦!要把内核的代码啊、数据啊啥的,小心翼翼地搬到新环境里。
这可不像搬个桌子椅子那么简单,这得精细着来,不能有一点差错。
就好像给一个精致的瓷器搬家,轻不得重不得。
搬完了还不算完事儿,还得调试调试。
这就好比新搬了家得看看水电通不通,家具摆得合不合适。
要是有啥问题,赶紧解决,可不能留隐患。
在这过程中,你可得有耐心啊!别嫌麻烦,就跟盖房子似的,一砖一瓦都得认真对待。
你想想,要是房子盖得不结实,那能住得安心吗?而且啊,这可不是一个人能搞定的事儿,得团队合作。
大家齐心协力,各显神通,才能把这事儿干得漂亮。
这就跟一场足球比赛似的,每个人都有自己的位置和任务,只有配合好了,才能赢下比赛。
有时候可能会遇到难题,别着急,别慌张。
想想办法,多试试几种途径,说不定就柳暗花明又一村了呢!总之呢,内核移植可不是个简单的活儿,但只要咱认真对待,一步一个脚印,就一定能成功。
这就像爬山,虽然过程辛苦,但当你站在山顶俯瞰美景的时候,你就会觉得一切都值得啦!所以,加油吧,朋友们!让我们一起征服内核移植这座大山!。
Linux系统编译安装常见错误处理方法

5.Configure: error: libjpeg.(a|so) not found
# yum install libjpeg libjpeg-devel
6.Configure: error: libpng.(also) not found.
# yum install libpng libpng-devel
13.Configure: error: Cannot find ldap.h
# yum install openldap-devel
本篇文章来源于 Linux公社网站() 原文链接:/Linux/2011-04/34622.htm
再php:~/:./configure …… --with-gd=/usr/local/gd2 ……
1) Configure: error: xml2-config not found. Please check your libxml2 installation.
Solutions :
Solutions :
Quote: # yum install unixODBC-devel
12) Configure: error: Cannot find pspell
Solutions :
Quote: # yum install pspell-devel
13) configure: error: mcrypt.h not found. Please reinstall libmcrypt.
7) Configure: error: freetype.h not found.
Solutions :
Quote: #yum install freetype-devel
第8章 基于ARM的Linux内核移植

(2)编译测试参考板的Linux内核 为了测试Linux对参考板的支持情况,最好配置编 译Linux内核,在目标参考板上运行测试一下。 对于交叉开发来说,首先应在顶层Makefile中设置 ARCH、CROSS_COMPILE和EXTRA_VERSION 变量,然后才能选择配置指定的体系结构平台。 ARM平台的例子如下 ARCH := arm CROSS_COMPILE := arm-linuxEXTRA_VERSION :=
8.1.2 开发板内核移植 对于内核移植工作来说,主要是添加开发板初始 化和驱动程序的代码。这部分代码大部分跟体系 结构相关,在arch目录下按照不同的体系结构管理 ,下面以ARM S3C2410平台为例,分析内核代码 移植过程。 Linux2.6内核已经支持S3C2410处理器的多种硬件 板,我们可以参考SMDK2410参考板,来移植开 发板的内核
真正系统平台号的定义位置在arch/arm/tools/mach-types 文件。 #machine_is_xx CONFIG_xx MACH_TYPE_xx number smd2410 ARCH_SMDK2410 SMDK2410 193 arch/arm/tools/mach-types中每一行定义一个系统平台号 。“machine_is_xxx”是用来判断当前的平台号名称 ;CONFIG_xxxx是在内核配置时生成的; MACH_TYPE_xxx是系统平台号的定义;number是系 统平台的值。
#include/asm/mach/arch.h
#define MACHINE_START(_type,_name) const struct machine_desc _mach_desc_##_type \ _attribute_((_section_(“.init”))) = { \ .nr = MACH_TYPE_##_type,\ .name = name, … #define MACHINE_END };
第4章 Linux内核裁剪与移植 Linux系统移植(第2版) 教学课件

4.1 Linux内核结构 4.2 内核配置选项 4.3 内核裁剪及编译 4.4 内 核 升 级
4.1.2 内核源码目录介绍
Linux内核代码以源码树的形式存放,如 果在安装系统的时候已经安装了源码树, 其源码树就在/usr/src/linux下。
1.arch目录
禁用随机heap(heap堆是一个应用层的概念,即堆对CPU是不可见的,它 的实现方式有多种,可以由OS实现,也可以由运行库实现,也可以在一个 栈中来实现一个堆)
Choose SLAB allocator Profiling support Kprobes
选择内存分配管理器,建议选择 支持系统评测,建议不选 探测工具,开发人员可以选择,建议不选
5.init目录
init子目录包含核心的初始化代码(注意, 不是系统的引导代码)。它包含两个文件 main.c和version.c,这是研究核心如何工 作的一个非常好的起点。
6.ipc目录
ipc子目录包含核心进程间的通信代码。 Linux下进程间通信机制主要包括管道、 信号、消息队列、共享内存、信号量、套 接口。
Physical 选择XIP后,内核存放的物理地址
Kexec system call
Kexec系统调用
4.2.4 网络协议支持相关选项
菜单选项(Networking Support)的子菜 单中包含一些网络协议支持的选项。
选项名 Networking options Amateur Radio support
arch子目录包括了所有和体系结构相关的 核心代码。它的每一个子目录都代表一种 支持的体系结构,例如arm子目录是关于 ARM平台下各种芯片兼容的代码。
内核移植实验总结

内核移植实验总结
一、实验目的
完成内核移植实验,以深入理解操作系统内核在不同硬件平台的移植过程。
二、实验内容
1. 配置ARM Linux 开发环境,包括异常处理,内存管理,设备驱动等有关linux 内核模块的移植。
2. 在ARM GRSDK 上移植kernel,并使其具有多任务,多线程,MPU,任务调度,中断处理,内存管理,设备驱动等功能。
三、实验结果
1. 配置ARM Linux 开发环境成功,可以对ARM 芯片进行编程,并能够在开发板上运行程序;
2. 在ARM GRSDK 上移植kernel 成功,能够正常运行linux 系统,并具有多任务,多线程,MPU,任务调度,中断处理,内存管理及设备驱动等功能。
四、实验体会
通过本次实验,深入了解了ARM Linux 内核的移植,学会了如何在ARM GRSDK 上移植Linux 内核,以及如何添加中断处理,内存管理,设备驱动等模块。
本次实验是一次宝贵的经验,也让我对操作系统内核的原理有了更深刻的理解,让我对操作系统的知识有了更加全面深入的认识。
- 1 -。
linux系统下uboot、kernel、android文件系统编译错误整理及解决办法

linux系统下uboot、kernel、android文件系统编译错误整理及解决办法Ver1.0作成者:雷鹏作成年月:2012/09/251、linux下编译应用程序时出现如下错误: /usr/bin/ld: cannot find -lxxx。
原因分析:编译过程找不到对应库文件。
其中,-lxxx表示链接库文件 libxxx.so。
由于库文件是编译过程临时生成的,如果前面编译过程出错也会导致出现这种情况,下面针对本机系统环境缺失而引起的错误进行分析。
一般出现这种错误有以下几种原因:⑴.系统缺乏对应的库文件;⑵.版本不对应;⑶.库文件的链接错误;⑷.库文件路径设置问题。
解决方法:对应第一第二种情况,可以通过下载安装lib来解决,ubuntu系统可以直接通过apt-get来安装:apt-get install libxxx-dev如果还是不能解决问题,那么,引起错误的原因不是链接错误就是库文件路径问题。
通过find或者locate指令定位到链接文件,查看链接文件是否正确的指向了编译需要的lib,如果不是,用下列指令修改它。
ln -sf */libxxx.so.x */libxxx.so如果是库文件路径引发的问题,可以到/etc/ld.so.conf.d目录下,修改其中任意一份conf文件,(可以自建conf,以方便识别)将lib所在目录写进去,然后在终端输入 ldconfig 更新缓存。
2、编译时出现错误提示:include/asm is a directory but a symlink was expected原因分析:linux/include/asm 文件夹是内核编译过程中创建的,创建结果就是一个指向文件夹asm-arm 的链接,表明该系统的平台是arm架构的,而编译系统内核之前,是没有asm这个链接的,所以,在编译过程中,创建该链接时文件名字与asm文件夹的名字发生冲突,于是系统报错了。
描述Linux内核的移植过程

描述Linux内核的移植过程
Linux内核的移植过程可以分为以下几个步骤:
1. 确定目标平台:首先需要确定要将Linux内核移植到哪个目标平台上,这个平台可以是嵌入式设备、服务器、桌面电脑等。
2. 获取源代码:从Linux官网或其他开源代码库获取Linux内核的源代码。
3. 配置内核:根据目标平台的硬件特性和需求,对内核进行配置。
可以使用make menuconfig、make xconfig或make config等命令进行配置。
4. 编译内核:使用交叉编译工具链对内核进行编译。
交叉编译工具链是一组针对特定平台的编译器、链接器、调试器等工具,可以在开发主机上编译生成目标平台上的可执行文件。
5. 生成镜像文件:将编译生成的内核、设备树、启动程序等文件打包成一个镜像文件。
镜像文件的格式可以是uImage、zImage、vmlinux等。
6. 烧录镜像文件:将生成的镜像文件烧录到目标平台的存储设备上,例如闪存、SD卡、硬盘等。
可以使用dd、fastboot、flash等命令进行烧录。
7. 启动内核:将目标平台连接到开发主机,通过串口或网络连接进行调试和启动。
可以使用bootloader或者直接从存储设备启动内核。
8. 调试内核:在目标平台上运行内核时,可能会遇到各种问题,例如驱动不兼容、内存泄漏、死锁等。
需要使用调试工具对内核进行调试,例如gdb、kgdb、strace等。
以上就是Linux内核的移植过程,需要根据具体的目标平台和需求进行调整和优化。
linux编译安装时常见错误解决办法

linux编译安装时常见错误解决办法configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution复制代码代码如下:yum -y install libxslt-develconfigure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.复制代码代码如下:yum -y install net-snmp-develconfigure: error: Please reinstall readline - I cannot find readline.h复制代码代码如下:yum -y install readline-develconfigure: error: Cannot find pspell复制代码代码如下:yum -y install aspell-develchecking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found!复制代码代码如下:yum -y install unixODBC-develconfigure: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.复制代码代码如下:yum -y install libicu-develconfigure: error: utf8mime2text() has new signature, but U8TCANONICAL is missing. This should not happen. Check config.log for additional information.复制代码代码如下:yum -y install libc-client-develconfigure: error: freetype.h not found.复制代码代码如下:yum -y install freetype-develconfigure: error: xpm.h not found.复制代码代码如下:yum -y install libXpm-develconfigure: error: png.h not found.复制代码代码如下:yum -y install libpng-develconfigure: error: vpx_codec.h not found.复制代码代码如下:yum -y install libvpx-develconfigure: error: Cannot find enchant复制代码代码如下:yum -y install enchant-develconfigure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/复制代码代码如下:yum -y install libcurl-develLAOGAO added 20140907:configure: error: mcrypt.h not found. Please reinstall libmcrypt.复制代码代码如下:wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gztar zxf libmcrypt-2.5.7.tar.gzcd libmcrypt-2.5.7./configuremake && make installadded 20141003:Cannot find imap复制代码代码如下:ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.soconfigure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.复制代码代码如下:yum -y install libc-client-develCannot find ldap.h复制代码代码如下:yum -y install openldapyum -y install openldap-develconfigure: error: Cannot find ldap libraries in /usr/lib复制代码代码如下:cp -frp /usr/lib64/libldap* /usr/lib/configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path复制代码代码如下:yum -y install postgresql-develconfigure: error: Please reinstall the lib curl distribution复制代码代码如下:yum -y install curl-develconfigure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.复制代码代码如下:yum -y install net-snmp-develconfigure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution复制代码代码如下:yum -y install libxslt-develchecking for BZip2 support… yes checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution Fix:复制代码代码如下:yum -y install bzip2-develchecking for cURL support… yes checking if we should use cURL for url streams… no checking for cURL in default path… not found configure: error: Please reinstall the libcurl distribution – easy.h should be in/include/curl/Fix:复制代码代码如下:yum -y install curl-develchecking for curl_multi_strerror in -lcurl… yes checking for QDBM support… no checking for GDBM support… no checking for NDBM support… no configure: error: DBA: Could not find necessary header file(s).Fix:复制代码代码如下:yum -y install db4-develchecking for fabsf… yes checking for floorf… yes configure: error: jpeglib.h not found.Fix:复制代码代码如下:yum -y install libjpeg-develchecking for fabsf… yes checking for floorf… yes checking for jpeg_read_header in -ljpeg… yes configure: error: png.h not found. Fix:复制代码代码如下:yum -y install libpng-develchecking for png_write_image in -lpng… yes If configure fails try –with-xpm-dir=configure: error: freetype.h not found.Fix:复制代码代码如下:Reconfigure your PHP with the following option. --with-xpm-dir=/usrchecking for png_write_image in -lpng… yes configure: error: libXpm.(a|so) not found.Fix:复制代码代码如下:yum -y install libXpm-develchecking for bind_textdomain_codeset in -lc… yes checking for GNU MP support… yes configure: error: Unable to locate gmp.hFix:复制代码代码如下:yum -y install gmp-develchecking for utf8_mime2text signature… new checking for U8T_DECOMPOSE… configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.Fix:复制代码代码如下:yum -y install libc-client-develchecking for LDAP support… yes, shared checking for LDAP Cyrus SASL support… yes configure: error: Cannot find ldap.hFix:复制代码代码如下:yum -y install openldap-develchecking for mysql_set_character_set in -lmysqlclient… yes checking for mysql_stmt_next_result in -lmysqlclient… no checking for Oracle Database OCI8 support… no checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h' not found!Fix:复制代码代码如下:yum -y install unixODBC-develchecking for PostgreSQL support for PDO… yes, shared checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation pathFix:复制代码代码如下:yum -y install postgresql-develchecking for sqlite 3 support for PDO… yes, shared checking for PDO includes… (cached) /usr/local/src/php-5.3.7/ext checking for sqlite3 files in default path… not found configure: error: Please reinstall the sqlite3 distributionFix:复制代码代码如下:yum -y install sqlite-develchecking for utsname.domainname… yes checking for PSPELL support… yes configure: error: Cannot find pspellFix:复制代码代码如下:yum -y install aspell-develchecking whether to enable UCD SNMP hack… yes checking for default_store.h… nochecking for kstat_read in -lkstat… no checking for snmp_parse_oid in -lsnmp… no checking for init_snmp in -lsnmp… no configure: error: SNMP sanity check failed. Please check config.log for more information.Fix:复制代码代码如下:yum -y install net-snmp-develchecking whether to enable XMLWriter support… yes, shared checking for xml2-config path… (cached) /usr/bin/xml2-config checking whether libxml build works… (cached) yes checking for XSL support… yes, shared configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distributionFix:复制代码代码如下:yum -y install libxslt-develconfigure: error: xml2-config not found. Please check your libxml2 installation.Fix:复制代码代码如下:yum -y install libxml2-develchecking for PCRE headers location… configure: error: Could not find pcre.h in /usrFix:复制代码代码如下:yum -y install pcre-develconfigure: error: Cannot find MySQL header files under yes. Note that the MySQL client library is not bundled anymore!Fix:复制代码代码如下:yum -y install mysql-develchecking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h' not found!Fix:复制代码代码如下:yum -y install unixODBC-develchecking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path Fix:复制代码代码如下:yum -y install postgresql-develconfigure: error: Cannot find pspellFix:复制代码代码如下:yum -y install pspell-develconfigure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.Fix:复制代码代码如下:yum -y install net-snmp-develconfigure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distributionFix:复制代码代码如下:yum -y install libxslt-develconfigure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution复制代码代码如下:yum -y install libxslt-develconfigure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.复制代码代码如下:yum -y install net-snmp-develconfigure: error: Please reinstall readline - I cannot find readline.h复制代码代码如下:yum -y install readline-develconfigure: error: Cannot find pspell复制代码代码如下:yum -y install aspell-develchecking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found!复制代码代码如下:yum -y install unixODBC-develconfigure: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.复制代码代码如下:yum -y install libicu-develconfigure: error: utf8mime2text() has new signature, but U8TCANONICAL is missing. This should not happen. Check config.log for additional information.复制代码代码如下:yum -y install libc-client-develconfigure: error: freetype.h not found.复制代码代码如下:yum -y install freetype-develconfigure: error: xpm.h not found.复制代码代码如下:yum -y install libXpm-develconfigure: error: png.h not found.复制代码代码如下:yum -y install libpng-develconfigure: error: vpx_codec.h not found.复制代码代码如下:yum -y install libvpx-develconfigure: error: Cannot find enchant复制代码代码如下:yum -y install enchant-develconfigure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/复制代码代码如下:yum -y install libcurl-develLAOGAO added 20140907:configure: error: mcrypt.h not found. Please reinstall libmcrypt.复制代码代码如下:wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gztar zxf libmcrypt-2.5.7.tar.gzcd libmcrypt-2.5.7./configuremake && make installadded 20141003:Cannot find imap复制代码代码如下:ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.soconfigure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.复制代码代码如下:yum -y install libc-client-develCannot find ldap.h复制代码代码如下:yum -y install openldapyum -y install openldap-develconfigure: error: Cannot find ldap libraries in /usr/lib复制代码代码如下:cp -frp /usr/lib64/libldap* /usr/lib/configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path复制代码代码如下:configure: error: Please reinstall the lib curl distribution复制代码代码如下:yum -y install curl-develconfigure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.复制代码代码如下:yum -y install net-snmp-develconfigure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution复制代码代码如下:yum -y install libxslt-develchecking for BZip2 support… yes checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution Fix:复制代码代码如下:yum -y install bzip2-develchecking for cURL support… yes checking if we should use cURL for url streams… no checking for cURL in default path… not found configure: error: Please reinstall the libcurl distribution – easy.h should be in/include/curl/Fix:复制代码代码如下:yum -y install curl-develchecking for curl_multi_strerror in -lcurl… yes checking for QDBM support… no checking for GDBM support… no checking for NDBM support… no configure: error: DBA: Could not find necessary header file(s).Fix:复制代码代码如下:yum -y install db4-develchecking for fabsf… yes checking for floorf… yes configure: error: jpeglib.h not found.Fix:复制代码代码如下:yum -y install libjpeg-develchecking for fabsf… yes checking for floorf… yes checking for jpeg_read_header in -ljpeg… yes configure: error: png.h not found.Fix:复制代码代码如下:yum -y install libpng-develchecking for png_write_image in -lpng… yes If configure fails try –with-xpm-dir=configure: error: freetype.h not found.Fix:复制代码代码如下:Reconfigure your PHP with the following option. --with-xpm-dir=/usrchecking for png_write_image in -lpng… yes configure: error: libXpm.(a|so) not found.Fix:复制代码代码如下:yum -y install libXpm-develchecking for bind_textdomain_codeset in -lc… yes checking for GNU MP support… yes configure: error: Unable to locate gmp.hFix:复制代码代码如下:yum -y install gmp-develchecking for utf8_mime2text signature… new checking for U8T_DECOMPOSE… configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.Fix:复制代码代码如下:checking for LDAP support… yes, shared checking for LDAP Cyrus SASL support… yes configure: error: Cannot find ldap.hFix:复制代码代码如下:yum -y install openldap-develchecking for mysql_set_character_set in -lmysqlclient… yes checking for mysql_stmt_next_result in -lmysqlclient… no checking for Oracle Database OCI8 support… no checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h' not found!Fix:复制代码代码如下:yum -y install unixODBC-develchecking for PostgreSQL support for PDO… yes, shared checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation pathFix:复制代码代码如下:yum -y install postgresql-develchecking for sqlite 3 support for PDO… yes, shared checking for PDO includes… (cached) /usr/local/src/php-5.3.7/ext checking for sqlite3 files in default path… not found configure: error: Please reinstall the sqlite3 distributionFix:复制代码代码如下:yum -y install sqlite-develchecking for utsname.domainname… yes checking for PSPELL support… yes configure: error: Cannot find pspellFix:复制代码代码如下:yum -y install aspell-develchecking whether to enable UCD SNMP hack… yes checking for default_store.h… nochecking for kstat_read in -lkstat… no checking for snmp_parse_oid in -lsnmp… no checking for init_snmp in -lsnmp… no configure: error: SNMP sanity check failed. Please check config.log for more information.Fix:复制代码代码如下:yum -y install net-snmp-develchecking whether to enable XMLWriter support… yes, shared checking for xml2-config path… (cached) /usr/bin/xml2-config checking whether libxml build works… (cached) yes checking for XSL support… yes, shared configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distributionFix:复制代码代码如下:yum -y install libxslt-develconfigure: error: xml2-config not found. Please check your libxml2 installation.Fix:复制代码代码如下:yum -y install libxml2-develchecking for PCRE headers location… configure: error: Could not find pcre.h in /usrFix:复制代码代码如下:yum -y install pcre-develconfigure: error: Cannot find MySQL header files under yes. Note that the MySQL client library is not bundled anymore!Fix:复制代码代码如下:yum -y install mysql-develchecking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h' not found!Fix:复制代码代码如下:yum -y install unixODBC-develchecking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path Fix:复制代码代码如下:yum -y install postgresql-develconfigure: error: Cannot find pspellFix:复制代码代码如下:yum -y install pspell-develconfigure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.Fix:复制代码代码如下:yum -y install net-snmp-develconfigure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distributionFix:复制代码代码如下:yum -y install libxslt-devel。
内核引导失败的常见问题解决办法

内核引导常见问题Kernel - Common Problems Booting Linux作者:卢浩时间:2012.3.9转载请注明出处嵌入式爱好者开发群:122879839不少用户在尝试引导内核的时候,遇到了一些意外,内核的引导在某一点突然中断,并且不能进行下去,有时候是有个软件的bug导致的,而有时候可能是由于内核的错误的配置导致的,这篇文章是为开发者提供一些帮助来诊断为什么不能正常引导内核并且找出其中可能的原因。
问题1:内核只引导到"Starting Kernel...",然后串口终端就没有输出了,举个例子:## Booting kernel from Legacy Image at 80300000 ...Image Name: Linux-2.6.31Image Type: ARM Linux Kernel Image (uncompressed)Data Size: 1750680 Bytes = 1.7 MBLoad Address: 80008000Entry Point: 80008000Verifying Checksum ... OKLoading Kernel Image ... OKOKStarting kernel ...到这里,串口终端就没有再输出任何信息了.以上的串口输出信息是uboot的引导过程,至于这个starting kernel其实是uboot阶段输出最后的一句信息,这时候正准备进入内核引导。
这个错误一般由于错误的配置debug串口导致的,你可以检验下你内核配置的时候,你所配置的串口输出端口是多少。
打个比方,你用的是TI的omap3的beagle-board板子,其中UART3被用来输入调试信息,那么你打开linux-2.6.37(打个比方是这个版本的内核)下的.config文件,你会看到以下信息:# CONFIG_OMAP_LL_DEBUG_UART1 is not set# CONFIG_OMAP_LL_DEBUG_UART2 is not setCONFIG_OMAP_LL_DEBUG_UART3=y你会看到串口3是被设置为调试的串口。
基于WSL_2_子系统的嵌入式Linux_操作系统移植方法

第36卷第4期湖南理工学院学报(自然科学版)V ol. 36 No. 4 2023年12月 Journal of Hunan Institute of Science and Technology (Natural Sciences) Dec. 2023基于WSL 2子系统的嵌入式Linux操作系统移植方法王明菱, 刘测产, 张小春, 徐绯然(西昌卫星发射中心, 四川西昌 615000)摘要: 提出一种基于WSL 2子系统的嵌入式Linux操作系统移植方法. 该方法在Windows操作系统下搭建WSL 2子系统, 并安装Ubuntu 22.04操作系统, 用于嵌入式软件开发和交叉编译, 能极大提高计算机资源的利用效率. 同时, 采用QEMU开源虚拟化软件模拟各类硬件平台, 对裁剪后的操作系统、板级驱动和应用程序进行跨平台移植和快速验证, 有利于缩短产品开发周期, 提高研发效率.关键词:WSL; Ubuntu; QEMU; Linux; 系统移植中图分类号: TP316.8 文献标识码: A 文章编号: 1672-5298(2023)04-0024-06Transplantation Method of Embedded Linux OperatingSystem Based on WSL 2 SubsystemWANG Mingling, LIU Cechan, ZHANG Xiaochun, XU Feiran(Xichang Satellite Launch Center, Xichang 615000, China)Abstract: This paper puts forward a transplantation method of embedded Linux operating system based on WSL 2 subsystem. In this method, WSL2 subsystem is built under Windows operating system and Ubuntu 22.04 operating system is installed for embedded software development and cross-compilation, which can greatly improve the utilization efficiency of computer resources. At the same time, QEMU open source virtualization software is used to simulate various hardware platforms, cross-platform transplantation and rapid verification of the tailored operating system, board drivers and applications, which is conducive to shortening product development cycle and improving research and development efficiency.Key words: WSL; Ubuntu; QEMU; Linux; system transplantation0 引言现代嵌入式软硬件开发通常需要在特定的硬件平台上进行. 不同厂商和品牌的硬件板卡之间往往不兼容, 导致操作系统和软件移植困难, 硬件适配性差. 此外, 为了方便编写和修改开发过程中产生的大量软件工程化文档, 许多嵌入式软件开发者选择使用Windows操作系统. 因此他们通常需要在虚拟机平台(如VMware或VirtualBox)下进行交叉编译, 不仅工作效率低下, 而且难以维护. 为了解决上述问题, 本文提出了一种新的开发调试方法. 该方法在Windows操作系统下搭建WSL 2子系统, 并安装Ubuntu 22.04操作系统用于嵌入式软件开发和交叉编译, 同时采用QEMU开源虚拟化软件模拟各类硬件平台, 对裁剪后的操作系统、板级驱动和应用程序进行跨平台移植和快速验证, 有利于提高研发效率.1 仿真环境搭建QEMU是一款被广泛使用的开源仿真软件, 支持仿真嵌入式系统中的CPU、I/O、内存及其他硬件设备源, 被测软件可以完全摆脱对硬件资源的依赖, 为软件的调试运行、故障定位提供便利条件[1]. 与VMware Station相比, QEMU能够模拟一系列嵌入式开发板, 包括ARM、MIPS、RISC-V等不同架构. 模拟的开发板支持各种外设, 如串口、LCD、网卡、USB、SD卡等, 能够在模拟开发板上运行U-boot、Linux收稿日期: 2022-08-17作者简介: 王明菱, 男, 本科, 工程师. 主要研究方向: 嵌入式系统设计第4期王明菱, 等: 基于WSL 2子系统的嵌入式Linux操作系统移植方法 25和Rootfs. 对于没有实物开发板的使用者来说, 通过QEMU搭建虚拟开发板不仅方便快捷, 而且经济实用, 是学习嵌入式系统和研究U-boot、Linux内核的理想选择. 操作系统环境为Windows 11、WSL 2、Ubuntu 22.04子系统; QEMU版本为6.2.0; 交叉编译工具链版本为11.4.0; Linux内核版本为5.10.186; BusyBox版本为1.36.1.1.1 WSL子系统迁移在应用商城安装好Ubuntu 22.04子系统后, 该系统默认安装在C盘, 可能造成C盘空间紧张, 于是将其迁移至其他空闲分区.使用管理员身份打开powershell, 输入命令“wsl -l -v”查看WSL 2发行版本. 命令显示结果如图1所示, 不同环境下NAME可能会有所不同.图1 WSL子系统状态显示输入命令“wsl --shutdown”, 关闭WSL的Linux发行版.输入命令“wsl --export Ubuntu D:\ubuntu.tar”, 将操作系统导出到D盘.输入命令“wsl --unregister Ubuntu”, 注销原Linux发行版.在D盘的根目录下新建“D:\wsl”文件夹, 用于存放新的Ubuntu发行版, 然后使用命令“wsl --import Ubuntu D:\wsl\Ubuntu D:\ubuntu.tar --version 2”, 将“D:\ubuntu. tar”导入到“D:\wsl”文件夹下.导入成功后, 输入指令“Ubuntu config --default-user ubuntu”, 修复默认登陆用户, 其中最后的“ubuntu”可改为自己的用户名.1.2 配置安装交叉编译环境安装x86-arm交叉编译器gcc和g++以及其他配套支持软件,并检验交叉编译器安装是否成功, 可输入指令“arm-linux-gnueabi-gcc-v”. 若出现如图2所示的提示, 则说明交叉编译器安装成功.图2 交叉编译环境搭建成功提示安装QEMU开源仿真软件及其配套依赖并检验QEMU是否安装成功, 可输入指令“qemu-system-arm --version”. 若出现如图3所示的提示, 则说明QEMU安装成功.图3 QEMU安装成功提示2 Linux内核编译Linux 是全面的多任务操作系统, 能支持X86、ARM、MIPS、ALPHA、SPARC等多种不同的体系结构, 其高效性和稳定性已经在各个领域尤其是在网络服务器领域得到了验证, 而且Linux 内核小巧灵活, 易于裁剪[2].26 湖南理工学院学报(自然科学版) 第36卷Linux内核是Linux操作系统的核心代码, 负责与硬件进行交互, 并实现资源调度、内存管理、存储管理、进程管理、文件系统、设备驱动、网络通信和系统调用等功能.接下来介绍如何下载、编译Linux内核源码, 并将其移植到QEMU虚拟开发板上, 以实现运行.在官方网站“”上获取Linux内核源码, 解压并编译.wget https:///pub/linux/kernel/v5.x/linux-5.10.186.tar.xztar -xvf linux-5.10.186.tar.xzcd linux-5.10.191make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- vexpress_defconfimake ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j12make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LOADADDR=0x60003000 uImage -j12 输入以下指令, 尝试运行QEMU加载Linux内核.qemu-system-arm -M vexpress-a9 \-m 512M \-kernel arch/arm/boot/zImage \-dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb \-nographi若出现如图4所示的提示界面, 则说明内核已经成功运行, 但文件系统尚未挂载.图4 内核运行提示界面3 建立根文件系统并挂载根文件系统是内核启动时挂载的第一个文件系统, 内核代码映像文件就保存在根文件系统中. 系统引导启动程序会在挂载根文件系统后, 从中加载一些基本的初始化脚本和服务到内存中运行[3].3.1 建立根文件系统根文件系统的制作方法有很多, 如Buildroot、BusyBox等, 本文采用安装过程最为简单的轻量级根文件系统制作工具BusyBox.从官方网站“”下载、解压并编译BusyBox源码.wget https:///downloads/busybox-1.36.1.tar.bz2tar -xvf busybox-1.36.1.tar.bz2cd busybox-1.36.1make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfigmake ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j12make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-编译过程中会出现Configuration界面, 需要将“Settings->Build Options->Build static binary”选上, 如图5所示.BusyBox默认将根文件系统放在_install文件夹下, 此时构建的根文件系统仅仅是一系列支撑Linux 操作系统基本运行的可执行文件, 若想将根文件系统挂载起来, 还需要手动生成脚本文件、配置文件、设备节点和动态链接库.第4期王明菱, 等: 基于WSL 2子系统的嵌入式Linux操作系统移植方法 27在“_install”文件夹下创建“dev/tty1” “dev/tty2” “dev/tty3” “dev/tty4” “dev/console” “dev/null”等设备节点,建立动态链接库, 同时创建初始化脚本“etc/init.d/rcS”, 并在rcS中填入环境变量导出、初始节点挂载、临时路径创建等初始化相关内容.图5 界面选项创建自动挂载配置文件“etc/fstab”, 并在fstab中填入自动挂载节点的相关内容.创建初始化脚本映射文件“etc/inittab”, 并在inittab中填入初始化脚本的相关内容.配置初始化环境变量“etc/profile”, 并在profile内填入以下内容[4].#!/bin/shUSER="root"LOGNAME=$USER# export HOSTNAME=vexpress-a9export HOSTNAME=`cat /etc/sysconfig/HOSTNAME`export USER=rootexport HOME=rootexport PS1="[$USER@$HOSTNAME:\w]\#"PATH=/bin:/sbin:/usr/bin:/usr/sbinLD_LIBRARY_PATH=/lib:/usr/lib:$LD_LIBRARY_PATHexport PATH LD_LIBRARY_PATH输入以下指令, 创建其他文件夹.mkdir mnt proc root sys tmp var至此, 根文件系统的内容已经补充完毕. 接下来将介绍两种挂载根文件系统的方法: 一种是通过在QEMU上添加外设SD卡来挂载根文件系统, 另一种是通过NFS共享文件夹来挂载根文件系统.3.2 使用SD卡挂载根文件系统进入busybox-1.36.1文件夹的根目录, 输入指令创建ext3格式的文件系统模拟SD卡:sudo mkdir /mnt/rootfssudo chmod 777 /mnt/rootfsdd if=/dev/zero of=rootfs-arm32.ext3 bs=1M count=64mkfs.ext3 rootfs-arm32.ext3sudo mount -t ext3 rootfs-arm32.ext3 /mnt/rootfs -o loopsudo cp -rf ./_install/* /mnt/rootfs/sudo umount /mnt/rootfs此时根文件系统已被装进模拟SD卡内.将busybox-1.36.1、linux-5.10.186两个文件夹放在同一个目录下, 暂称为WorkSpace目录. 进入该目录并执行如下指令, 尝试引导Linux内核并挂载根文件系统:28 湖南理工学院学报(自然科学版) 第36卷qemu-system-arm -M vexpress-a9 \-m 512M \-kernel ./linux-5.10.186/arch/arm/boot/zImage \-dtb ./linux-5.10.186/arch/arm/boot/dts/vexpress-v2p-ca9.dtb \-nographic \-append "root=/dev/mmcblk0 rw console=ttyAMA0" \-sd ./busybox-1.36.1/rootfs-arm32.ext3若出现如图6所示的界面, 则说明根文件系统挂载成功.图6 模拟SD卡挂载根文件系统成功界面3.3 使用NFS挂载根文件系统在嵌入式软件调试过程中, 开发人员经常需要与开发板交换文件或修改配置文件. 如果使用SD卡挂载根文件系统, 那么每次文件交换都需要重新启动操作系统.为了提高开发效率, 开发人员可以添加NFS(Network File System)网络服务支持. 目前, NFS有诸多应用, 其中最主要的是通过配置完成网络文件的挂载, 即用它实现网络文件共享[5].给开发板使用NFS共享主机上的根文件系统, 可以将主机上修改完善并交叉编译后的可执行文件直接在开发板上运行, 实现无缝对接.安装和配置NFS网络文件系统, 输入指令:sudo apt install nfs-kernel-serversudo mkdir -p /sync/rootfssudo vim /etc/exports在exports文件中添加内容, 输入指令:/sync/rootfs *(rw,sync,no_root_squash,no_subtree_check)配置文件“/etc/default/nfs-kernel-server” , 输入指令:sudo vim /etc/default/nfs-kernel-server在nfs-kernel-server文件中修改RPCSVCGSSDOPTS的属性, 输入指令:RPCSVCGSSDOPTS="--nfs-version 2,3,4 --debug --syslog"重启NFS服务器, 输入指令:sudo /etc/init.d/rpcbind restartsudo /etc/init.d/nfs-kernel-server restart进入busybox-1.36.1根目录, 输入以下指令, 将创建好的根文件系统拷贝到“/sync/rootfs”文件夹下: sudo cp -rf * /sync/rootfs/sudo chmod 777 -R /sync/rootfs创建tap0网卡, 用于连接QEMU虚拟开发板, 输入指令:sudo tunctl -u root -t tap0sudo ifconfig tap0 192.168.1.1 promisc up进入WorkSpace目录, 输入以下指令, 运行QEMU并通过NFS挂载根文件系统:sudo qemu-system-arm \第4期王明菱, 等: 基于WSL 2子系统的嵌入式Linux操作系统移植方法 29 -M vexpress-a9 \-m 512M \-kernel ./linux-5.10.186/arch/arm/boot/zImage \-dtb ./linux-5.10.186/arch/arm/boot/dts/vexpress-v2p-ca9.dtb \-net tap,ifname=tap0,script=no,downscript=no \-net nic,macaddr=00:16:3e:00:00:01 \-nographic \-append "root=/dev/nfs rw nfsroot=1192.168.1.1:/sync/rootfs,proto=tcp,nfsvers=3,nolockinit=/linuxrc console=ttyAMA0 ip=192.168.1.100"若出现如图7所示的界面, 说明NFS挂载根文件系统成功.图7 NFS挂载根文件系统成功界面根文件系统挂载成功后, 即可对开发板进行进一步调试, 例如加载内核驱动模块、运行应用程序等.4 结束语本文介绍QEMU仿真环境和开发环境, 以Vexpress-A9开发板为例, 逐步深入描述了Linux内核源码编译、建立文件系统的详细步骤, 并采用两种不同的方式挂载根文件系统, 为嵌入式系统开发者进行跨平台操作系统裁剪移植、驱动调试、应用软件快速验证等工作提供了一种新的手段和思路, 使得嵌入式软件学习、开发和验证不再拘泥于实物开发板, 有利于提高嵌入式软件开发效率.参考文献:[1]张磊, 陈程, 林卓, 等. 基于QEMU的AARCH64平台仿真技术的研究[J]. 电脑编程技巧与维护, 2023(4): 120−122.[2]田磊. 基于ARM的嵌入式Linux操作系统的移植[D]. 西安: 西安电子科技大学, 2009.[3]程琼, 孙敏. 基于3G和嵌入式技术的数据传输系统设计[J]. 工业控制计算机, 2012, 25 (12): 93−94+96.[4]史巧硕, 范东月, 柴欣, 等. 嵌入式Linux根文件系统的构建与分析[J]. 计算机测量与控制, 2015, 23(2): 656−659+663.[5]赵娜靖, 佟志勇, 李超然, 等. 基于设备树平台下Exynos4412嵌入式Linux系统移植[J]. 2020, 11(4): 75−80.。
嵌入式linux内核移植步骤

嵌入式linux内核移植步骤嵌入式Linux内核移植步骤嵌入式Linux内核移植是将Linux内核移植到特定的硬件平台上的过程。
在进行嵌入式Linux内核移植之前,需要先了解目标硬件平台的相关信息,包括处理器架构、硬件接口、设备驱动等。
本文将介绍嵌入式Linux内核移植的主要步骤,以帮助读者了解移植的过程。
1. 获取源代码需要从官方或其他可靠的渠道获取Linux内核的源代码。
可以选择下载最新版本的稳定内核,也可以根据需要选择特定版本的内核。
获取源代码后,解压到本地目录。
2. 配置内核在进行内核配置之前,需要根据目标硬件平台选择适当的配置文件。
内核配置文件包含了编译内核所需的各种选项和参数。
可以使用make menuconfig或make defconfig命令进行内核配置。
在配置过程中,需要根据目标硬件平台的特点进行相应的配置,如选择正确的处理器类型、设备驱动等。
3. 编译内核配置完成后,可以使用make命令编译内核。
编译过程可能会比较耗时,需要根据计算机性能进行相应的等待。
编译完成后,会生成vmlinuz和相关的模块文件。
4. 编译设备树设备树是描述硬件平台的一种数据结构,用于在内核启动时传递硬件信息给内核。
如果目标硬件平台需要使用设备树,需要将设备树源文件编译为二进制文件。
可以使用device tree compiler(dtc)工具来编译设备树。
5. 烧录内核内核编译完成后,需要将生成的vmlinuz文件烧录到目标硬件平台上。
根据硬件平台的不同,可以使用不同的烧录工具,如dd命令、fastboot等。
烧录完成后,可以通过串口或其他方式查看内核启动信息。
6. 配置文件系统内核烧录完成后,需要为目标硬件平台配置文件系统。
可以选择使用已有的文件系统,如busybox、buildroot等,也可以根据需求自行定制文件系统。
配置文件系统包括选择合适的文件系统类型、添加必要的应用程序和驱动、配置网络等。
Linux内核编译及常见错误实验报告

***学生实验报告一、实验目的(1)学习重新编译Linux内核的方法(2)理解Linux标准内核和发行版本内核的区别。
二、实验内容在Linux系统中下载同一发行版本的版本号较高的内核,编译之后运行自己编译的内核,并使用uname-r命令查看是否运行成功。
由于不同版本的内核在编译过程中可能出现不同的问题,本书推荐的内核版本为4.16.10。
从第7章开始的进阶实验篇,都可以选用该版本的内核。
三、实验设备Vmware上运行的linux ubuntu 5.11.0-43-generic实验成功:linux ubuntu 4.18.0-generic(Ubuntu18.04均可)实验成功的方法在最后四、实验过程和原理分析一、实验(一)准备工作:在这里我建议用一个全新的虚拟机,避免编译错误对原来常使用的虚拟机造成不可逆的影响,安装好后就先安装gcc、make等工具首先下载好Linux***内核文件解压至/usr/src 目录下,如下:确认安装好gcc、make等工具,后可直接运行命令sudo make menuconfig进行查看内核功能是否需要编译,如果遇到如下错误可以运行命令sudo apt bison 或sudo apt-get install fiex bison命令解决错误:解决:(不建议)(强烈建议)除此之外还可以直接运行,上一条命令解决不了就用下面这个:sudo apt-get install --reinstall bison libbison-dev flex libfl-dev解决上述错误(强烈建议)运行完上述命令后再次输入sudo make menuconfig便正常进入如下:见到这个界面后无需任何多余操作,使用键盘方向键选择<Save>回车再回车即可此时.config文件生成成功.config文件是隐藏文件记得加参数-a此外还有一个方法就是用cp 命令从原有系统的内核复制.config文件过来也可以命令:sudo cp /boot/config- 5.11.0-43-generic ./.config(二)编译内核为了避免多线程编译时同时出现过多错误,我们这里一开始只使用单线程编译在这里除了用make编译还可以用make-kpkg等工具,个人比较喜欢用make-kpkg但课本用make所以我接下来的实验也先用make完成。
arm_linux_yaffs2文件系统移植到内核GUN编译错误问题处理

yaffs2更新的比较慢,跟不上内核的更新速度.所以只能自己做些修改first step刚开始从官网下载下来的直接打补丁后会出现一系列的错误.如下:**fs/yaffs2/yaffs_vfs.c: In function 'yaffs_readpage_nolock':fs/yaffs2/yaffs_vfs.c:286:34: error: 'struct file' has no member named 'f_dentry'obj = yaffs_dentry_to_obj(f->f_dentry);^fs/yaffs2/yaffs_vfs.c: In function 'yaffs_hold_space':fs/yaffs2/yaffs_vfs.c:484:34: error: 'struct file' has no member named 'f_dentry'obj = yaffs_dentry_to_obj(f->f_dentry);^fs/yaffs2/yaffs_vfs.c: In function 'yaffs_release_space':fs/yaffs2/yaffs_vfs.c:502:34: error: 'struct file' has no member named 'f_dentry'obj = yaffs_dentry_to_obj(f->f_dentry);^fs/yaffs2/yaffs_vfs.c: In function 'yaffs_file_write':fs/yaffs2/yaffs_vfs.c:594:34: error: 'struct file' has no member named 'f_dentry'obj = yaffs_dentry_to_obj(f->f_dentry);^fs/yaffs2/yaffs_vfs.c:606:11: error: 'struct file' has no member named 'f_dentry'inode = f->f_dentry->d_inode;^fs/yaffs2/yaffs_vfs.c: In function 'yaffs_file_flush':fs/yaffs2/yaffs_vfs.c:730:55: error: 'struct file' has no member named 'f_dentry'struct yaffs_obj *obj = yaffs_dentry_to_obj(file->f_dentry);^fs/yaffs2/yaffs_vfs.c: At top level:fs/yaffs2/yaffs_vfs.c:780:10: error: 'new_sync_read' undeclared here (not in a function).read = new_sync_read,^fs/yaffs2/yaffs_vfs.c:781:11: error: 'new_sync_write' undeclared here (not in a function).write = new_sync_write,^fs/yaffs2/yaffs_vfs.c: In function 'yaffs_follow_link':fs/yaffs2/yaffs_vfs.c:1078:2: error: implicit declaration of function 'nd_set_link' [-Werror=implicit-function-declaration]nd_set_link(nd, alias);^fs/yaffs2/yaffs_vfs.c: At top level:fs/yaffs2/yaffs_vfs.c:1118:17: warning: initialization from incompatible pointer type.follow_link = yaffs_follow_link,^fs/yaffs2/yaffs_vfs.c:1118:17: warning: (near initialization for'yaffs_symlink_inode_operations.follow_link')fs/yaffs2/yaffs_vfs.c:1120:14: warning: initialization from incompatible pointer type.put_link = yaffs_put_link,^fs/yaffs2/yaffs_vfs.c:1120:14: warning: (near initialization for'yaffs_symlink_inode_operations.put_link')fs/yaffs2/yaffs_vfs.c: In function 'yaffs_iterate':fs/yaffs2/yaffs_vfs.c:1730:34: error: 'struct file' has no member named 'f_dentry'obj = yaffs_dentry_to_obj(f->f_dentry);^cc1: some warnings being treated as errorsmake[4]: *** [fs/yaffs2/yaffs_vfs.o] Error 1make[3]: *** [fs/yaffs2] Error 2make[2]: *** [fs] Error 2make[2]: *** Waiting for unfinished jobs....make[1]: ***[/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16 /.stamp_built] Error 2make: *** [_all] Error 2**上面有三个问题要解决∙1: error: ‘struct file’ has no member named ‘f_dentry’∙2: error: ‘new_sync_read/write’ undeclared here∙3: error: implicit declaration of function ‘nd_set_link’1 ‘struct file’ has no member named‘f_dentry’第一个是由于新内核的file结构体发生了变化,把dentry这个成员放到了path 结构体里,这里只要更改下就行.struct file {union {struct llist_node fu_llist;struct rcu_head fu_rcuhead;} f_u;struct path f_path;struct path {struct vfsmount *mnt;struct dentry *dentry;};直接在yaffs_vfs.c里加上下列定义就行,或者全部替换#define f_dentry f_path.dentry#define f_vfsmnt f_path.mnt2 ‘new_sync_read/write’ undeclared here对于第2个问题是由于新内核没有”new_sync_read/write”这两个导出函数了,改成.read = __vfs_read,//new_sync_read.write = __vfs_write, //new_sync_write3 error: implicit declaration of function‘nd_set_link’到linux官网查询发现4.4.16内核里已经不用nd_set_link这个函数了,因此要修改用到这个函数的地方.主要就是yaffs_follow_link这个函数啦,yaffs_follow_link的定义主要参考你的include/Linux/fs.h里的struct inode_operations.follow_link来定义.以前的alias是保存在 nd->saved_names里,现在这个成员已经被删除了,直接通过函数返回值返回,并且保存在*cookie中@@ -1053,7 +1062,11 @@}#if (YAFFS_NEW_FOLLOW_LINK == 1)+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 16)static void *yaffs_follow_link(struct dentry *dentry, struct nameidata *nd)+#else+static const char *yaffs_follow_link(struct dentry *dentry,void**cookie)+#endif{void *ret;#else@@ -1075,7 +1088,11 @@goto out;}#if (YAFFS_NEW_FOLLOW_LINK == 1)+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 16)nd_set_link(nd, alias);+#else+ *cookie = alias;+#endifret = alias;out:if (ret_int)@@ -1107,10 +1124,17 @@#endif#if (YAFFS_NEW_FOLLOW_LINK == 1)+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 16)void yaffs_put_link(struct dentry *dentry, struct nameidata *nd, void *alias){kfree(alias);}+#else+void yaffs_put_link(struct inode *inode,void *alias)+{+ kfree(alias);+}+#endif#endifstatic const struct inode_operations yaffs_symlink_inode_operations = {second step以上修改完后在编译时还会出现下列的错误:In file included from fs/yaffs2/yaffs_nameval.c:28:0:fs/yaffs2/yaffs_nameval.h:21:21: warning: 'struct yaffs_dev' declared inside parameter listint nval_del(struct yaffs_dev *dev, char *xb, int xb_size, const YCHAR * name);^fs/yaffs2/yaffs_nameval.h:21:21: warning: its scope is only this definition or declaration, which is probably not what you wantfs/yaffs2/yaffs_nameval.h:24:7: warning: 'struct yaffs_dev' declared inside parameter listint bsize, int flags);^fs/yaffs2/yaffs_nameval.h:27:7: warning: 'struct yaffs_dev' declared inside parameter listint bsize);^fs/yaffs2/yaffs_nameval.h:29:8: warning: 'struct yaffs_dev' declared inside parameter listconst char *xb, int xb_size, char *buf, int bsize);^fs/yaffs2/yaffs_nameval.h:30:27: warning: 'struct yaffs_dev' declared inside parameter listint nval_hasvalues(struct yaffs_dev *dev, const char *xb, int xb_size); ^fs/yaffs2/yaffs_nameval.c:82:5: error: conflicting types for 'nval_del' int nval_del(struct yaffs_dev *dev, char *xb, int xb_size, const YCHAR *name)^In file included from fs/yaffs2/yaffs_nameval.c:28:0:fs/yaffs2/yaffs_nameval.h:21:5: note: previous declaration of'nval_del' was hereint nval_del(struct yaffs_dev *dev, char *xb, int xb_size, const YCHAR * name);^fs/yaffs2/yaffs_nameval.c:100:5: error: conflicting types for'nval_set'int nval_set(struct yaffs_dev *dev,^In file included from fs/yaffs2/yaffs_nameval.c:28:0:fs/yaffs2/yaffs_nameval.h:22:5: note: previous declaration of'nval_set' was hereint nval_set(struct yaffs_dev *dev,^fs/yaffs2/yaffs_nameval.c:145:5: error: conflicting types for'nval_get'int nval_get(struct yaffs_dev *dev,^In file included from fs/yaffs2/yaffs_nameval.c:28:0:fs/yaffs2/yaffs_nameval.h:25:5: note: previous declaration of'nval_get' was hereint nval_get(struct yaffs_dev *dev,^fs/yaffs2/yaffs_nameval.c:185:5: error: conflicting types for'nval_list'int nval_list(struct yaffs_dev *dev, const char *xb, int xb_size, char *buf, int bsize)^In file included from fs/yaffs2/yaffs_nameval.c:28:0:fs/yaffs2/yaffs_nameval.h:28:5: note: previous declaration of'nval_list' was hereint nval_list(struct yaffs_dev *dev,^fs/yaffs2/yaffs_nameval.c:227:5: error: conflicting types for'nval_hasvalues'int nval_hasvalues(struct yaffs_dev *dev, const char *xb, int xb_size) ^In file included from fs/yaffs2/yaffs_nameval.c:28:0:fs/yaffs2/yaffs_nameval.h:30:5: note: previous declaration of'nval_hasvalues' was hereint nval_hasvalues(struct yaffs_dev *dev, const char *xb, int xb_size); ^make[4]: *** [fs/yaffs2/yaffs_nameval.o] Error 1make[3]: *** [fs/yaffs2] Error 2make[2]: *** [fs] Error 2make[2]: *** Waiting for unfinished jobs....make[1]: ***[/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16 /.stamp_built] Error 2make: *** [_all] Error 2解释:error: conflicting types for ‘nval_del’,查看nval_del几个函数,这里我看不出有什么类型冲突错误,网上搜了下主要是第一个WARNING那里引起的.在yaffs_nameval.h中,结构体struct yaffs_dev的定义出现在参数列表中,而在此之前没有定义,这样会导致函数不识别这个结构体引发上面的错误,查询了下struct yaffs_dev在”yaffs_guts.h”中被定义,因此在yaffs_nameval.h 文件中include下”yaffs_guts.h”就OK了third step通过上两个修改后可能还会遇到下面的两个错误:error: unknown type name ‘Y_LOFF_T’In file included from fs/yaffs2/yaffs_guts.c:18:0:fs/yaffs2/yaffs_endian.h:32:86: error: unknown type name 'Y_LOFF_T' static inline Y_LOFF_T swap_loff_t(Y_LOFF_T lval)^fs/yaffs2/yaffs_endian.h:32:107: error: unknown type name 'Y_LOFF_T' static inline Y_LOFF_T swap_loff_t(Y_LOFF_T lval)^make[4]: *** [fs/yaffs2/yaffs_guts.o] Error 1make[3]: *** [fs/yaffs2] Error 2make[2]: *** [fs] Error 2make[2]: *** Waiting for unfinished jobs....make[1]: ***[/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16 /.stamp_built] Error 2make: *** [_all] Error 2这个好解决,在yaffs_endian.h中加上如下定义:#ifndef Y_LOFF_T#define Y_LOFF_T loff_t#endifyaffs_guts.c:line: undefined reference to functionfs/built-in.o: In function `yaffs_check_obj_details_loaded':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_guts.c:3254: undefined reference to`yaffs_do_endian_oh'fs/built-in.o: In function `yaffs_oh_size_load':fs/yaffs2/yaffs_guts.c:5165: undefined reference to`yaffs_do_endian_u32'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_guts.c:5166: undefined reference to`yaffs_do_endian_u32'fs/built-in.o: In function `yaffs_update_oh':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_guts.c:3401: undefined reference to`yaffs_do_endian_oh'fs/built-in.o: In function `yaffs_guts_initialise':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_guts.c:4912: undefined reference to`yaffs_endian_config'fs/built-in.o: In function `yaffs_oh_size_load':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_guts.c:5165: undefined reference to`yaffs_do_endian_u32'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_guts.c:5166: undefined reference to`yaffs_do_endian_u32'fs/built-in.o: In function `yaffs_oh_to_size':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_guts.c:5181: undefined reference to`yaffs_do_endian_u32'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_guts.c:5182: undefined reference to`yaffs_do_endian_u32'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_guts.c:5190: undefined reference to`yaffs_do_endian_u32'fs/built-in.o: In function `yaffs_pack_tags2_tags_only':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_packedtags2.c:111: undefined reference to`yaffs_do_endian_packed_tags2'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_packedtags2.c:111: undefined reference to`yaffs_do_endian_packed_tags2'fs/built-in.o: In function `yaffs_unpack_tags2_tags_only':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_packedtags2.c:137: undefined reference to`yaffs_do_endian_packed_tags2'fs/built-in.o: In function `yaffs_load_tags_to_spare':fs/yaffs2/yaffs_tagscompat.c:92: undefined reference to`yaffs_do_endian_u32'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_tagscompat.c:93: undefined reference to`yaffs_do_endian_u32'fs/built-in.o: In function `yaffs_get_tags_from_spare':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_tagscompat.c:122: undefined reference to`yaffs_do_endian_u32'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_tagscompat.c:123: undefined reference to`yaffs_do_endian_u32'fs/built-in.o: In function `nval_used':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_nameval.c:69: undefined reference to`yaffs_do_endian_s32'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_nameval.c:75: undefined reference to`yaffs_do_endian_s32'fs/built-in.o: In function `nval_find':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_nameval.c:41: undefined reference to`yaffs_do_endian_s32'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_nameval.c:53: undefined reference to`yaffs_do_endian_s32'fs/built-in.o: In function `nval_del':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_nameval.c:93: undefined reference to`yaffs_do_endian_s32'fs/built-in.o:/home/anzyelay/Downloads/buildroot-2016.05/output/build /linux-4.4.16/fs/yaffs2/yaffs_nameval.c:136: more undefined references to `yaffs_do_endian_s32' followfs/built-in.o: In function `yaffs2_checkpt_tnode_worker':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_yaffs2.c:599: undefined reference to`yaffs_do_endian_u32'fs/built-in.o: In function `yaffs2_wr_checkpt_sum':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_yaffs2.c:811: undefined reference to`yaffs_do_endian_u32'fs/built-in.o: In function `yaffs2_rd_checkpt_tnodes':fs/yaffs2/yaffs_yaffs2.c:647: undefined reference to`yaffs_do_endian_u32'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_yaffs2.c:671: undefined reference to`yaffs_do_endian_u32'fs/built-in.o: In function `yaffs2_rd_checkpt_sum':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_yaffs2.c:835: undefined reference to`yaffs_do_endian_u32'fs/built-in.o: In function `yaffs2_scan_chunk':/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_yaffs2.c:1302: undefined reference to`yaffs_do_endian_oh'/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16/ fs/yaffs2/yaffs_yaffs2.c:1302: undefined reference to`yaffs_do_endian_oh'make[2]: *** [vmlinux] Error 1make[1]: ***[/home/anzyelay/Downloads/buildroot-2016.05/output/build/linux-4.4.16 /.stamp_built] Error 2make: *** [_all] Error 2anzyelay@ubuntu:buildroot-2016.05$这个看了下明明这些函数都有定义有实现怎么就是不识别呢??头文件这些也包函了,网上找了下说编译器没有编译到譔文件可有导致其它函数引用时无法识别,我看了下编译情况, 其它的.c文件都编译成.o了,然后打开Makefile一看果然没有加进来,yaffs真的不省心,在Makefile.kernel里增加如下 :yaffs-y += yaffs_endian.o这回万恶的错误都没了吧.编译后是OK的了,至于启动后有没有其它原因导致的错误就不得而知了.yaffs的补丁文件如下:diff -Nur yaffs2/Makefile.kernel yaffs2.anzyelay/Makefile.kernel--- yaffs2/Makefile.kernel 2016-07-29 14:01:01.778572877 +0800+++ yaffs2.anzyelay/Makefile.kernel 2016-08-03 10:29:07.361276458 +0800 @@ -15,4 +15,5 @@yaffs-y += yaffs_bitmap.oyaffs-y += yaffs_summary.oyaffs-y += yaffs_verify.o+yaffs-y += yaffs_endian.odiff -Nur yaffs2/yaffs_endian.h yaffs2.anzyelay/yaffs_endian.h--- yaffs2/yaffs_endian.h 2016-07-29 14:01:01.814572879 +0800+++ yaffs2.anzyelay/yaffs_endian.h 2016-08-03 11:18:12.633411085+0800@@ -29,6 +29,9 @@#define swap_s32(val) \(s32)(swap_u32((u32)(val)))+#ifndef Y_LOFF_T+#define Y_LOFF_T loff_t +#endifstatic inline Y_LOFF_T swap_loff_t(Y_LOFF_T lval){u32 vall = swap_u32((u32) (lval & 0xffffffff));diff -Nur yaffs2/yaffs_nameval.h yaffs2.anzyelay/yaffs_nameval.h--- yaffs2/yaffs_nameval.h 2016-07-29 14:01:01.818572879 +0800+++ yaffs2.anzyelay/yaffs_nameval.h 2016-08-03 11:22:07.409421602 +0800@@ -17,6 +17,7 @@#define __NAMEVAL_H__#include "yportenv.h"+#include "yaffs_guts.h"int nval_del(struct yaffs_dev *dev, char *xb, int xb_size, const YCHAR* name);int nval_set(struct yaffs_dev *dev,diff -Nur yaffs2/yaffs_vfs_multi.c yaffs2.anzyelay/yaffs_vfs_multi.c--- yaffs2/yaffs_vfs_multi.c 2016-07-29 14:01:01.818572879 +0800+++ yaffs2.anzyelay/yaffs_vfs_multi.c 2016-08-03 11:06:42.877379435+0800@@ -76,6 +76,10 @@#include <linux/slab.h>#include <linux/init.h>#include <linux/fs.h>+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 16))+#define f_dentry f_path.dentry+#define f_vfsmnt f_path.mnt+#endif#include <linux/proc_fs.h>#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))#include <linux/smp_lock.h>@@ -777,8 +781,13 @@#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))static const struct file_operations yaffs_file_operations = {#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 16)//anzyelay+ .read = __vfs_read,+ .write = __vfs_write,+#else.read = new_sync_read,.write = new_sync_write,+#endif.read_iter = generic_file_read_iter,.write_iter = generic_file_write_iter,#else@@ -1053,7 +1062,11 @@}#if (YAFFS_NEW_FOLLOW_LINK == 1)+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 16)static void *yaffs_follow_link(struct dentry *dentry, struct nameidata *nd)+#else+static const char *yaffs_follow_link(struct dentry *dentry,void**cookie)+#endif{void *ret;#else@@ -1075,7 +1088,11 @@goto out;}#if (YAFFS_NEW_FOLLOW_LINK == 1)+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 16)nd_set_link(nd, alias);+#else+ *cookie = alias;+#endifret = alias;out:if (ret_int)@@ -1107,10 +1124,17 @@#endif#if (YAFFS_NEW_FOLLOW_LINK == 1)+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 16)void yaffs_put_link(struct dentry *dentry, struct nameidata *nd, void *alias){kfree(alias);}+#else+void yaffs_put_link(struct inode *inode,void *alias)+{+ kfree(alias);+}+#endif#endifstatic const struct inode_operations yaffs_symlink_inode_operations = {。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
08.05.11、<*> RAM disk support
09.27.07、<*> Compressed ROM file system support (cramfs)
1.问题一
下载内核到flash中,运行到如下即停止没有下文:
Uncompressing Linux……………………done,booting the kernel
如果是内核NAND flash分区的问题,则作如下修改:
1. 1修改文件arch/arm/mach-s3c2410/devs.c,添加如下信息:
#include <linux/mtd/partitions.h>
#include <asm/arch/nand.h>
#include <linux/mtd/nand.h>
.resource = s3c_nand_resource, /*黑体为新加内容*/
.dev = {
.platform_data=&s3c_nand_info
}
};
1.2在arch/arm/mach-s3c2410/mach-smdk2410.c文件中添加&s3c_device_nand,如下所示:
starting pid 229, tty '': '/etc/init.d/rcS'
Please press Enter to activate this console.
4.系统启动到到如下语句即停止不前,停在那里:
VFS:Mounted root (cramfs filesystem) readonly.
0x00000000-0x00040000 : "boot"
mtd: Giving out device 0 to boot
0x00040000-0x00200000 : "kernel"
mtd: Giving out device 1 to kernel
0x00200000-0x02000000 : "rootfs"
{
tacls:0,
twrph0:30,
twrph1:0,
sets:&nandset,
nr_sets:1,
};
struct platform_device s3c_device_nand={
.name="s3c2410-nand",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_nand_resources),
struct s3c2410_nand_set nandset=
{
nr_partitions:5,
partitions:partition_info,
};
struct s3c2410_platform_nand s3c_nand_info=
{
tacls:0,
twrph0:30andset,
static struct mtd_partition partition_info[]=
{
{
name:"bootloader",
size:0x00040000,
offset:0,
},
{
name:"kernel",
size:0x001c0000,
offset:0x00040000,
},
{
name:"rootfs",
VFS: Cannot open root device "<NULL>" or unknown-block(2,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
static struct platform_device * smdk2410_device[] _initdata=
{
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
&s3c_device_nand,
或者类似的错误。
原因分析:我在这里耗了大量的时间,这种情况一般是NAND flash分区未能分正确,或者所在的分区上没有文件系统,当启动中出现类似如下信息时表明分区正确了
Scanning device for bad blocks
Creating 5 MTD partitions on "NAND 64MiB 3,3V 8-bit":
starting pid 229, tty '': '/etc/init.d/rcS'
Reading data from NAND FLASH without ECC is not recommended
the error code is:0,name=/dev/root,fs=cramfs,flags=32769
从上面看出我的文件系统放在第三个分区rootfs上,其设备号为2,启动后文件系统能挂上,如下所示
Reading data from NAND FLASH without ECC is not recommended
the error code is:0,name=/dev/root,fs=cramfs,flags=32769
Warning: unable to open an initial console.矩阵通信网-通信.IT人的精神家园8`9Pjq&_/N
!C+Q7fW ][0这个也是控制台console的问题,linux-2.6.13以后的内核都支持devfs,而之后版本的内核就把devfs这块去掉了,虽然还能在内核源码中找到对应的源码,你也可以把它加进内核,但是也不是太好用。2.6.13后的版本改为支持udev了,udev这块我也没太弄懂,正在研究。-
VFS: Mounted root (cramfs filesystem) readonly.
Freeing init memory: 104K
Reading data from NAND FLASH without ECC is not recommended
init started: BusyBox v1.10.1(2008-04-23 23:20:41 CST)
}
在这句里面出错就会没有下文
解决办法:在配置内核时少选了几句,将如下选择全选上
Floating Point emulation
->At least one emulation must be selected:
NWFPE math emulation
Support extended precision
mtd: Giving out device 2 to rootfs
0x02000000-0x03000000 : "ext-fs1"
mtd: Giving out device 3 to ext-fs1
0x03000000-0x04000000 : "ext-fs2"
mtd: Giving out device 4 to ext-fs2
出现问题:
## Starting application at 0x30008000 ...
Uncompressing Linux.............................................................
解决方案:
setenv bootargs console=ttySAC0,115200 mem=64M;console明令在哪暂时还没解决???
size: 0x01e00000,
offset:0x00200000,
},
{
name:"ext-fs1",
size: 0x01000000,
offset:0x02000000,
},
{
name:"ext-fs2",
size: 0x01000000,
offset:0x03000000,
},
};
//以上分区和NAND flash物理分区一样,分区不一样没试过,根据自己板子情况而定
setenv
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Mounted root (cramfs filesystem) readonly.
Freeing init memory: 104K
Reading data from NAND FLASH without ECC is not recommended
init started: BusyBox v1.10.1(2008-04-23 23:20:41 CST)
"noinitrd root=/dev/mtdblock2 ro init=/linuxrc console=ttySAC0,115200 rootfstype=cramfs mem=64M"