2010년 1월 12일 화요일

디스크 속도 확인방법

# hdparm -t /dev/hda
/dev/hda:
 Timing buffered disk reads:  146 MB in  3.03 seconds =  48.12 MB/sec
#
#

2010년 1월 11일 월요일

Linux Kernel v0.01

리눅스 커널 버전 0.01



Installing Linux on your system

Ok, this is a short guide for those people who actually want to get a
running system, not just look at the pretty source code :-). You'll
certainly need minix for most of the steps.


    0.  Back up any important software.  This kernel has been
working beautifully on my machine for some time, and has never destroyed
anything on my hard-disk, but you never can be too careful when it comes
to using the disk directly.  I'd hate to get flames like "you destroyed
my entire collection of Sam Fox nude gifs (all 103 of them), I'll hate
you forever", just because I may have done something wrong.

Double-check your hardware.  If you are using other than EGA/VGA, you'll
have to make the appropriate changes to 'linux/kernel/console.c', which
may not be easy.  If you are able to use the at_wini.c under minix,
linux will probably also like your drive.  If you feel comfortable with
scan-codes, you might want to hack 'linux/kernel/keyboard.s' making it
more practical for your [US|German|...] keyboard.


    1.  Decide on what root device you'll be using.  You can use any
(standard) partition on any of your harddisks, the numbering is the same
as for minix (ie 0x306, which I'm using, means partition 1 on hd2).  It
is certainly possible to use the same device as for minix, but I
wouldn't recommend it.  You'd have to change pathnames (or make a chroot
in init) to get minix and linux to live together peacefully.

I'd recommend making a new filesystem, and filling it with the necessary
files: You need at least the following:

    - /dev/tty0        (same as under minix, ie mknod ...)
    - /dev/tty        (same as under minix)
    - /bin/sh        (link to bash)
    - /bin/update        (I guess this should be /etc/update ...)

Note that linux and minix binaries aren't compatible, although they use
the same (gcc-)header (for ease of cross-compiling), so running one
under the other will result in errors.


    2.  Compile the source, making necessary changes into the
makefiles and linux/include/linux/config.h and linux/boot/boot.s.  I'm
using a slightly hacked gcc-1.40, to which I have added a -mstring-insns
flag, which uses the i386 string instructions for structure copy etc.
Removing the flag from all makefiles should do the trick for you.

NOTE! I'm using -Wall, and I'm not seeing many warnings (2 I think, one
about _exit returning although it's volatile - it's ok.) If you get
more warnings when compiling, something's wrong.


    3.  Copy the resultant code to a diskette of the right type.
Use 'cp Image /dev/PS0' or equivalent.


    4.  Boot with the new diskette.  If you've done everything right
(and if *I've* done everything right), you should now be running bash as
root.  You can't do much (alias ls='echo *' is a good idea :-), but if
you do run, most other things should work.  I'd be happy to hear from
anybody that has come this far - and I'll send any ported binaries you
might want (and I have).  I'll also put them out for ftp if there is
enough interest.  With gcc, make and uemacs, I've been able to stop
crosscompiling and actually compile natively under linux.  (I also have
a term-emu, sz/rz, sed, etc ...)

The boot-sequence should start with "Loading system...", and then a
"Partition table ok" followed by some root-dev info. If you forget to
make the /dev/tty0-character device, you'll never see anything but the
"loading" message. Hopefully errors will be told to the console, but if
there are problems at boot-up there is a distinct possibility that the
machine just hangs.


    5.  Check the new filesystem regularly with (minix) fsck.  I
haven't got any errors for some time now, but I cannot guarantee that
this means it will never happen.  Due to slight differences in 'unlink',
fsck will report "mode inode XXX not cleared", but that isn't an error,
and you can safely ignore it (if you don't like it, do a fsck -a every
once in a while).  Minix "restore" will not work on a file deleted with
linux - so be extra careful if you have a tendency to delete files you
don't really want to.

Logging out from the "login-shell" will automatically do a sync, and
will leave you hanging without any processes (except update, which isn't
much fun), so do the "three-finger-salute" to restart dos/minix/linux or
whatever.


    6.  Mail me and ask about problems/updates etc.  Even more
welcome are success-reports (yeah, sure), and bugreports or even patches
(or pointers to corrections).


NOTE!!! I haven't included diffs with the binaries I've posted for the
simple reason that there aren't any - I've had this silly idea that I'd
rather change the OS than do a lot of porting.  All source to the
binaries can be found on nic.funet.fi under /pub/gnu or /pub/unix.
Changes have been to makefiles or configuration files, and anybody
interested in them might want to contact me. Mostly it's been a matter
of adding a -DUSG to makefiles.

The one exception if gcc - I've made some hacks on it (string-insns),
and have got it (with the gracious help of Bruce Evans) to correctly
emit software floating point. I haven't got diffs to that one either, as
my hard-disk is overflowing and I cannot accomodate both originals and
changes, but as per the GNU copyleft I'll make them available if
someone wants them. I hope nobody want's them :-)


        Linus        [email blocked]


음양관을 다루는 컴쟁이

동양학의 핵심 주제중에 하나가 바로 음양관이고, 음양관은 모든것은 음과 양으로 나뉘고 또한 변화한다고 설명하는 영역이다. 컴쟁이들이 알아듣기 쉽게 음양관의 개념을 잡아보면, 컴퓨터는 0과 1로 구분되는 2진수로 모든 자료를 처리하는 것을 알고 있을것이다. 여기서 번쩍하고 머리에 먼가 스치는 사람은 센스만점~ ^^;

음과 양은 서로 상태가 반대되는 개념으로 -/+, 0과 1, 높고 낮고, 빛과 어둠, 남과 여, 하늘과 땅 등등. 음양은 이와 같이 어떤 상태가 서로 반대되는 개념으로 컴퓨터도 음양에 의해 철저하게 움직일 수 있게 하는 이 세상을 지배하는 자연의 법칙이다.

따라서 우리 컴쟁이들은 알게 모르게 자연의 기본적인 법칙인 음양의 조화를 마음대로 부리고 있고, 또한 무한한 변화를 만들어내고 있는 창조자인 것인데...너무 거창한가 ㅎㅎ

2010년 1월 9일 토요일

[GNU make]Makefile 작성

Makefile의 기본 구조
target ... : dependency ...                         [규칙]
             command                                [명령어]
             ...


MinGW + gdb 설치 및 설정

MinGW는 Minimalistic GNU for Windows의 약자로 윈도우즈 환경에서 GNU의 결과물들로 프로그램을 만들때 사용할 수 있는 개발환경입니다.

Dev-C++이라는 MinGW를 지원하는 통합환경도 있지만 이것조차 귀차니즘을 발동시키므로 패스...

간단한 조각코드들 테스트하는데 IDE환경까지는 부담스럽고 걍 콘솔에서 해딩 ^^

http://www.mingw.org/에서 필요한 파일을 다운로드 받고 설치한다. (소스포지로 이동)
(MinGW가 자동설치를 지원하기는 하지만 추가적으로 필요한 파일들은 수동설치 필요)
* 필요한 파일 : MinGW, gdb, libexpat
> MinGW-5.1.6.exe
> gdb-7.0.1-mingw32-bin.tar.gz
> libexpat-2.0.1-1-mingw32-dll-1.tar.gz

■ 설치할 때 디렉토리명은 공백없이 설치해야 함.
(콘솔창에서 gcc를 찾을 수 있도록 환경변수에 PATH설정, C:\GNU\MinGW\bin로 했음)

C:\>gcc --version
gcc (GCC) 3.4.5 (mingw-vista special r3)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

C:\>gdb --version
GNU gdb (GDB) 7.0.1
Copyright (C) 2009 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.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

2010년 1월 5일 화요일

rc파일의 유래

rc파일은 1965년경 CTSS 운영체제의 역사적 흔적인 "run command"를 의미한단다.

sulinux2.0 + lighttpd + cgi설정

필요한 라이브러리가 몇가지 있지만 일단 설치만 먼저...

# tar xfz lighttpd-1.4.XX.tar.gz
# cd lighttpd-1.4.XX
# ./configure --prefix="/usr/local/lighttpd" --without-bzip2
# make
# make install
# cp doc/lighttpd.conf /usr/local/lighttpd
# cp doc/rc.lighttpd.redhat /etc/init.d/lighttpd
# vi /etc/init.d/lighttpd
  25 :   LIGHTTPD_CONF_PATH="/usr/local/lighttpd/lighttpd.conf"
  29 :   lighttpd="/usr/local/lighttpd/sbin/lighttpd"
  34 :   daemon $lighttpd -f $LIGHTTPD_CONF_PATH -m /usr/local/lighttpd/lib (모듈디렉토리 지정)

# cd /etc/init.d
# chkconfig --add lighttpd
# chkconfig --level 3 lighttpd on
# chkconfig --list lighttpd

cgi설정
# cd /usr/local/lighttpd
# vi lighttpd.conf
...
server.modules = ( ...
"mod_cgi",  #주석을 제거해주면 모듈이 활성화 된다.
...
)
...
cgi.assign = ( ".pl" => "/usr/bin/perl", ".cgi" => "" ) 확장자명에 따라 실행할 프로그램 연결, 공백은 자체실행

# /etc/init.d/lighttpd restart