changeset 11:b6212bbc42da

add 2.3chapter
author okud
date Fri, 12 Feb 2021 17:14:53 +0900
parents 63c082d08136
children 1236fa28ffdd
files paper/chapter/bibitem.tex paper/chapter/chapter2.tex paper/chapter/chapter3.tex paper/chapter/chapter4.tex paper/chapter/introduction.tex paper/fig/raspi3.jpeg paper/file/cbc_gcc_cross.def paper/file/hello.cbc paper/final_thesis.pdf paper/final_thesis.tex
diffstat 10 files changed, 131 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/paper/chapter/bibitem.tex	Mon Feb 08 23:44:31 2021 +0900
+++ b/paper/chapter/bibitem.tex	Fri Feb 12 17:14:53 2021 +0900
@@ -1,7 +1,7 @@
 \begin{thebibliography}{99}
 \bibitem{IntelNews} Intel/Unified EFI Forum, https://www.uefi.org ,2017/11/3.
+\bibitem{CbC} 宮城光希,河野慎治.CbC言語によるOS記述.琉球大学工学部情報工学科平成29年度学位論文(学士),2017.
 \bibitem{Gears} 清水隆博,河野真治.GearsOSのメタ計算.琉球大学工学部情報工学科令和3年度学位論文(修士),2021.
-\bibitem{CbC} 宮城光希,河野慎治.CbC言語によるOS記述.琉球大学工学部情報工学科平成29年度学位論文(学士),2017.
 \bibitem{xv6} Russ Cox, M Frans Kaashoek, and Robert Morris. Xv6, a simple unix-like teaching operating system,2012.
 \bibitem{gcc} GNU Compiler Collection (GCC) Internals,https://gcc.gnu.org/onlinedocs/gccint/
 \bibitem{llvm} Clang: a C language family frontend for LLVM,https://clang.llvm.org.
--- a/paper/chapter/chapter2.tex	Mon Feb 08 23:44:31 2021 +0900
+++ b/paper/chapter/chapter2.tex	Fri Feb 12 17:14:53 2021 +0900
@@ -8,8 +8,10 @@
 CodeGearは入力と出力を持ち、CbCでは引数が入出力になっている。
 CodeGearから次のCodeGearへとgotoによる継続で遷移して処理を行い、引数として出力を与える。
 CbCには、GCC\cite{gcc}上に実装されたものとLLVM/Clang\cite{llvm}上に実装されたものがある。
-GCCとLLVM/Clangで実装されたCbCをARMでコンパイルするにはクロスコンパイラが必要になる。
-このクロスコンパイラ環境をSingularityで作成した。
+GCCとLLVM/Clangで実装されたCbCをARMでCompileするにはCross Compileを行う必要がある。
+GCCとLLVMではCbCを動かすのにGCCの方が安定しているのでCbCのGCCのCrossCompile環境を作成する。
+このCross Compile環境はSingularityで作成した。
+
 
 
 \subsection{GCC}
@@ -20,21 +22,46 @@
 LLVMとは、モジュラー構成及び再利用可能なコンパイラとツールチェーン技術などを開発するプロジェクトの名称である。
 ClangはLLVMをバックエンドとして利用するC/C++/Object-Cのコンパイラである。
 
+\subsection{CrossCompile}
+Cross Compileは、Compilerが動作している以外のプラットフォーム向けに実行ファイルを生成する機能を持ったCompile手法である。
+Raspbery Piでいうと、Raspbian以外のOS環境であらかじめRaspberry PiでCbCが動くようにCross Compileを行う。
+そこで生成されたコードをRaspberry Piに移すことで、実行できる様になる。
+
+
 \subsection{Singularity}
 Singularity\cite{singularity}とは、ユーザーが自身の計算環境を完全再現し、保持できる様にしたLinuxコンテナである。
 Singularityはマルチユーザーに対応していて、コンテナ内の権限は実行ユーザーの権限を引き継ぐ。
 そのため、ユーザーに特別な権限の設定が必要ない。
 また、複雑なアーキテクチャとワークフローをサポートできるよう設計されていて、ほぼ全ての環境に適応できる。
+さらに、デフォルトで、HOME,/tmp,/proc,/sys,/devがコンテナにマウントされ、サーバー上のGPUを簡単に利用できる。
+コンテナイメージはSingularity Image Format(sif)と呼ばれる単一ファイルベースなため、アーカイブや共有が容易である。
 
 
-\section{CbC on GCC}
-あああ
 
 \section{CbC on GCC CrossCompile }
