MINI2440移植xenomai记录
2015-12-13 20:42
399 查看
MINI2440移植xenomai记录
最近折腾了一段时间,把xenomai移植到了mini2440上,在此做点记录以便日后查阅。Xenomai通过与传统Linux组成双内核以弥补Linux实时性差的缺陷,这里不作详细介绍了,具体内容可以参考xenomai官网。
虽然据说xenomai官方对s3c2440提供了支持,但我试了好几个版本,换了好多内核(2.6.38, 3.4.6, 3.10.32, 3.18.24…),好像全部都有问题,每次打完ipipe补丁后就启动不了了,但是万万没想到,最终还是让我移植成功了。
准备工作
下载内核
地址:https://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.9.tar.bz2必须是2.6.35.9, 因为貌似只有这个版本有能正常启动的对应的ipipe补丁。
下载Xenomai 2.5.6
地址:http://xenomai.org/downloads/xenomai/stable/xenomai-2.5.6.tar.bz2这个版本有点老,因为新的版本对2440的支持好像都有问题,(虽然这个版本在2440上也有问题,所有还要单独下载补丁,不能用官方的IPIPE补丁)
下载IPIPE补丁
地址:https://miniemc2.googlecode.com/files/linux-2.6.35.9-s3c24xx-i-pipe-adeos-2.5.6-fiq-isr-aufs2.mod2.patch需要梯子,所有移植中最关键的就是这个补丁
移植内核
给内核打补丁
$ tar xjf linux-2.6.35.9.tar.bz2 $ cd linux-2.6.35.9 $ patch -p1 < linux-2.6.35.9-s3c24xx-i-pipe-adeos-2.5.6-fiq-isr-aufs2.mod2.patch
打完这个补丁后不需要再打xenomai包里的那个补丁了,也不用再执行prepare-kernel.sh了,因为所有东西都已经包含在补丁里了。
修改分区表
可以通过以下命令查看分区信息:cat /proc/partitions 或 cat /proc/mtd
修改arch/arm/mach-s3c2440/mach-mini2440.c文件:
/* NAND Flash on MINI2440 board */ static struct mtd_partition mini2440_default_nand_part[] __initdata = { [0] = { .name = "supervivi", .size = 0x00040000, .offset = 0, }, [1] = { .name = "param", .offset = 0x00040000, .size = 0x00020000, }, [2] = { .name = "Kernel", .offset = 0x00060000, .size = 0x00500000, }, [3] = { .name = "root", .offset = 0x00560000, .size = 1024 * 1024 * 1024, // }, [4] = { .name = "nand", .offset = 0x00000000, .size = 1024 * 1024 * 1024, // } }; static struct s3c2410_nand_set mini2440_nand_sets[] __initdata = { [0] = { .name = "nand", .nr_chips = 1, .nr_partitions = ARRAY_SIZE(mini2440_default_nand_part), .partitions = mini2440_default_nand_part, }, }; static struct s3c2410_platform_nand mini2440_nand_info __initdata = { .tacls = 20, .twrph0 = 60, .twrph1 = 20, .nr_sets = ARRAY_SIZE(mini2440_nand_sets), .sets = mini2440_nand_sets, .ignore_unset_ecc = 1, };
添加yaffs2文件系统驱动
$ git clone git://www.aleph1.co.uk/yaffs2 $ cd yaffs2 $ ./patch-ker.sh c m <path-to-the-kernel>
配置内核
$ export ARCH=arm $ export CROSS_COMPILE=arm-linux- $ make miniemc_defconfig $ make menuconfig
可以根据需要对内核进行一些裁剪,
1. Boot options >> Default kernel command string 改为“noinitrd root=/dev/mtdblock3 rw init=/linuxrc console=ttySAC0,115200”
刚开始因为没有做这一步导致启动的时候在Uncompressing linux kernel之后就卡住了
2. File systems >> Miscalleneous filesystems >> yaffs2 file system support 选上
编译内核
$ make zImage
编译完成后产生的zImage在arch/arm/boot目录下。
编译xenomai库
把刚才下载的xenomai解压后进入该目录$ mkdir build && cd build $../configure CFLAGS="-march=armv4t -msoft-float" LDFLAGS="-march=armv4t" --host=arm-linux --enable-arm-mach=s3c2410 --enable-arm-eabi --disable-arm-tsc $ make DESTDIR=$PWD/xenomai_out install
其中第二步configure的选项很重要,第一次编译的时候就是因为这个选项不对导致了自带的所有测试程序一运行就报Segmentation fault。
编译完成后把xenomai_out中的usr文件夹拷贝到开发板中,并配置好路径。
相关文章推荐
- Linux 自检和 SystemTap
- ARMBoot-1.1.0 在 mini2440 开发板上的移植
- Linux内核链表实现过程
- 把jQuery的each(callback)方法移植到c#中
- IIS 服务器的备份和移植技巧
- 深入理解PHP内核(二)之SAPI探究
- 解析libcurl在android下的移植、编译与测试
- C++中Semaphore内核对象用法实例
- 深入理解PHP内核(一)
- 深入php内核之php in array
- Objective-c代码如何移植为Swift代码 Objective-c代码转移到Swift过程介绍
- ok6410开发板移植DirectFB手记
- Supporting Python 3(支持python3)——语言区别和暂时解决方法
- Supporting Python 3(支持python3)——重组和重命名
- J2ME游戏移植到Android平台的方法
- J2me游戏如何快速移植到Android(1)
- J2me游戏如何快速移植到Android (2)
- android与j2me移植之clipRect
- 修改内核 内存分配 root、文件系统和内核镜像的位置
- 移植linux-2.6.30.4到S3C2440