基於busybox製作自己的root filesystem

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.