2020年10月24日土曜日

The Go Programming Language


 公式サイト

公式tutorial getting started

自習場所

自習場所(日本語)


[memo]

外部からパッケージをインポートする場合は、

$ go mod init myprog.go

を実行すると (myprog.goは、外部パッケージをimportしているプログラム)

~/go/pkg/mod/

にダウンロードされる。

パッケージは、ここから検索できる。


外部から参照されるモジュールを作成する場合

モジュール用のデレクトリを作成しそこに移動する。

$ go mod init インポート名

インポート名は、importで参照する名前、ドメイン名/パッケージ名にする。

を実行しgo.modを作成する。

参照側は、自身のgo.modにreplace ドメイン名/パッケージ名 => 対象パス を追加する








2020年4月16日木曜日

FreeBSD kernel build

まずは、FreeBSD Handbookの8.5. Building and Installing a Custom Kernelを読む

#cd /usr/src
#make buildkernel KERNCONF=MYKERNE

詳しく知るには、
/usr/src/Makefileを読む。

その前に、Developers' HandbookのChapter 9. Building and Installing a FreeBSD Kernelを読む

#/usr/sbin/config MYKERNEL

続いて、config(8)を読む
man config

SYNOPSIS
     config [-CVgp] [-I path] [-d destdir] [-s srcdir] SYSTEM_NAME
     config [-x kernel]

     SYSTEM_NAME      Specify the name of the system configuration file
                      containing device specifications, configuration options
                      and other system parameters for one system
                      configuration.

MYKERNELは、SYSTEM_NAMEのことでシステムの構成を記述したファイル、
通常は、/sys/ARCH/confに存在する。(ARCHは、amd64)
configは、Makefileなどビルドに必要なファイルを作成する。
テンプレートが/sys/ARCH/confにある。テンプレートを修正してはいけない。
コピーして使う。
書き方は、config(5)に書かれている。

FILES
     /sys/conf/files                                         list of common files system is built from
     /sys/conf/Makefile.ARCH                                 generic makefile for the ARCH
     /sys/conf/files.ARCH                                    list of ARCH specific files
     /sys/ARCH/compile/SYSTEM_NAME   
                       default kernel  build directory for system  SYSTEM_NAME on ARCH

時間があれば、Building 4.4BSD Kernels with Configを読む。

config(5)によると
     device name [, name [...]]
     devices name [, name [...]]
             Configures the specified devices for inclusion into the kernel
             image.  Devices that are common to all architectures are defined
             in the file sys/conf/files.  Devices that are specific to
             architecture arch are defined in the file sys/conf/files.<arch>.


2020年4月5日日曜日

GNU Make 4.1 (1)

$ make --version
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

makeは、versionが異なると細かい部分で異なるので注意が必要

make [OPTION]... [TARGET]...

makeは、makefileと呼ばれるファイルを読み込み、makefileに従い処理を行う。
makefileには、ビルドに必要な情報が書かれている。

makeを引数なしで実行すると
GNUmakefile, makefile, Makefileの順でファイルを探していく。
最初に見つかったファイルをmakefileとして処理する。

.dependがあれば読み込む。

$ make
make: *** No targets specified and no makefile found.  Stop.

$ touch GNUmakefile
$ make
make: *** No targets.  Stop.

$ echo hello: > makefile
$ make
make: *** No targets.  Stop.       # makefile でなくGNUmakefileが読み込まれる
$ cp makefile GNUmakefile 
$ make
make: Nothing to be done for 'hello'.

通常は、Makefileを使うことが推奨されている。
GNUmakefileは、GNU makeに限定される場合だけに使用する。

makeが上手く動作しない場合は、-dを付けて実行すると、原因がわかるかもしれない

概要   https://www.gnu.org/software/make/
マニュアルhttps://www.gnu.org/software/make/manual/
開発   http://savannah.gnu.org/projects/make/







2020年1月2日木曜日

ubuntu server インストール

ubuntu を使ってライブUSB を作ってインストールする方法

ここがインストールのチュートリアル。
https://tutorials.ubuntu.com/tutorial/tutorial-install-ubuntu-server?_ga=2.54415336.1168427040.1568425745-2077189292.1557957691#0

インストール用のUSBを作る。
ここがubuntuでの作成方法のチュートリアル。
https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu#0

ここからISOイメージをダウンロードする。
https://ubuntu.com/download/server

‘Startup Disk Creator' を使ってusbメモリに書き込む。
 ddコマンドでも書き込める
lsblkでsdxをしらべ
dd bs=4M if=./image.usb of=/dev/sdX && sync

BIOSを設定して、USBから起動するようにする。

usbメモリを刺したまま起動する。

あとは、ガイドに従い操作する。

めも
BIOSをupdateしないとインストールできないことがある。