-aaa
+Singularityで環境を作成するためにファイル\ref{src:cbc_gcc_cross}を作成する。
+
+\renewcommand{\lstlistingname}{ファイル}
+\lstinputlisting[language=Bash, numbers=left, breaklines=true, basicstyle=\ttfamily\footnotesize, frame=single, caption=CbC\_gcc\_cross.def, label=src:cbc_gcc_cross]{file/cbc_gcc_cross.def}
+defファイルが作成できたらsingularity buildを下記のように行う。
+\renewcommand{\lstlistingname}{コマンド}
+\begin{lstlisting}[frame=lrbt,label=sif build,caption={singularity build}]
+ singularity build --fakeroot cbc_gcc_cross.sif cbc_gcc_cross.def
+\end{lstlisting}
+buildで生成されたsifファイル\ref{code:cbc_gcc_arm_cross}でCrossCompileを行う。
+例としてソースコード\ref{src:hello_cbc}を動かす。
 
-\section{CbC on LLVM/Clang}
-あああ
+\renewcommand{\lstlistingname}{ファイル}
+\begin{lstlisting}[frame=lrbt,label=code:cbc_gcc_arm_cross,caption={singularity上でCrossCompile}]
+ singularity shell cbc_gcc_cross.sif
+ Singularity> arm-linux-gnueabihf-gcc src/hello.cbc
+ Singularity> file a.out
+ a.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, not stripped
+\end{lstlisting}
+CrossCompileにより生成されたa.outはRaspberry Piで実行することができる。
 
-\section{CbC on LLVM/Clang CrossCompile }
-aaa
+\renewcommand{\lstlistingname}{ソースコード}
+\lstinputlisting[language=Bash, numbers=left, breaklines=true, basicstyle=\ttfamily\footnotesize, frame=single, caption=hello.cbc, label=src:hello_cbc]{file/hello.cbc}
+
+
+
--- a/paper/chapter/chapter3.tex	Mon Feb 08 23:44:31 2021 +0900
+++ b/paper/chapter/chapter3.tex	Fri Feb 12 17:14:53 2021 +0900
@@ -20,7 +20,7 @@
 Raspberry Piは、ARMプロセッサを搭載したシングルコンピュータ。
 Raspberry Piにはいくつか種類があり、本研究ではRaspberry Pi 3 Model Bを仕様する。
 Raspberry Pi 3 Model Bには、USB2.0コネクタが4つ、microSDカードスロット、HDMI出力、40ピンGPIOなどがついている。
-CPUは、ARMアーキテクチャのCortex-A53でCPUクロックは1.4GHzである。さらにメモリは1GBある。
+CPUは、ARMアーキテクチャのCortex-A53でCPUクロックは1.4GHzでメモリは1GBある。
 
 \section{Raspberry Pi 上の xv6}
 xv6はx86で動作するOSである。
@@ -34,3 +34,10 @@
 Mac側でscreenコマンドを使い、シリアル通信を行うと、Macのキーボードから入力を行える様になる。
 この時、screenコマンドを打ってから、Raspberry Piに電源を入れないと正常に起動しない。
 
+\begin{figure}[H]
+    \begin{center}
+        \includegraphics[width=100mm]{fig/raspi3.jpeg}
+    \end{center}
+    \caption{Raspberry Pi と USBserial接続}
+    \label{fig1}
+\end{figure}
\ No newline at end of file
--- a/paper/chapter/chapter4.tex	Mon Feb 08 23:44:31 2021 +0900
+++ b/paper/chapter/chapter4.tex	Fri Feb 12 17:14:53 2021 +0900
@@ -9,11 +9,32 @@
 UEFIは単なるインタフェースの仕様であるため、特定のプロセッサに依存しない。
 以前までのBIOSと異なり、近代的なソフトウェア開発手法を用いることが推奨されていて、C言語などで実装ができる。
 
-\section{UEFI vs BIOS}
+
+\section{BIOS vs UEFI}
+
+\begin{table}[H]
+  \begin{center}
+    \caption{BIOS vs UEFI}
+    \begin{tabular}{|c|c|c|c|} \hline
+	   & BIOS & UEFI(32bit) & UEFI(64bit)\\ \hline
+    OS & 16bit & 32bit & 64bit \\ \hline
+	メモリ空間 & 1MB & 4GB & 256TB\\ \hline
+    HDD容量 & 2TBまで & 2TB以上可能 & 2TB以上可能 \\ \hline
+    HDD数 & 一つ & 複数& 複数  \\ \hline
+    BOOT & GPT & MBR & MBR \\ \hline
+    Network & なし & あり & あり \\ \hline
+    セキュリティ機能 & なし & あり & あり\\ \hline 
+    \end{tabular}
+	\label{tb:biso_uefi}
+  \end{center}
+\end{table}
+\section{UEFI Application}
 aaa
 \section{Raspberry Pi UEFI}
 Raspberry PiはARMプロセッサを搭載しているので、ARMで動くUEFIを用意する必要がある。
 UEFIはマルチプラットフォームであり、UEFIの仕様はハードウェアに依存しないため、異なるCPUアーキテクチャでも動作できる。
