리눅스 - 해당되는 글 36건

모듈커널에 올리기


/*########################3-21#####################*/
#include <linux/module.h>
#include <linux/kernel.h>

int init_module(void)
{
        printk(KERN_INFO "<1>Hello world 1.\n");
        return 0;
}
void cleanup_module(void)
{
        printk(KERN_INFO "Goodbye world 1.\n");
}
#######################Makefile#####################

obj-m  += 3-21.o
#obj-m   += 3-27.o
KDIR    := /lib/modules/2.6.20-16-generic/build

all:
        make -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
        make -C $(KDIR) SUBDIRS=$(PWD) clean


/*######################3-27####################*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

static int __init hello_2_init(void)
{
        printk(KERN_INFO "<1>Hello world 2.\n");
        return 0;
}
static void __exit hello_2_exit(void)
{
        printk(KERN_INFO "Goodbye world 2.\n");
}

module_init(hello_2_init);
module_exit(hello_2_exit);

#######################Makefile#####################
#obj-m  += 3-21.o
obj-m   += 3-27.o
KDIR    := /lib/modules/2.6.20-16-generic/build

all:
       make -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
       make -C $(KDIR) SUBDIRS=$(PWD) clean

========================3-21=======================
$make
$su
#insmod ./3-21.ko
#rmmod 3-21                                        <-kernel module remove
#tail /var/log/messages                          <-kernel log message print

#modinfo 3-21                                      <-module information print
========================3-27=======================
$make
$su
#insmod ./3-27.ko
#rmmod 3-27                                        <-kernel module remove
#tail /var/log/messages                          <-kernel log message print

#modinfo 3-27                                      <-module information print
-------------------------------------------------------------------------------------------------------------------------------------------
사용자 삽입 이미지

root@ubuntu:~/test# cat Makefile
#obj-m  += 3-21.o
#obj-m  += 3-27.o
obj-m   += 3-28.o
KDIR    := /lib/modules/2.6.20-16-generic/build

all:
        make -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
        make -C $(KDIR) SUBDIRS=$(PWD) clean

####################################################
root@ubuntu:~/test# cat 3-28.c
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

#define DRIVER_AUTHOR "Peter Jay Salzman <p@dirac.org>"
#define DRIVER_DESC "A sample driver"

static int __init init_hello_4(void)
{
        printk(KERN_INFO "Hello world 4\n");
        return 0;
}
static void __exit cleanup_hello_4(void)
{
        printk(KERN_INFO "Goodbye world 4\n");
}

module_init(init_hello_4);
module_exit(cleanup_hello_4);
/*Get rid of taint message by declaring code as GPL.*/
MODULE_LICENSE("GPL");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_SUPPORTED_DEVICE("TEST DEVICE");

      리눅스  |  2007. 10. 16. 10:04




우분투(dapper,edgy) 리눅스에서 ATI Mobility Radeon M6 LY의 3d 기능을 활성화 하는 방법을 알아보자.

나의 컴퓨터 사양은 다음과 같다.

Compaq Evo N410c
512RAM
ATI Mobility Radeon M6 LY(16M)

뭐 이정도만 언급하기로 하겠다..(꽤나 낙후된 나의 랩탑이다..ㅜ.ㅜ)

암튼 Gnome돌리기에도 좀 벅찬 늙은이 컴퓨터에게 빡센 노후대책을 준비하였는데 그것이 바로 Beryl이다..

beryl에 대한 자세한 설명은 나중에 하기로 하고 오늘은 beryl의 준비과정으로 3d기능을 활성화 하는 방법을 알아보겠다.

우선 3d 드라이버가 제대로 설치되어있는지 알아보자

Code:
sudo apt-get install libgl1-mesa-dri


제대로 설치되어 있다면 xorg.conf를 설정해야한다.


Code:
sudo vim /etc/X11/xorg.conf

"Device" 항목을 찾아 다음과 같이 수정한다.

수정전:

Code:
Section "Device"
Identifier "ATI Technologies, Inc. Radeon Mobility M6 LY [Radeon Mobility 9000]"
Driver "ati"
BusID "PCI:1:0:0"
EndSection


수정후: 기존의 설정을 모두 주석처리.

Code:
#Section "Device"
# Identifier "ATI Technologies, Inc. Radeon Mobility M6 LY [Radeon Mobility 9000]"
# Driver "ati"
# BusID "PCI:1:0:0"
#EndSection

Section "Device"
Identifier "ATI Technologies, Inc. Radeon Mobility M6 LY [Radeon Mobility 9000]"
Driver "radeon"
BusID "PCI:1:0:0"
EndSection


다음으로 "Device"항목에 아래와 같은 옵션을 추가한다.

Code:
#Optimized values (changed from driver default)
Option "AGPMode" "4"
Option "AGPFastWrite" "on" #Faster than default (off)
Option "SWcursor" "off" #Faster than default (on)
Option "EnablePageFlip" "on" #Faster than default (off)
Option "AccelMethod" "EXA" # or XAA, EXA, XAA more stable, XAA is deafult
Option "DynamicClocks" "on"
Option "BIOSHotkeys" "on"

#Left to driver default
# Option "RenderAccel" "on" #Default is "on"
# Option "DMAForXv" "on" #Default is on, use default value
# Option "SubPixelOrder" "RGB" #Force subpixel order to specified order. The default is NONE for CRT, RGB for digital panels, use default value
# Option "ColorTiling" "on" # Frame buffer can be addressed either in linear or tiled mode.The default value is on. Use default value.
# Option "DDCMode" "off" #Force to use the modes queried from the connected monitor. The default is off, use default value

