Building Embedded Linux
การสร้างระบบจำลองสำหรับสถาปัตยกรรม ARM ด้วยชุดเครื่องมือ Buildroot บนโปรแกรม QEMU
ทำการติดตั้งโปรแกรมและไลบรารีที่เกี่ยวข้อง
$ sudo apt install autoconf automake libtool libexpat1-dev libncurses5-dev bison flex patch curl cvs texinfo build-essential subversion gawk python-dev gperf ncurses-dev g++ gcc texi2html nfs-kernel-serverสร้างไดเรกทอรีสำหรับเก็บ root filesystem ของระบบปฏิบัติการ Embedded Linux ด้วยโปรโตคอลประยุกต์ NFS (Network File System) ผ่านระบบเครือข่าย LAN
$ mkdir ~/nfsrootแล้วทำการตั้งค่าไดเรกทอรีที่ต้องการแชร์ผ่าน NFS ภายในไฟล์ /etc/exports ด้วยคำสั่งข้างล่างนี้
$ sudo nano /etc/exports
/home/student/nfsroot *(rw,sync,no_root_squash,no_subtree_check)เริ่มเรียกบริการ NFS Server ใหม่อีกครั้ง
$ sudo /etc/init.d/nfs-kernel-server restartติดตั้งเครื่องมือ buildroot ซึ่งเป็น cross-compiling toolchain
$ wget http://buildroot.uclibc.org/downloads/buildroot-2013.05.tar.gz
$ tar -xzvf buildroot-2013.05.tar.gz
$ cd buildroot-2013.05/ตั้งค่าระบบปฏิบัติการลีนุกซ์แบบฝังตัวเพื่อให้รองรับรายละเอียดของสถาปัตยกรรมและรายละเอียดอื่นๆดังนี้
$ make menuconfigโดยให้ตั้งค่าดังนี้
Target Architecture ==> ARM (little endian)
Target Architecture Variant ==> arm926t
Target ABI ==> EABI
System Configuration ==> serial port to run getty on (ttyAMA0)
Package Selection ==> Busybox
FileSystem Images ==> cpio the root filesystem และ tar the root filesystem
Kernel ==> ระบุชื่อ defconfig เป็น “versatile”
Kernel ==> Kernel binary format to zImage
วาง root filesystem ไปยัง ไดเรกทอรี NFS ชื่อว่า ~/nfsroot ที่เครื่อง Host ได้เปิดแชร์ไว้
ขั้นตอนการสร้าง tun/tap device เพื่อกำหนดวงของระบบเครือข่ายท้องถิ่นภายในระหว่าง QEMU และเครื่อง Host เพื่อให้ระบบปฏิบัติการลีนุกซ์แบบฝังตัวภายใน QEMU สามารถ mount ไดเรกทอรี NFS ที่เปิดแชร์ไว้บนเครื่อง Host ได้ โดยตั้งค่า IP Address ให้กับเครื่อง Host เป็น 192.168.1.1 และตั้งค่า IP Address สำหรับอุปกรณ์ target ซึ่งในที่นี้ก็คือ 192.168.1.101
ขั้นตอนต่อไปทำการติดตั้งโปรแกรม uml-utilities (ที่มีคำสั่ง tunctl) เพื่อให้สามารถจำลองสัญญาณระบบเครือข่าย (network traffic)
ขั้นตอนสุดท้ายทำการรันโปรแกรม QEMU เพื่อจำลองการทำงานบอร์ดสมองกลฝังตัว (Versatile Board) และทำการโหลด root filesystem จากเครื่อง Host
Last updated
Was this helpful?