Linux How to
移植作業、ドライバー作成作業上必要になってNet上で調べたもので、コピヘがほとんどですので他
に転載しないで下さい。
** プリエンティブカーネル機能
タスク(コンピュータが管理する仕事の単位)が持つ優先度に反して実行順序が逆転するのを防ぐ機能。
あるタスク実行中に,ある外部からの刺激によって割り込み処理が発生し,
実行中のタスク優先度より高い優先度を持つタスクが実行可能状態になった場合,
実行中のタスクの処理途中でも,優先度の高いタスクの処理に実行を移すことができる。
この機能により,外部からの応答性を高めることが可能になる。
** CPUの型,kernel versionを求める
uname -m
i686など
unameのみ Linux
バージョン確認。
% cat /etc/fedora-release
** X Window(GNOMEなど)を使用中にマウスがハングアップ状態になってしまった。
この状態でシステムをシャットダウンさせる方法を教えてほしい。
※ キーボードは反応している状態
[構成]
Red Hat LINUX
[解決方法]
以下の方法でコンソール画面に移動し、shutdown コマンドが実行できます。
[1] [Ctrl] + [Alt] + [F1] から [F6] でコンソール画面に移行します。
※ [F7] は X Window で予約済みです。
[2] ログインプロンプトが表示されていますので、rootでログイン後、
shutdown -h 0 を実行することで、シャットダウンできます。
[3] GNOME に戻りたいときは [Ctrl] + [Alt] + [F7] で戻ります。
** nmで.oのラベル、関数名を見られる。
** fileの形式
ターゲット ARM etc ELFなどが出る .koでもOK
file filename
** プログラムファイルのヘッダー解析
readelf
** ユーザに対してハードディスクの使用制限をする
quotaの設定
quotaを使用するには、システムパーテション以外のパーテションが必要です。
システム用のパーテションにはquotaを使用できませんので、あらかじめ、
ユーザ領域などのquotaを使いたい領域は別パーテションにしておく必要があります。
** config.h
エラーメッセージの通りで、linux/config.hは
(少なくとも2.6.18以上は)ありません。
linux/autoconf.hに書き直して下さい。
** DHCPサーバー設定 fedora7
[root@linux ~]# cp /usr/share/doc/dhcp-*/dhcpd.conf.sample
/etc/dhcpd.conf
← DHCPサーバー設定ファイルをサンプルより作成
[root@linux ~]# vi /etc/dhcpd.conf ← DHCPサーバー設定ファイル編集
ddns-update-style interim;
ignore client-updates;
not authoritative; ← 追加(以下のような警告メッセージがログに出力されることの対処)
If this DHCP server is authoritative for that subnet,
please write an `authoritative;' directive either in the
subnet declaration or in some scope that encloses the
subnet declaration - for example, write it at the top
of the dhcpd.conf file.
subnet 192.168.1.0 netmask 255.255.255.0 { ← 自身の環境にあわせて編集
# --- default gateway
option
routers
192.168.1.1; ← ルーター経由接続環境の場合はルーターのIPアドレスを指定
PPPoE接続環境の場合はサーバーのIPアドレスを指定
option
subnet-mask
255.255.255.0;
#option
nis-domain
"domain.org"; ← コメントアウト
option
domain-name-servers 192.168.1.1;
← ルーター経由接続環境の場合はルーターのIPアドレスを指定
option
domain-name-servers
XXX.XXX.XXX.XXX,XXX.XXX.XXX.XXX;
← PPPoE接続環境の場合はプロバイダから通知されたDNSサーバーのIPアドレス(プライマリ,セカンダリ)を指定
option
time-offset
-18000; # Eastern Standard Time
# option
ntp-servers
192.168.1.1;
# option
netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change
this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp
192.168.1.2 192.168.1.254; ← 割当てるIPアドレスを指定(192.168.1.2~192.168.1.254)
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to
appear at a fixed address
#host ns { ← コメントアウト
# next-server
marvin.redhat.com; ← コメントアウト
# hardware ethernet
XX:XX:XX:XX:XX:XX; ← コメントアウト
# fixed-address
207.175.42.254; ← コメントアウト
#} ← コメントアウト
以下はホストwin-client1にプライベートIPアドレスを固定で割当てる場合
host win-client1 { ← ホスト名
hardware ethernet
XX:XX:XX:XX:XX:XX; ← win-client1に装着しているネットワークアダプタのMACアドレス※
fixed-address 192.168.1.10; ← win-client1に固定で割当てるIPアドレス
}
}
※ネットワークアダプタのMACアドレスは、「ipconfig /all」(Windowsの場合)、「ifconfig」(Linuxの場合)で確認
■DHCPサーバー起動
[root@linux ~]# /etc/rc.d/init.d/dhcpd start ← DHCPサーバー起動
dhcpd
を起動中:
[ OK ]
■DHCPサーバー確認(クライアントがWindowsの場合)
(1)クライアント側でDHCPサーバーからIPアドレスを自動取得するように設定
「マイ ネットワーク」右クリック⇒「プロパティ」⇒「ローカル
エリア接続」⇒「プロパティ」ボタン⇒「インターネットプロトコル(TCP/IP)」⇒「IPアドレスを自動的に取得」、「DNSサーバーのIPアドレス
を自動的に取得」にチェック⇒OKボタン押下
(2)クライアント側でのDHCPサーバーからのIPアドレス取得状況確認
C:\Documents and Settings\fedora>ipconfig /all ← IPアドレス割当て状況確認
Ethernet adapter ローカル エリア接続:
Connection-specific DNS
Suffix . : fedorasrv.com
Description . . . . . . . .
. . . : ADMtek ADM9511 10/100Mbps Fast Ethernet Adapter
Physical Address. . . . . .
. . . : XX-XX-XX-XX-XX-XX
Dhcp Enabled. . . . . . . .
. . . : Yes ← DHCPサーバーが有効であることを示す
Autoconfiguration Enabled .
. . . : Yes
IP Address. . . . . . . . .
. . . : 192.168.1.10 ← DHCPサーバーから割り当てられたIPアドレス
Subnet Mask . . . . . . . .
. . . : 255.255.255.0
Default Gateway . . . . . .
. . . : 192.168.1.1 ← DHCPサーバーから割り当てられたルーターのIPアドレス
DHCP Server . . . . . . . .
. . . : 192.168.1.1 ← DHCPサーバーのIPアドレス
DNS Servers . . . . . . . .
. . . : XXX.XXX.XXX.XXX ← DHCPサーバーから割り当てられたDNSサーバーのIPアドレス
XXX.XXX.XXX.XXX ← DHCPサーバーから割り当てられたDNSサーバーのIPアドレス
Lease Obtained. . . . . . .
. . . : 2004年8月30日 0:14:26
Lease Expires . . . . . . .
. . . : 2004年8月30日 6:14:26
■DHCPサーバー確認(クライアントがLinuxの場合)
(1)クライアント側でDHCPサーバーからIPアドレスを自動取得するように設定
[root@client ~]# ifconfig | grep HWaddr ← ネットワークアダプタのMACアドレス確認
eth0 Link encap:Ethernet HWaddr
XX:XX:XX:XX:XX:XX ← ネットワークアダプタのMACアドレス
[root@client ~]# vi
/etc/sysconfig/network-scripts/ifcfg-eth0 ← ネットワーク設定ファイル編集
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=XX:XX:XX:XX:XX:XX ← ネットワークアダプタのMACアドレスを指定
ONBOOT=yes
TYPE=Ethernet
[root@client ~]# /etc/rc.d/init.d/network reload ← ネットワーク設定反映
インターフェース
eth0を終了中:
[ OK ]
ループバックインターフェース
を終了中
[
OK ]
ネットワークパラメーターを設定中:
[ OK ]
ループバックインターフェイスを呼び込み中
[
OK ]
インターフェース
eth0を活性化中:
[ OK ]
(2)クライアント側でのDHCPサーバーからのIPアドレス取得状況確認
[root@client ~]# ifconfig eth0 ← IPアドレス割当て状況確認
eth0 Link encap:Ethernet HWaddr
XX:XX:XX:XX:XX:XX
inet
addr:192.168.1.2 Bcast:192.168.1.255
Mask:255.255.255.0 ← DHCPサーバーから割り当てられたIPアドレス
inet6 addr:
fe80::a00:46ff:fe28:e57f/64 Scope:Link
UP BROADCAST
RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2516
errors:0 dropped:0 overruns:0 frame:0
TX packets:1725
errors:0 dropped:0 overruns:0 carrier:0
collisions:0
txqueuelen:1000
RX bytes:3000964
(2.8 Mb) TX bytes:159154 (155.4 Kb)
[root@client ~]# cat /etc/resolv.conf | grep
nameserver ← 問合せ先DNSサーバーのIPアドレス確認
nameserver XXX.XXX.XXX.XXX ← DHCPサーバーから割り当てられたDNSサーバーのIPアドレス
nameserver XXX.XXX.XXX.XXX ← DHCPサーバーから割り当てられたDNSサーバーのIPアドレス
■DHCPサーバー自動起動設定
[root@linux ~]# chkconfig dhcpd on ← DHCPサーバー自動起動設定
[root@linux ~]# chkconfig --list dhcpd ← DHCPサーバー自動起動設定確認
dhcpd
0:off 1:off 2:on
3:on 4:on 5:on
6:off ← ランレベル2~5のonを確認
設定を保存した後、「ifup eth0」でネットワークを有効にできます。
** httpd BusyBox
(2)Webサーバの設定
では、本題のWebサーバを設定しましょう……。と、いってもBusyBoxの「httpd」は非常にシンプルで、Webサーバのルートディレクトリを
「/var/www」とした場合、設定ファイル“/etc/httpd.conf”に、
H:/var/www
と1行入れるか、「httpd」起動時に以下のようにオプションを付けるだけで完了です。
# httpd -h /var/www
** 日付のセット
-bash-3.1# date -s "07/02 13:16 2007"
Mon Jul 2 13:16:00 EDT 2007
** system clockをRTCにセットする
Mon Jun 25 18:16:03 EDT 2007
-bash-3.1# /sbin/hwclock -w
-bash-3.1# /sbin/hwclock
Mon Jun 25 18:18:13 2007 -0.119770 seconds
tftpboot 0x100000 192.168.1.7:/zImage
tftpboot 0x100000 c0a80107:/zImage NG
OMAP5912 OSK # setenv serverip 192.168.1.7
OMAP5912 OSK # setenv ipaddr 192.168.1.5
** デバイスドライバーメジャー番号、マイナー番号の決定
メジャー番号は接続されるデバイスの種類を、マイナー番号はデバイスのIDを表します。メジャー番号のうち幾つかは
/usr/include/linux/major.hの中で定義されていますので、予め確認しましょう。
ここでは、hogeという名のデバイスをメジャー番号240&マイナー番号10で登録するとします(デバイスの種類によっては予めメジャー番号が決まって
います。/usr/include/linux/major.hをご参照下さい)。
** GCC でヘッダーファイルが検索できない
yumはlibの時でもヘッダーファイルをインストールしない。
** File Imageをマウント
** loopデバイス
mount -o loop /boot/initrd.xxxx /mnt
umount しないでshutdown するとinodeだけ残る、2重にマウントされてしまう
** moduleの関係
最初の.koがわかればmodprobe mmmm.koで必要なものが出る
modprobeの説明
http://www.linux-beginner.com/linux_setei4.html
modprobeは/lib/modules.depファイルを見る
depmodは/lib/modules.depファイル作る
** デバイスが使用可能か
$ cat /proc/devices
Character devices:
1 mem
2 pty
3 ttyp
4 /dev/vc/0
4 tty~中略~
Block devices:
2 fd
7 loop
8 sd
9 md
11 sr
** RedBoot
fconfig -lが無いとき
RedBoot> fis list
Name
FLASH addr Mem addr
Length Entry point
RedBoot
0x60000000 0x60000000 0x00040000 0x00000000
RedBoot config 0x60FC0000 0x60FC0000
0x00001000 0x00000000
FIS directory 0x60FE0000 0x60FE0000
0x00020000 0x00000000
netbsd
0x60040000 0x00200000 0x00500000 0x00200000
netbsd_install 0x60540000 0x00200000
0x00500000 0x00200000
ramdisk.gz 0x60A40000
0x00800000 0x00300000 0x00800000
zImage
0x60D40000 0x00080000 0x00180000 0x00080000dump -b
0x60fe0000 -l 0x200
dump -b 0x60fc0000 -l 0x200 ここにfconfigの内容がある
なぜかIPアドレスがない?
** ftpget
Options:
-c,
--continue Continue a
previous transfer
-v,
--verbose Verbose
-u,
--username Username to
be used
-p,
--password Password to
be used
-P,
--port
Port number to be used
ftpget -u Name -p Passwd Lname Rname
** インプットディバイスの一覧はどのようにしたら得られる?
cat /proc/bus/input/devices
I: Bus=0003 Vendor=056e Product=1004 Version=0100
N: Name="ELECOM ELECOM Lunaris USB tenkeyboard (w/2p-HUB)"
P: Phys=usb-ep93xx_usb-1.1/input0
H: Handlers=kbd
B: EV=12000b
B: KEY=10000 7 ff87207a c14057ff febeffdf ffefffff ffffffff fffffffe
B: ABS=300 0
B: LED=1f
I: Bus=0003 Vendor=1267 Product=0210 Version=0001
~
~
mount -t nfs 192.168.1.7:/data/work /home
root:~> mount -t nfs 192.168.1.7:/data/xilinx /home
mount: RPC: Unable to receive; errno = No route to host
eatrer card 停止中
root:~> mount -t nfs 192.168.1.7:/data/xilinx /home
### Application running ...
rpcbind: server localhost not responding, timed out
RPC: failed to contact local rpcbind server (errno 5).
rpcbind: server localhost not responding, timed out
RPC: failed to contact local rpcbind server (errno 5).
lockd_up: makesock failed, error=-5
rpcbind: server localhost not responding, timed out
RPC: failed to contact local rpcbind server (errno 5).
mount: mounting 192.168.1.7:/data/xilinx on /home failed
** Netperf
**
NICの転送速度を計測するソフトとして「Netperf」があります
まず、win32用のバイナリを用意します、送信側でnetperf.exe 受信側でnetserver.exeを使用します。
** add file to ramdisk
使い終ったら shutdownの前にumountしないと次回は二重にマウントされ消せない。
1. Yes, what I meant was normal ppc405/440 APU. I already have a
hardware module and application software running on the bare
"standalone" mode. If the APU related driver is already in the kernel,
then I'll just build the software and hope it will work.
2. I downloaded the gunzipped ramdisk image from the wikidot website,
and used it as is. I unzipped it, it appeared to be a piece of
program called "ramdisk_image", but I don't know what to do with it.
Can you tell me how to add files to it, or build a ramdisk manually in
Xilinx Open Source Linux?
Thanks again,
1. To my knowledge there is no APU driver in Linux. The
only example might be the FPU of the 440 which uses the APU. I don't
have experience with this and don't test it. Once you are adding
you're own hardware onto the APU I think that would need to be driver
in Linux but it may be accessible thru userspace also.
2. Just about any of the embedded Linux books tell how to work with
ramdisks. It's hard to explain all the details here, but once you
unzip it you have a ramdisk image that needs to be mounted. Once
it's mounted then you can modify it (copy files to it), unmount it, and
rezip it.
a.gunzip ramdisk.image.gz
b. mkdir temp
c. mount -o loop ramdisk.image /temp (need sudo or root
privaledges)
d. cd temp (you should see the root file system)
e. make changes by copying files into the dir structure
f. umount temp
g. gzip ramdisk.image.gz
-- John
** ルートパーティションを書き込み可能に
何かファイルを作ってみようとすると,こんなエラーが出てしまいます.
# cat > hoge
-sh: cannot create hoge: Read-only file system
#
mount コマンドで確認してみると,ルートパーティションがリードオンリーでマウントされています.
# mount
/dev/ram0 on / type ext2 (ro)
/proc on /proc type proc (rw)
#
正解はこちら.
# mount -o rw,remount /dev/ram0 /
# cat > hoge
hoge
#
** 日本語のコード変換
iconvは\nが2バイト\になる
iconv --help
Usage: iconv [OPTION...] [-f ENCODING] [-t ENCODING] [INPUTFILE...]
-f shift_JIS -t UTF-8 "Input File Name" > "Output File Name"