+そのため
+
 
 
 \section{UEFI Hello World}
--- a/paper/chapter/introduction.tex	Mon Feb 08 23:44:31 2021 +0900
+++ b/paper/chapter/introduction.tex	Fri Feb 12 17:14:53 2021 +0900
@@ -15,7 +15,7 @@
 当研究室では、信頼性と拡張性をテーマにGearsOSを開発している。
 GearsOSはContinuation based C(CbC)によってアプリケーションとOSそのものを記述している。
 現在、CbCで証明可能なOSを実装するために、xv6のCbCの書き換えを行っている。
-xv6はレガシーOSなため、UEFIから起動することができない。
+xv6は Legacy OSなため、UEFIから起動することができない。
 UEFIからxv6を起動させることができれば、拡張性が大きく広がる。
 本研究では、ARMで動くシングルコンピュータであるRaspberryPi上にUEFIからGearsOSをブートさせることを目指している。
 
Binary file paper/fig/raspi3.jpeg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paper/file/cbc_gcc_cross.def	Fri Feb 12 17:14:53 2021 +0900
@@ -0,0 +1,52 @@
+BootStrap: docker
+From: ubuntu:20.04
+
+%post
+    apt-get update
+    apt-get upgrade -y
+    DEBIAN_FRONTEND=noninteractive \
+    apt-get install -y \
+        mercurial \
+        build-essential \
+        wget \
+        libmpc-dev \
+        libgmp-dev \
+        libmpfr-dev \
+        flex \
+        libssl-dev \
+        ninja-build \
+        g++-multilib \
+        gcc-multilib \
+        cmake \
+        ninja-build
+    DEBIAN_FRONTEND=noninteractive \
+    apt-get install -y \
+        crossbuild-essential-armhf
+
+    # install cbc_gcc
+    hg clone http://www.cr.ie.u-ryukyu.ac.jp/hg/CbC/CbC_gcc/
+    mkdir -p /usr/local/cbc_gcc
+    mkdir -p /CbC_gcc/builddir
+    cd /CbC_gcc/builddir
+    sh /CbC_gcc/configure -v --prefix=/usr/local/cbc_gcc --target=arm-linux-gnueabihf \
+        --enable-languages=c,lto --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard \
+        --disable-multilib --disable-nls --enable-checking=tree,rtl,assert,types "CFLAGS=-g3 -O0" \
+        --disable-libstdcxx --disable-libssp --disable-libstdcxx-pch --disable-libmudflap \
+        --with-newlib --with-sysroot=/ --with-as=/usr/arm-linux-gnueabihf/bin/as --with-ld=/usr/arm-linux-gnueabihf/bin/ld
+    ./config.status
+    make -j$(nproc) all-gcc
+    make install-gcc
+
+    # setup linker
+    ln -s /usr/arm-linux-gnueabihf/lib/crt*.o /usr/local/cbc_gcc/lib/gcc/arm-linux-gnueabihf/10.0.1/ && \
+    ln -s /usr/lib/gcc-cross/arm-linux-gnueabihf/9/crt*.o /usr/local/cbc_gcc/lib/gcc/arm-linux-gnueabihf/10.0.1/ && \
+    ln -s /usr/lib/gcc-cross/arm-linux-gnueabihf/9/libgcc* /usr/local/cbc_gcc/lib/gcc/arm-linux-gnueabihf/10.0.1/
+
+    # download arm-none-eabi
+    wget "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2?revision=ca0cbf9c-9de2-491c-ac48-898b5bbc0443&la=en&hash=68760A8AE66026BCF99F05AC017A6A50C6FD832A" -O /tmp/arm.tar.bz2 && \
+    tar -jxvf /tmp/arm.tar.bz2 -C /opt && \
+    mv /opt/gcc-arm-none-eabi-10-2020-q4-major /opt/tools
+
+%environment
+    export LANG=C
+    export PATH=/usr/local/cbc_gcc/bin:$PATH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paper/file/hello.cbc	Fri Feb 12 17:14:53 2021 +0900
@@ -0,0 +1,10 @@
+#include<stdio.h>
+
+__code hello(){
+	print("hello, world!\n");
+}
+
+int main(void){
+	goto hello();
+	return 0;
+}
Binary file paper/final_thesis.pdf has changed
--- a/paper/final_thesis.tex	Mon Feb 08 23:44:31 2021 +0900
+++ b/paper/final_thesis.tex	Fri Feb 12 17:14:53 2021 +0900
@@ -33,7 +33,7 @@
 \def\lstlistlistingname{リスト目次}
 
 \setlength{\itemsep}{-1zh}
-\title{Gears OS Device Driver}
+\title{Gears OS UEFI 対応}
 \icon{
 		\includegraphics[width=50mm]{fig/ryukyu.pdf}
 }