基于busybox制作自己的root filesystem

1,编译busybox

      1)获得busybox-1.19.4源代码,并解压,进入源代码根目录busybox-1.19.4

       2)$make O=busybox/build/dir menuconfig

          选择编译static版本。取消ubi相关的选项,它会导致编译错误。确定安装目录为./_install

       3)make O=busybox/build/dir

       4)make O=busybox/build/dir install

2,制作文件系统

       1)创建镜像文件

           dd if=/dev/zero of=rootfs.img ibs=1M count=100

       2)mkdir -v rootfs

           mount -o loop rootfs.img rootfs

        3)制作文件系统

            cd rootfs

            cp -a busybox/build/dir/_install/* ./

            mkdir -v etc dev

            cp -a busybox-1.19.4/examples/bootfloppy/etc/* ./etc

            cp -R /dev/null ./dev/

            cp -R /dev/console ./dev/

        4)退出,并卸载rootfs

             umount rootfs

3,用qemu+自制root filesystem启动kernel

       qemu-system-x86_64 -kernel linux-build/arch/x86/boot/bzImage -hda rootfs.img -append "root=/dev/sda"

       调试步骤:

        1)加-S选项冻住qemu进程,按alt+2进入qemu命令行,执行gdbserver tcp::1234,等待gdb链接。

        2)启动gdb,执行target remote localhost:1234链接qemu,开始调试。

        使用kgdb调试:

         1)增加启动参数 -append "root=/dev/sda kgdboc=0,115200 kgdbwait"


http://www.kgdb.info/kgdb/use_kgdb/using_kgdb_base_qemu/

http://www.embexperts.com/viewthread.php?tid=133

http://now-code.com/archives/94

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值