
إطار لتجميع وتنفيذ تطبيقات Go على معالجات عارية (bare metal)، مما يتيح تطوير برامج ثابتة آمنة مع تقليل سطح الهجوم من خلال إزالة اعتماديات نظام التشغيل وC.
TamaGo - Go على العتاد المجرد
======================
tamago | https://github.com/usbarmory/tamago
حقوق النشر (c) The TamaGo Authors. جميع الحقوق محفوظة.

مقدمة
============
TamaGo هو إطار عمل يتيح تجميع وتنفيذ تطبيقات Go غير المحمّلة على معالجات العتاد المجرد.
تنبع المشاريع من الرغبة في تقليل سطح الهجوم لبرامج الأنظمة المدمجة عبر إزالة أي اعتماد وقت التشغيل على كود C وأنظمة التشغيل.
يتكون إطار عمل TamaGo من المكونات التالية:
- [توزيعة Go](https://github.com/usbarmory/tamago-go) معدّلة
التي توسّع دعم `GOOS` إلى هدف `tamago`، مما يسمح بتنفيذ العتاد المجرد
من خلال [runtime/goos](https://github.com/usbarmory/tamago-go/tree/latest/src/runtime/goos)
طبقة تُضبط بواسطة `GOOSPKG`.
- حزم Go لدعم المعالج/SoC.
- حزم Go لدعم اللوحة.
التعديلات طفيفة مقابل مترجم Go الأصلي، ووقت التشغيل، والتطبيق
الهدف (استيراد واحد مطلوب)، مع فصل نظيف عن المعماريات الأخرى.
يُركّز بشدة على إعادة استخدام الكود من المعماريات الموجودة بالفعل
ضمن وقت تشغيل Go القياسي، انظر
[Internals](https://github.com/usbarmory/tamago/wiki/Internals).
تحافظ التعديلات على [دعم كامل للمكتبة القياسية](https://github.com/usbarmory/tamago/wiki/Compatibility).
هذه الجوانب مدفوعة بالرغبة في توفير إطار عمل يسمح
بتطوير برامج Go آمنة على الأنظمة المدمجة.
الإصدارات الحالية
================
الروابط التالية هي أحدث الإصدارات لـ
[توزيعة Go المعدّلة TamaGo](https://github.com/usbarmory/tamago-go)،
التي تضيف دعم `GOOS=tamago` لإصدار Go المقابل، و
[مكتبة TamaGo](https://github.com/usbarmory/tamago):
[](https://github.com/usbarmory/tamago-go/releases/latest) [](https://github.com/usbarmory/tamago-go/actions)
[](https://github.com/usbarmory/tamago/releases/latest)
التوثيق
=============
[](https://pkg.go.dev/github.com/usbarmory/tamago)
يمكن العثور على التوثيق الرئيسي على
[ويكي المشروع](https://github.com/usbarmory/tamago/wiki).
يمكن العثور على توثيق واجهة برمجة التطبيقات للحزم على
[pkg.go.dev](https://pkg.go.dev/github.com/usbarmory/tamago).
أهداف AMD64 المدعومة
=======================
يلخص الجدول التالي أهداف x86-64 المدعومة حالياً
(`GOOS=tamago GOARCH=amd64`).
| CPU | Platform | CPU package | Platform package |
|------------------|---------------------------------------------------------------------------|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| AMD/Intel 64-bit | [Cloud Hypervisor](https://www.cloudhypervisor.org ) | [amd64](https://github.com/usbarmory/tamago/tree/master/amd64) | [cloud_hypervisor/vm](https://github.com/usbarmory/tamago/tree/master/board/cloud_hypervisor/vm) |
| AMD/Intel 64-bit | [Firecracker microvm](https://firecracker-microvm.github.io) | [amd64](https://github.com/usbarmory/tamago/tree/master/amd64) | [firecracker/microvm](https://github.com/usbarmory/tamago/tree/master/board/firecracker/microvm) |
| AMD/Intel 64-bit | [QEMU microvm](https://www.qemu.org/docs/master/system/i386/microvm.html) | [amd64](https://github.com/usbarmory/tamago/tree/master/amd64) | [qemu/microvm](https://github.com/usbarmory/tamago/tree/master/board/qemu/microvm) |
| AMD/Intel 64-bit | [UEFI](https://uefi.org/) | [amd64](https://github.com/usbarmory/tamago/tree/master/amd64) | [uefi/x64](https://github.com/usbarmory/go-boot/tree/main/uefi/x64) |
| AMD/Intel 64-bit | [Google Compute Engine](https://cloud.google.com/products/compute) | [amd64](https://github.com/usbarmory/tamago/tree/master/amd64) | [google/gcp](https://github.com/usbarmory/tamago/tree/master/board/google/gcp), [uefi/x64](https://github.com/usbarmory/go-boot/tree/main/uefi/x64) |
أهداف ARM المدعومة
=====================
يلخص الجدول التالي وحدات SoC واللوحات ARM المدعومة حالياً
(`GOOS=tamago GOARCH=arm`).
| SoC | Board | SoC package | Board package |
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|
| NXP i.MX6ULZ/i.MX6UL | [USB armory Mk II](https://github.com/usbarmory/usbarmory/wiki/Mk-II-Introduction) | [imx6ul](https://github.com/usbarmory/tamago/tree/master/soc/nxp/imx6ul) | [usbarmory/mk2](https://github.com/usbarmory/tamago/tree/master/board/usbarmory) |
| NXP i.MX6ULL/i.MX6UL | [USB armory Mk II LAN](https://github.com/usbarmory/usbarmory/wiki/Mk-II-LAN) | [imx6ul](https://github.com/usbarmory/tamago/tree/master/soc/nxp/imx6ul) | [usbarmory/mk2](https://github.com/usbarmory/tamago/tree/master/board/usbarmory) |
| NXP i.MX6ULL/i.MX6ULZ | [MCIMX6ULL-EVK](https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/evaluation-kit-for-the-i-mx-6ull-and-6ulz-applications-processor:MCIMX6ULL-EVK) | [imx6ul](https://github.com/usbarmory/tamago/tree/master/soc/nxp/imx6ul) | [mx6ullevk](https://github.com/usbarmory/tamago/tree/master/board/nxp/mx6ullevk) |
| Broadcom BCM2835 | [Raspberry Pi Zero](https://www.raspberrypi.org/products/raspberry-pi-zero) | [bcm2835](https://github.com/usbarmory/tamago/tree/master/soc/bcm2835) | [pi/pizero](https://github.com/usbarmory/tamago/tree/master/board/raspberrypi) |
| Broadcom BCM2835 | [Raspberry Pi 1 Model A+](https://www.raspberrypi.org/products/raspberry-pi-1-model-a-plus/) | [bcm2835](https://github.com/usbarmory/tamago/tree/master/soc/bcm2835) | [pi/pi1](https://github.com/usbarmory/tamago/tree/master/board/raspberrypi) |
| Broadcom BCM2835 | [Raspberry Pi 1 Model B+](https://www.raspberrypi.org/products/raspberry-pi-1-model-b-plus/) | [bcm2835](https://github.com/usbarmory/tamago/tree/master/soc/bcm2835) | [pi/pi1](https://github.com/usbarmory/tamago/tree/master/board/raspberrypi) |
| Broadcom BCM2836 | [Raspberry Pi 2 Model B](https://www.raspberrypi.org/products/raspberry-pi-2-model-b) | [bcm2835](https://github.com/usbarmory/tamago/tree/master/soc/bcm2835) | [pi/pi2](https://github.com/usbarmory/tamago/tree/master/board/raspberrypi) |
| Nuvoton NUC980 | [NuMaker-IIoT-NUC980G2](https://www.nuvoton.com/products/iot-solution/iot-platform/numaker-iiot-nuc980g2) | [nuc980](https://github.com/usbarmory/tamago/tree/master/soc/nuvoton/nuc980) | [nuc980iiot](https://github.com/usbarmory/tamago/tree/master/board/nuvoton/nuc980iiot) |
أهداف ARM64 المدعومة
=======================
يلخص الجدول التالي وحدات SoC واللوحات ARM64 المدعومة حالياً
(`GOOS=tamago GOARCH=arm64`).
| SoC | Board | SoC package | Board package |
|-------------------|----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| NXP i.MX8M Plus | [8MPLUSLPD4-EVK](https://www.nxp.com/design/design-center/development-boards-and-designs/8MPLUSLPD4-EVK) | [imx8mp](https://github.com/usbarmory/tamago/tree/master/soc/nxp/imx8mp) | [imx8mpevk](https://github.com/usbarmory/tamago/tree/master/board/nxp/imx8mpevk) |
| Microchip LAN969x | [EVB-LAN9696-24port](https://www.microchip.com/en-us/development-tool/ev23x71a) | [lan969x](https://github.com/usbarmory/tamago/tree/master/soc/microchip/lan969x) | [lan9696evb](https://github.com/usbarmory/tamago/tree/master/board/microchip/lan9696evb) |
أهداف RISC-V المدعومة
========================
يلخص الجدول التالي وحدات SoC واللوحات RISC-V المدعومة حالياً
(`GOOS=tamago GOARCH=riscv64`).
| SoC | Board | SoC package | Board package |
|---------------------|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| AI Foundry Erbium | [erbium_emu](https://github.com/aifoundry-org/et-platform) | [erbium](https://github.com/usbarmory/tamago/tree/master/soc/aifoundry/erbium) | [erbium_emu](https://github.com/usbarmory/tamago/tree/master/board/aifoundry/erbium_emu) |
| AI Foundry ET-SoC-1 | [sys_emu](https://github.com/aifoundry-org/et-platform/tree/master/sw-sysemu) | [etsoc1](https://github.com/usbarmory/tamago/tree/master/soc/aifoundry/etsoc1) | [sys_emu](https://github.com/usbarmory/tamago/tree/master/board/aifoundry/sys_emu) |
| Fisilink FSL91030 | [MilkV Vega](https://milkv.io/vega) | [fsl91030](https://github.com/usbarmory/tamago/tree/master/soc/fisilink/fsl91030) | [vega](https://github.com/usbarmory/tamago/tree/master/board/milkv/vega) |
| Fisilink FSL91030 | [Nuclei QEMU](https://doc.nucleisys.com/nuclei_tools/qemu/index.html) | [fsl91030](https://github.com/usbarmory/tamago/tree/master/soc/fisilink/fsl91030) | [eval_soc](https://github.com/usbarmory/tamago/tree/master/board/nuclei/eval_soc) |
| SiFive FU540 | [QEMU sifive_u](https://www.qemu.org/docs/master/system/riscv/sifive_u.html) | [fu540](https://github.com/usbarmory/tamago/tree/master/soc/sifive/fu540) | [qemu/sifive_u](https://github.com/usbarmory/tamago/tree/master/board/qemu/sifive_u) |
أهداف LoongArch المدعومة
===========================
يلخص الجدول التالي وحدات SoC واللوحات LoongArch المدعومة حالياً
(`GOOS=tamago GOARCH=loong64`).
| SoC | Board | SoC package | Board package |
|-----------------|--------------------------------------------------------------------------|-----------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| Loongson 3A5000 | [QEMU virt](https://www.qemu.org/docs/master/system/loongarch/virt.html) | [ls3a5000](https://github.com/usbarmory/tamago/tree/master/soc/loongson/ls3a5000) | [qemu/virt](https://github.com/usbarmory/tamago/tree/master/board/qemu/virt) |
أهداف مساحة المستخدم
=================
يمكن أيضاً تنفيذ البرامج المُجمّعة باستخدام `GOOS=tamago` في
مساحة المستخدم عبر استيراد أي حزمة تنفذ طبقة `runtime/goos`
المطلوبة مع إشراف نظام التشغيل بدلاً من برامج تشغيل العتاد المجرد.
تجميع وتشغيل برامج Go في مساحة المستخدم كـ `GOOS=tamago` يوفر
ميزة عزل استدعاءات النظام حيث لا يمكن للملف التنفيذي الاستفادة من وقت تشغيل Go
للوصول مباشرة إلى موارد نظام التشغيل، مما يؤدي إلى:
* العزل عن نظام ملفات نظام التشغيل، من خلال قرص مُحاكى في الذاكرة
* العزل عن شبكات نظام التشغيل، انظر [net.SocketFunc](https://github.com/usbarmory/tamago-go/blob/latest/src/net/net_tamago.go)
* واجهة برمجة تطبيقات للشبكات المخصصة، ومولّد الأرقام العشوائية، ومعالجات الوقت
يلخص الجدول التالي دعم مساحة المستخدم المتاح حالياً:
| Operating System | `GOARCH` | Runtime packages |
|----------------------------------------------|-------------------------|--------------------------------------------------------------------------------------|
| [Linux](https://www.kernel.org/) | amd64,arm,arm64,riscv64 | [runtime/goos](https://github.com/usbarmory/tamago-go/blob/latest/src/runtime/goos)¹ |
| [Linux](https://www.kernel.org/) | amd64,arm,arm64,riscv64 | [linux](https://github.com/usbarmory/tamago/tree/master/user/linux) |
| [GoTEE](https://github.com/usbarmory/GoTEE/) | arm,riscv64 | [applet](https://pkg.go.dev/github.com/usbarmory/GoTEE/applet) |
¹ يُستخدم لتشغيل [اختبارات التوزيعة القياسية](https://github.com/usbarmory/tamago/wiki/Compatibility) و `go test -tags user_linux`
التجميع
=========
توزيعة Go الداعمة لـ `GOOS=tamago`
---------------------------------------
يقوم أمر [tamago](https://github.com/usbarmory/tamago/tree/latest/cmd/tamago)
بتنزيل وتجميع وتشغيل أمر `go` من
[توزيعة TamaGo](https://github.com/usbarmory/tamago-go) المطابقة
لإصدار وحدة tamago من ملف `go.mod` الخاص بالتطبيق.
يمكن للتطبيقات إضافة `github.com/usbarmory/tamago` إلى `go.mod`، ثم
استبدال أمر `go` بـ:
```sh
go run github.com/usbarmory/tamago/cmd/tamago
```
أو أضف السطر التالي إلى `go.mod` لاستخدام `go tool tamago` كأمر go:
```
tool github.com/usbarmory/tamago/cmd/tamago
```
بدلاً من ذلك، يمكن بناء
[أحدث توزيعة TamaGo](https://github.com/usbarmory/tamago-go/tree/latest) يدويًا أو استخدام
[أحدث إصدار ثنائي](https://github.com/usbarmory/tamago-go/releases/latest):
```sh
wget https://github.com/usbarmory/tamago-go/archive/refs/tags/latest.zip
unzip latest.zip
cd tamago-go-latest/src && ./all.bash
cd ../bin && export TAMAGO=`pwd`/go
```
بناء التطبيقات
---------------------
أثناء الترجمة، يجب تعيين متغير بيئة Go `GOOSPKG` لتمكين هذه المكتبة كطبقة تراكب لدعم `GOOS=tamago`.
```
export GOOSPKG=github.com/usbarmory/tamago
```
يُطلب من تطبيقات Go استيراد حزمة اللوحة ذات الصلة لضمان حدوث تهيئة الأجهزة ودعم وقت التشغيل:
```golang
import (
// Example for USB armory Mk II
_ "github.com/usbarmory/tamago/board/usbarmory/mk2"
)
```
يمكن تجميع تطبيقات Go باستخدام المترجم المبني في الخطوة السابقة،
مع إضافة بعض الأعلام/المتغيرات:
```sh
# set this library as `runtime/goos` overlay
export GOOSPKG=github.com/usbarmory/tamago
# Example for Cloud Hypervisory, QEMU and Firecracker KVMs
GOOS=tamago GOARCH=amd64 ${TAMAGO} build -ldflags "-T 0x10010000 -R 0x1000" main.go
# Example for NXP i.MX6UL
GOOS=tamago GOARM=7 GOARCH=arm ${TAMAGO} build -ldflags "-T 0x80010000 -R 0x1000" main.go
# Example for NXP 8MPLUSLPD4-EVK
GOOS=tamago GOARCH=arm64 ${TAMAGO} build -ldflags "-T 0x40010000 -R 0x1000" main.go
# Example for SiFive FU540
GOOS=tamago GOARCH=riscv64 ${TAMAGO} build -ldflags "-T 0x80010000 -R 0x1000" main.go
# Example for AI Foundry Erbium
GOOS=tamago GOARCH=riscv64 GOEXPERIMENT=softfloat ${TAMAGO} build -ldflags "-T 0x40010000 -R 0x1000" main.go
# Example for QEMU LoongArch virt
GOOS=tamago GOARCH=loong64 ${TAMAGO} build -ldflags "-T 0x1000000 -R 0x1000" main.go
# Example for Linux userspace
GOOS=tamago ${TAMAGO} build main.go
```
راجع ملف README الخاص بحزمة اللوحة المعنية للحصول على معلومات الترجمة
لكل هدف محدد.
وسوم البناء
==========
تسمح وسوم البناء التالية للتطبيقات بتجاوز التعريف الخاص بالحزمة
لطبقة `runtime/goos`:
* `linkramstart`: تجاوز `ramStart`
* `linkramsize`: تجاوز `ramSize`
* `linkprintk`: تجاوز `printk`
* `linkcpuinit`: تجاوز `cpuinit`
* `tiny`: تقليل متطلبات تخصيص الكومة
التنفيذ والتصحيح
=======================
راجع ملف README الخاص بحزمة اللوحة المعنية للحصول على معلومات التنفيذ والتصحيح
لكل هدف محدد (حقيقي أو محاكى).
يوفر [التطبيق النموذجي](https://github.com/usbarmory/tamago-example)
أمثلة على استخدام برامج التشغيل وتعليمات للتنفيذ الأصلي وكذلك المحاكى.
يمكن تشغيل جولة محاكاة لـ[التطبيق النموذجي](https://github.com/usbarmory/tamago-example)
على النحو التالي:
```sh
git clone https://github.com/usbarmory/tamago-example
cd tamago-example && make qemu
```
التطبيقات التي تستخدم TamaGo
=========================
* [go-boot](https://github.com/usbarmory/go-boot) - مدير إقلاع UEFI مكتوب بلغة Go للأنظمة العارية
* [GoKey](https://github.com/usbarmory/GoKey) - بطاقة ذكية مكتوبة بلغة Go للأنظمة العارية
* [GoTEE](https://github.com/usbarmory/GoTEE) - بيئة تنفيذ موثوقة بلغة Go
* [ArmoredWitness](https://github.com/transparency-dev/armored-witness) - شبكة شاهد عبر الأنظمة البيئية
* [armory-drive](https://github.com/usbarmory/armory-drive) - قرص USB مشفّر
* [armory-ums](https://github.com/usbarmory/armory-ums) - برنامج ثابت لتخزين USB كبير السعة
* [armory-boot](https://github.com/usbarmory/armory-boot) - محمّل إقلاع USB armory
* [tamago-example](https://github.com/usbarmory/tamago-example) - تطبيق TamaGo نموذجي
* [tamago-sev-example](https://github.com/usbarmory/tamago-sev-example) - مثال على الآلة الافتراضية السرية (AMD SEV-SNP)
* [kotama](https://github.com/usbarmory/kotama) - نموذج توضيحي لهدف RISC-V صغير
* [kanzashi](https://github.com/abarisani/kanzashi) - وكيل للأنظمة العارية
برامج تشغيل خارجية تستخدم TamaGo
=============================
* [go-net](https://github.com/usbarmory/go-net) - برنامج تشغيل شبكة عام
* [go-net/imx-usb](https://github.com/usbarmory/go-net/tree/main/imx-usb) - برنامج تشغيل إيثرنت عبر USB لـ i.MX
* [go-net/virtio](https://github.com/usbarmory/go-net/tree/main/virtio) - برنامج تشغيل شبكة VirtIO
* [imx-usbserial](https://github.com/usbarmory/imx-usbserial) - برنامج تشغيل تسلسلي عبر USB لـ i.MX
موارد إضافية
====================
* [واجهة برمجة الحزمة](https://pkg.go.dev/github.com/usbarmory/tamago)
* [واجهة برمجة وقت التشغيل](https://github.com/usbarmory/tamago-go/blob/latest/src/runtime/goos/README.md)
* [التوافق](https://github.com/usbarmory/tamago/wiki/Compatibility)
* [التفاصيل الداخلية](https://github.com/usbarmory/tamago/wiki/Internals)
* [الأسئلة الشائعة](https://github.com/usbarmory/tamago/wiki/Frequently-Asked-Questions-(FAQ))
* العروض التقديمية: [TamaGo](https://github.com/abarisani/abarisani.github.io/tree/master/research/tamago)، [ArmoredWitness](https://github.com/abarisani/abarisani.github.io/tree/master/research/witness)
المشرفون
===========
Andrea Barisani
[email protected]
Andrej Rosano
[email protected]
الترخيص
=======
tamago | https://github.com/usbarmory/tamago
Copyright (c) The TamaGo Authors. All Rights Reserved.
يُوزَّع هذا المشروع بموجب ترخيص بنمط BSD الموجود في ملف
[LICENSE](https://github.com/usbarmory/tamago/blob/master/LICENSE).
شعار TamaGo مقتبس من Go gopher الذي صممته Renee French والمرخَّص
بموجب رخصة Creative Commons 3.0 Attributions. رسم Go Gopher المتجهي
من إعداد Hugo Arganda.