#These are not mentioned in man page for driver
Option "AGPSize" "32" # default: 8
Option "EnableDepthMoves" "true"


위 설정을 마쳤다면 다음과 같이 되어있을 것이다.

Code:
Section "Device"
#Info from http://www.ubuntuforums.org/showthread.php?t=246746
#More info from http://www.die.net/doc/linux/man/man4/radeon.4.html
#Even more info from http://www.thinkwiki.org/wiki/Additional_options_for_the_radeon_driver#Using_Xinerama

Identifier "ATI Technologies, Inc. Radeon Mobility M6 LY [Radeon Mobility 9000]"
Driver "radeon"
BusID "PCI:1:0:0"
Option "BusType" "PCI"

#Optimized values (changed from driver default)
Option "AGPMode" "4"
Option "AGPFastWrite" "on" #Faster than default (off)
Option "SWcursor" "off" #Faster than default (on)
Option "EnablePageFlip" "on" #Faster than default (off)
Option "AccelMethod" "EXA" # or XAA, EXA, XAA more stable, XAA is deafult
Option "DynamicClocks" "on"
Option "BIOSHotkeys" "on"

#Left to driver default
# Option "RenderAccel" "on" #Default is "on"
# Option "DMAForXv" "on" #Default is on, use default value
# Option "SubPixelOrder" "RGB" #Force subpixel order to specified order. The default is NONE for CRT, RGB for digital panels, use default value
# Option "ColorTiling" "on" # Frame buffer can be addressed either in linear or tiled mode.The default value is on. Use default value.
# Option "DDCMode" "off" #Force to use the modes queried from the connected monitor. The default is off, use default value

#These are not mentioned in man page for driver
Option "AGPSize" "32" # default: 8
Option "EnableDepthMoves" "true"
EndSection


다음 "Module"항목을 찾아 아래와 같은 옵션을 추가한다.

Code:
        Load	"dri"
Load "extmod"
Load "glx"
Load "GLcore"

beryl을 사용하고자 한다면 "GLcore" 항목을 주석처리한다.

설정을 마쳤다면 다음과 같다.

Code:
Section "Module"
Load "i2c"
Load "bitmap"
Load "ddc"
Load "freetype"
Load "int10"
Load "type1"
Load "vbe"
Load "dri"
Load "extmod"
Load "glx"
#Load "GLcore"(필자는 beryl사용을 위해 주석처리하였다)
EndSection

이제 컴퓨터를 리붓한다.

Code:
sudo shutdown -r now

리붓을 하였는데 제대로 X가 뜨지 않는다면 콘솔로 빠져나와 원래의 xorg.conf 설정으로 복원한다.(백업은 필수다.)

리붓후 3d기능이 활성화되었는지 확인해보자.

Code:
glxinfo | grep direct

direct:Yes 라고 나오면 설정에 성공한 것이다.

다음 패키지가 없다면 설치해주자.

Code:
sudo apt-get update
sudo apt-get install libgl1-mesa-dri
sudo apt-get install locales
sudo apt-get install gtk2-engines-ubuntulooks


이로써 모든 셋팅이 끝났다.

우분투가 ATI Mobility Radeon M6 LY의 3d 성능을 인식하지 못하는 것은 아니었으나 위와 같이 설정할 경우 좀 더 최적화된 3d환경을 구축할 수 있기에 문서로 정리하였으며 보다 자세한 사항은 우분투 포럼에서 알아볼 수 있다.

다음에는 AIGLX를 이용한 beryl구현방법을 알아보겠다.(언제가 될지는 나도 몰라..ㅋㅋ)
      리눅스  |  2007. 10. 15. 00:07




11). Network device support

- Network device support를 선택한 후에 Ethernet(10 or 100Mbit)에서 카드 선택

모    델

선 택   모 듈

3COM 3c900B

3C590/3c900 series "Vortex/Boomerang" support 선택(모듈명 3c59x.o)

3COM EtherLink III

3c509/3c579 support 선택(모듈명 3c509.o)

저가 ISA Ethernet Card

Other ISA CARD에서 NE2000/NE1000 support 선택(ne.o)

저가 PCI 10 Mega

PCI NE2000 support(ne2k-pci.o)

저가 PCI 100 Mega

RealTek 8129/8139 support(rtl8139.o)

홈 PNA 카드

AMD PCnet32 support(pcnet32.o)

Tulip 칩 카드

DECchip Tulip(dc21x4x) PCI support(tulip.o)

INTEL PCI

EtherExpress Pro/100 Support(eepro100.o)

12). Amateur Radio support

- 아마추어 햄 통신 라디오를 설정하고자 할 경우 선택하는 옵션

- [n]


13). IrDA(infrared) Support

- IrDA(무선 적외선 포트) 장치가 있을 시 선택하는 옵션

- irmanager와 irattach와 같은 utility가 필요

- [n]


14). ISDN Support

- [n]


15). Old CD-ROM drivers(not SCSI, not IDE)

- 2배속과 같은 구형의 CD-ROM을 사용하고자 할 때 리스트에 맞는 CD-ROM 선택

- [n]


16). Character devices

① Virtual terminal

- 가상 콘솔 사용 시 필요한 옵션

- 가상 콘솔은 ALT+(

      리눅스  |  2007. 10. 8. 12:35



sokoban's Blog is powered by Daum & Tattertools