RTEMS连载 (3) 启动镜像文件制作 (下)
2005-01-28 10:00
441 查看
作者 Ray
RTEMS版权所有,转载请注明:来源http://www.rtems.net,作者ray@rtems.net
摘要
介绍如何制作和配置GRUB,以便启动RTEMS的测试镜像。
方法二:直接使用 grub 命令安装 bootloader 到软盘镜像
在安装过 grub的平台下可以直接运行grub命令,
# grub
会显示下面的界面,在 ” grub> ” 命令行提示符下面输入下面的指令:
GRUB version 0.95 (640K lower / 3072K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ]
grub> device (fd0) /dev/loop0 (BSD平台下使用 /dev/md0c设备 )
grub> root (fd0)
grub> setup (fd0)
格式为:
# grub-install --root-directory=./fd0
(注意, fd0是自己建立的目录,并且需要安装grub的软盘镜像已经加载,不是/dev/fd0)
进入 bash 模式
先 dd制作镜像,然后mount
#mount …
接下来用 grubinstall
#grub-install --root-directory=/
然后后面的步骤也和 linux 平台下面的大同小异 , 这里就不罗嗦了。
(说明,因为制作的时候没有及时整理,时间隔久了,所以写的有些乱,而且不能保证步骤 100% 的正确,大家如果遇到问题可以 man ,也可以和我联系,谢谢)
把你需要测试的文件压缩为 .gz 格式
# tar czvf hello.exe.686.gz hello.exe
……
压缩后的 hello.exe 只有 57kb 。所以 1.4M 的镜像文件中可以存放很多测试程序,大家喜欢测试什么就安装什么好了。在我提供下载的镜像中提供了下面的镜像文件:
[root@localhost embedded]# mount rtems.img /mnt -o loop
[root@localhost embedded]# cd /mnt
[root@localhost mnt]# ls
base_sp_386.exe.gz hello_386.exe.gz paranoia_686.exe.gz unlimited_686.exe.gz
base_sp_686.exe.gz hello_686.exe.gz stage1
grubmenu lost+found stage2
读者应该还记得 grub 的安装中使用了下面的命令:
grub>install=(fd0)/stage1 (fd0) (fd0)/stage2 0x8000 (fd0)/grubmenu
命令中 grubmenu 是 gurb 的启动菜单文件,(相当于 linux 平台下面的 menu.lst 文件)
我们可以编辑这个文件
# mount rtems.img /mnt -o loop
# cd /mnt
# vi grubmenu
加入下面的内容
title= hello for pc686
kernel=(fd0)/hello_686.exe.gz
title=paranoia_686
kernel=(fd0)/paranoia_686.exe.gz
title= Base bsp 686
kernel=(fd0)/base_sp_686.exe.gz
title= i386 Hello World Test
kernel=(fd0)/hello_386.exe.gz
title= Base bsp 386
kernel=(fd0)/base_sp_386.exe.gz
title= Base bsp 686
kernel=(fd0)/base_sp_686.exe.gz
好了,现在大功告成,卸载设备,然后用 rtems.img 启动
会有下面的菜单:
运行第一个镜像文件,如下所示:
本连载中的DEMO镜像文件可以在下载区下载
RTEMS版权所有,转载请注明:来源http://www.rtems.net,作者ray@rtems.net
摘要
介绍如何制作和配置GRUB,以便启动RTEMS的测试镜像。
方法二:直接使用 grub 命令安装 bootloader 到软盘镜像
在安装过 grub的平台下可以直接运行grub命令,# grub
会显示下面的界面,在 ” grub> ” 命令行提示符下面输入下面的指令:
GRUB version 0.95 (640K lower / 3072K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ]
grub> device (fd0) /dev/loop0 (BSD平台下使用 /dev/md0c设备 )
grub> root (fd0)
grub> setup (fd0)
方法三:使用 grub-install 命令
这个命令我以前用过,有一次还把系统的 bootloader 给弄没了,大家也要小心格式为:
# grub-install --root-directory=./fd0
(注意, fd0是自己建立的目录,并且需要安装grub的软盘镜像已经加载,不是/dev/fd0)
cygwin 平台安装 grub
在 cygwin 平台上面也可以进行上面的操作。不过我没有亲手制作过。根据 eCos 的启动镜像制作的经验,在 cygwin 下面安装是完全可行的,大致的步骤如下:(如果有网友制作成功,但是没有使用上面的步骤,可以通知我,谢谢!)进入 bash 模式
先 dd制作镜像,然后mount
#mount …
接下来用 grubinstall
#grub-install --root-directory=/
然后后面的步骤也和 linux 平台下面的大同小异 , 这里就不罗嗦了。
(说明,因为制作的时候没有及时整理,时间隔久了,所以写的有些乱,而且不能保证步骤 100% 的正确,大家如果遇到问题可以 man ,也可以和我联系,谢谢)
拷贝 rtems 启动测试镜像
切换回 Linux(BSD) 然后回到开发环境中,在编译 rtems 后产生的 sample 文件。镜像文件在 rtems 的编译目录下面的 i386-rtems/pc386/tests 或者 i386-rtems/pc686/tests 目录下面。把你需要测试的文件压缩为 .gz 格式
# tar czvf hello.exe.686.gz hello.exe
……
压缩后的 hello.exe 只有 57kb 。所以 1.4M 的镜像文件中可以存放很多测试程序,大家喜欢测试什么就安装什么好了。在我提供下载的镜像中提供了下面的镜像文件:
[root@localhost embedded]# mount rtems.img /mnt -o loop
[root@localhost embedded]# cd /mnt
[root@localhost mnt]# ls
base_sp_386.exe.gz hello_386.exe.gz paranoia_686.exe.gz unlimited_686.exe.gz
base_sp_686.exe.gz hello_686.exe.gz stage1
grubmenu lost+found stage2
Grub 的配置
Grub 安装好后,需要对启动菜单进行配置读者应该还记得 grub 的安装中使用了下面的命令:
grub>install=(fd0)/stage1 (fd0) (fd0)/stage2 0x8000 (fd0)/grubmenu
命令中 grubmenu 是 gurb 的启动菜单文件,(相当于 linux 平台下面的 menu.lst 文件)
我们可以编辑这个文件
# mount rtems.img /mnt -o loop
# cd /mnt
# vi grubmenu
加入下面的内容
title= hello for pc686
kernel=(fd0)/hello_686.exe.gz
title=paranoia_686
kernel=(fd0)/paranoia_686.exe.gz
title= Base bsp 686
kernel=(fd0)/base_sp_686.exe.gz
title= i386 Hello World Test
kernel=(fd0)/hello_386.exe.gz
title= Base bsp 386
kernel=(fd0)/base_sp_386.exe.gz
title= Base bsp 686
kernel=(fd0)/base_sp_686.exe.gz
好了,现在大功告成,卸载设备,然后用 rtems.img 启动
会有下面的菜单:
运行第一个镜像文件,如下所示:
本连载中的DEMO镜像文件可以在下载区下载
相关文章推荐
- RTEMS连载 (3) 启动镜像文件制作 (上)
- linux启动镜像文件(*.img)的制作
- squashfs─sfs镜像文件制作方法简要介绍
- Gphone文件系统镜像的制作以及刷机原理
- java启动文件的制作
- UBIFS文件系统简介 与 利用mkfs.ubifs和ubinize两个工具制作UBI镜像 .
- 实战DeviceIoControl 之三:制作磁盘镜像文件
- UBIFS文件系统简介 与 利用mkfs.ubifs和ubinize两个工具制作UBI镜像
- linux系统光盘镜像文件制作方法
- linux 产品发布--根文件系统镜像制作
- UltraISO镜像文件の制作
- Docker下的Kafka学习之一:制作集群用的镜像文件
- 【制作镜像Win*】文件准备
- 制作适合自己的linux系统镜像文件
- [转]如何制作tizen镜像文件(图文教程)?
- 用Nero刻录ISO镜像制作启动光盘
- linux 下制作可启动 img/iso 文件的方法
- 制作SD卡启动文件系统
- Linux下制作grub启动U盘,引导ubuntu LiveCD(或其他镜像)
- linux下制作软盘镜像文件