# F08: smallsys :::info 主講人: [jserv](http://wiki.csie.ncku.edu.tw/User/jserv) / 課程討論區: [2019 年系統軟體課程](https://www.facebook.com/groups/system.software2019/) :mega: 返回「[Linux 核心設計](http://wiki.csie.ncku.edu.tw/linux/schedule)」課程進度表 ::: ## 預期目標 * 學習虛擬機器 * 重新編譯核心並調整組態 * 初步追蹤核心運作 ## [linux-kernel-module-cheat](https://github.com/cirosantilli/linux-kernel-module-cheat) * video: [Debugging an ARM64 linux kernel using QEMU](https://www.youtube.com/watch?v=swniLhXg-3U) * video: [Tracing linux kernel on QEMU with GDB-stub](https://www.youtube.com/watch?v=H19VM_uwzEY) ## VirtIO + 9P * [Example Sharing Host files with the Guest](https://www.linux-kvm.org/page/9p_virtio) * [v9fs](https://www.kernel.org/doc/Documentation/filesystems/9p.txt): Plan 9 Resource Sharing for Linux * [Plan 9: Not (Only) A Better UNIX](https://www.slideshare.net/jserv/plan-9-not-only-a-better-unix) * [9psetup](https://wiki.qemu.org/Documentation/9psetup) * [An Updated Overview of the QEMU Storage Stack](https://events.static.linuxfound.org/slides/2011/linuxcon-japan/lcj2011_hajnoczi.pdf) ## 自我檢查清單 * 你是否詳閱 [手機裡頭的 ARM 處理器:系列講座](http://hackfoldr.org/arm/) 呢?請紀錄學習過程中遇到的問題 * 請解釋 AArch64 個別通用暫存器的作用,依據 [Linux on AArch64 ARM 64-bit Architecture](https://events.static.linuxfound.org/images/stories/pdf/lcna_co2012_marinas.pdf) 的描述,搭配實際的程式碼說明。提示: 簡報第 19 頁附有參考資訊 * AArch64 定義四種例外等級: EL0, EL1, EL2, EL3,請找出相關文件 (儘量是 Arm 公司的第一手材料) 並搭配 Linux 核心原始程式碼解說 * [linux-kernel-module-cheat](https://github.com/cirosantilli/linux-kernel-module-cheat) 提及透過 GDB 對 QEMU 模擬的虛擬硬體之上的 Linux 核心進行追蹤和除錯,請解釋具體原理。提示: 應一併說明 GDB stub 和 [QEMU/Debugging with QEMU](https://en.wikibooks.org/wiki/QEMU/Debugging_with_QEMU) 的運作機制 ## 作業要求 1. 回答上述「自我檢查清單」的所有問題,需要附上對應的參考資料和必要的程式碼,以第一手材料 (包含自己設計的實驗) 為佳 2. 透過 [buildroot](https://github.com/buildroot/buildroot) 工具產生針對 AArch64 的 linux kernel image (需要是 5.0 以上版本) 和 root file system,確保滿足以下要求: * 得以透過 `qemu-system-aarch64` 開機並正確地執行 userspace 套件 (如 Busybox) * 確認 qemu + gdb 能夠單步執行和設定中斷點 * 確保 VirtIO + 9P 得以運作 * 閱讀 [Embedded Linux size reduction techniques](http://events17.linuxfoundation.org/sites/events/files/slides/opdenacker-embedded-linux-size-reduction-techniques_0.pdf),嘗試建構出更小但仍可符合上述需求的 Linux 核心 4. 參照 [Linux 核心設計: 透過 eBPF 觀察作業系統行為](https://hackmd.io/s/SJTuuG9a7),在上述 `(2)` 的環境開啟 eBPF 核心設定和準備必要的 userspace 開發工具,做對應的實驗 ## 繳交方式 編輯 [Homework4 作業區共筆](https://hackmd.io/s/r1bJyiauV),將你的觀察、上述要求的解說和改善過程,紀錄於新建立的共筆 ## 截止日期 Apr 12, 2019 (含) 之前