Michael Morscher, <michael.morscher@hs-augsburg.de>, #921468
Inhaltsverzeichnis
* Intel Core i7-2600K, 4x 3.40GHz, 8MB L3 Cache shared (TurboModus aus, Übertaktet mit Wasserkühlung auf 4,5 Ghz) * ASRock P67 Extreme4 Mainboard * 8GB G.Skill Ripjaws 1600 CL7
Dimension: 100 x 100 mm
CPU: 400 MHz Samsung S3C2440A ARM920T (max freq. 533 MHz)
RAM: 64 MB SDRAM, 32 bit Bus
Flash: 256 MB NAND Flash and 2 MB NOR Flash with BIOS
EEPROM: 1024 Byte (I2C)
Ext. Memory: SD-Card socket
Serial Ports: 1x DB9 connector (RS232), total: 3x serial port connectors
USB: 1x USB-A Host 1.1, 1x USB-B Device 1.1
Audio Output: 3.5 mm stereo jack
Audio Input: Connector + Condenser microphone
Ethernet: RJ-45 10/100M (DM9000)
RTC: Real Time Clock with battery
Beeper: PWM buzzer
Camera: 20 pin Camera interface (2.0 mm)
LCD Interface
STN Displays
TFT Displays
41 pin connector for FriendlyARM Displays and VGA Board
Touch Panel: 4 wire resistive
User Inputs: 6x push buttons and 1x A/D pot
User Outputs: 4x LEDs
Expansion: 40 pin System Bus, 34 pin GPIO, 10 pin Buttons (2.0 mm)
Debug: 10 pin JTAG (2.0 mm)
Power: regulated 5V (DC-Plug: 1.35mm inner x 3.5mm outer diameter)
Power Consumption: Mini2440 + 3.5" LCD: 0.6 A
OS Support
Windows CE 5 and 6
Linux 2.6
Android
CON4<2> = VDD3.3V CON4<3> = GND CON4<5> = AIN0 = W1 (A/D INPUT TEST ON-BOARD POT) CON4<6> = AIN1 CON4<7> = AIN2 CON4<8> = AIN3 CON4<9> = EINT0 = GPF0 CON4<10> = EINT1 = GPF1 CON4<11> = EINT2 = GPF2 CON4<12> = EINT3 = GPF3 = CON5<5> (SYSTEM INTERFACE EXPANSION BUS) CON4<13> = EINT4 = GPF4 CON4<14> = EINT5 = GPF5 CON4<15> = EINT6 = GPF6 CON4<16> = EINT8 = GPG0 = K1 (PULLUP ON-BOARD) CON4<17> = EINT9 = GPG1 = CON5<6> (SYSTEM INTERFACE EXPANSION BUS) CON4<18> = EINT11 = GPG3 = nSS1 = K2 (PULLUP ON-BOARD) CON4<19> = EINT13 = GPG5 = SPIMISO1 = K3 (PULLUP ON-BOARD) CON4<20> = EINT14 = GPG6 = SPIMOSI1 = K4 (PULLUP ON-BOARD) CON4<21> = EINT15 = GPG7 = SPICLK1 = K5 (PULLUP ON-BOARD) CON4<22> = EINT17 = GPG9 = nRST1 = CON5<3> (SYSTEM INTERFACE EXPANSION BUS) CON4<23> = EINT18 = GPG10 = nCTS1 = CON5<4> (SYSTEM INTERFACE EXPANSION BUS) CON4<24> = EINT19 = GPG11 = K6 (PULLUP ON-BOARD) CON4<25> = SPIMISO = GPE11 CON4<26> = CON4<20> CON4<27> = SPICLK = GPE13 CON4<28> = nSS_SPI = GPG2 = EINT10 = CON20<3> (CAMERA) CON4<29> = I2CSCL = GPE14 = CON20<2> (CAMERA) CON4<30> = I2CSDA = GPE15 = CON20<1> (CAMERA) CON4<31> = GPB0 = TOUT0 = BUZZER (ON-BOARD) CON4<32> = GPB1 = TOUT1 = LED BACKLIGHT (LCD_PWR PWM OUTPUT) CON4<33> = CLKOUT0 = GPH9 CON4<34> = CLKOUT1 = GPH10
apt-get install nfs-kernel-server nfs-common
/nfs 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
mkdir /test mount -t nfs localhost:/nfs /test
apt-get install ntp
server pool.ntp.org iburst server 127.127.1.0 fudge 127.127.1.0 stratum 10 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
Jun 3 16:23:52 buildroot ntpd[16750]: synchronized to 134.34.3.19, stratum 2 Jun 3 16:26:18 buildroot ntpd[16750]: time reset +145.652714 s
apt-get install binutils build-essential g++ gcc ncurses-dev bison flex gettext texinfo subversion git-core
git clone git://git.buildroot.net/buildroot
make mini2440_defconfig
make menuconfig
make
ln -s ../buildroot-dl dl
make clean
* Kernel Headers (Linux 2.6.39.x kernel headers) * uClibc C library Version (uClibc 0.9.32.x) * Binutils Version (binutils 2.21) * GCC Compiler Version (gcc 4.6.x) * Purge unwanted locals * Enable large file (files > 2 GB) support * Enable RPC support * Enable WCHAR support * Enable toolchain locale/i18n support * Enable C++ support
* System hostname (deathstar) * System banner (Surrender! Resistance is futile!) * (ttySAC0) Port to run a getty (login prompt) on
Bootloaders --> [X] U-Boot --> U-Boot Boardname (mini2440) U-Boot Version (2011-03) U-Boot Binary Format (u-boot.bin) [X] Network Settings
##### FriendlyARM BIOS 2.0 for 2440 ##### [x] format NAND FLASH for Linux [v] Download vivi [k] Download linux kernel [y] Download root_yaffs image [a] Absolute User Application [n] Download Nboot for WinCE [l] Download WinCE boot-logo [w] Download WinCE NK.bin [d] Download & Run [z] Download zImage into RAM [g] Boot linux from RAM [f] Format the nand flash [b] Boot the system [s] Set the boot parameters [u] Backup NAND Flash to HOST through USB(upload) [r] Restore NAND Flash from HOST through USB [q] Goto shell of vivi [i] Version: 1026-2K Enter your selection: f
Supervivi> load flash 0 248932 u USB host is connected. Waiting a download. Now, Downloading [ADDRESS:30000000h,TOTAL:248942] RECEIVED FILE SIZE: 248942 (48KB/S, 5S) Downloaded file at 0x30000000, size = 248932 bytes Found block size = 0x00040000 Erasing... ... done Writing... ... done Written 248932 bytes
root@ubuntu:/.../make cc -o boot_usb.o -c boot_usb.c cc -lusb -o s3c2410_boot_usb boot_usb.o
root@ubuntu:/.../s3c2410_boot_usb# ls -al total 296 drwxr-xr-x 2 500 users 4096 2011-05-10 19:55 . drwxr-xr-x 6 gr3yh0und gr3yh0und 4096 2011-05-10 19:51 .. -rw-r--r-- 1 500 users 5462 2006-08-07 09:00 boot_usb.c -rw-r--r-- 1 root root 5464 2011-05-10 19:51 boot_usb.o -rw-r--r-- 1 500 users 1852 2006-07-15 14:32 lsusb.txt -rw-r--r-- 1 500 users 220 2006-08-07 09:00 Makefile -rw-r--r-- 1 500 users 703 2006-07-15 19:16 README -rwxr-xr-x 1 root root 13700 2011-05-10 19:51 s3c2410_boot_usb -rwxr-xr-x 1 root root 248932 2011-05-10 19:55 u-boot.bin
root@ubuntu:/.../s3c2410_boot_usb# ./s3c2410_boot_usb u-boot.bin csum = 0x 377 send_file: addr = 0x33f80000, len = 0x0003cc64 Error downloading program
Now, Downloading [ADDRESS:30000000h,TOTAL:248942] RECEIVED FILE SIZE: 248942 (121KB/S, 2S) Downloaded file at 0x30000000, size = 248932 bytes Found block size = 0x00040000 Erasing... ... done Writing... ... done Written 248932 bytes Supervivi>
U-Boot 1.3.2-mini2440 (May 10 2011 - 17:55:30) I2C: ready DRAM: 64 MB NOR Flash not found. Use hardware switch and 'flinit' Flash: 0 kB NAND: Bad block table not found for chip 0 Bad block table not found for chip 0 256 MiB *** Warning - bad CRC or NAND, using default environment USB: S3C2410 USB Deviced In: serial Out: serial Err: serial MAC: 04:25:fe:ed:00:18 Hit any key to stop autoboot: 0
MINI2440 # nand scrub NAND scrub: device 0 whole chip Warning: scrub option will erase all factory set bad blocks! There is no reliable way to recover them. Use this command only for testing purposes if you are sure of what you are doing! Really scrub this NAND flash? <y/N> Erasing at 0x3840000 -- 22% complete. NAND 256MiB 3,3V 8-bit: MTD Erase failure: -5 Erasing at 0x7840000 -- 47% complete. NAND 256MiB 3,3V 8-bit: MTD Erase failure: -5 Erasing at 0x7d60000 -- 49% complete. NAND 256MiB 3,3V 8-bit: MTD Erase failure: -5 Erasing at 0xccc0000 -- 80% complete. NAND 256MiB 3,3V 8-bit: MTD Erase failure: -5 Erasing at 0xffe0000 -- 100% complete. Bad block table not found for chip 0 Bad block table not found for chip 0 OK
MINI2440 # nand createbbt Create BBT and erase everything ? <y/N> Skipping bad block at 0x03980000 Skipping bad block at 0x07880000 Skipping bad block at 0x07ec0000 Skipping bad block at 0x0ce80000 Skipping bad block at 0x0ff80000 Skipping bad block at 0x0ffa0000 Skipping bad block at 0x0ffc0000 Skipping bad block at 0x0ffe0000 Creating BBT. Please wait ...Bad block table not found for chip 0 Bad block table not found for chip 0 Bad block table written to 0x0ffe0000, version 0x01 Bad block table written to 0x0ffc0000, version 0x01
U-Boot 1.3.2-mini2440 (May 10 2011 - 17:55:30) I2C: ready DRAM: 64 MB NOR Flash not found. Use hardware switch and 'flinit' Flash: 0 kB NAND: 256 MiB *** Warning - bad CRC or NAND, using default environment USB: S3C2410 USB Deviced In: serial Out: serial Err: serial MAC: 04:25:fe:ed:00:18 Hit any key to stop autoboot: 0 MINI2440 # dynpart mtdparts mtdparts=mini2440-nand:0x00040000(u-boot),0x00020000(u-boot_env),0x00500000(kernel),0x0faa0000(rootfs) MINI2440 # dynenv set u-boot_env device 0 offset 0x40000, size 0x20000 45 4e 56 30 - 00 00 04 00
MINI2440 # mtd device nand0 <mini2440-nand>, # parts = 4 #: name size offset mask_flags 0: u-boot 0x00040000 0x00000000 0 1: u-boot_env 0x00020000 0x00040000 0 2: kernel 0x00500000 0x00060000 0 3: rootfs 0x0faa0000 0x00560000 0 active partition: nand0,0 - (u-boot) 0x00040000 @ 0x00000000 defaults: mtdids : nand0=mini2440-nand mtdparts: <NULL>
setenv root_nfs /nfs/rootfs setenv baudrate 115200 setenv netmask 255.255.255.0 setenv serverip 192.168.1.1 setenv ipaddr 192.168.1.2
setenv ifconfig_static setenv ifconfig ip=${ipaddr}:${serverip}::${netmask}:mini2440:eth0
run ifconfig_static
run setenv ifconfig ip=${ipaddr}:${serverip}::${netmask}:mini2440:eth0
setenv bootargs_base console=ttySAC0,${baudrate} noinitrd consoleblank=0
setenv mini2440 mini2440=5tb
[5] = { /* mini2440 + 3.5" TFT + touchscreen -- SONY X35 */
.width = 240,
.xres = 240,
.height = 320,
.yres = 320,
.left_margin = 1,
.right_margin = 26,
.upper_margin = 1,
.lower_margin = 5,
.hsync_len = 5,
.vsync_len = 9,
.pixclock = 170000,
.bpp = 16,
.type = (S3C2410_LCDCON1_TFT16BPP |
S3C2410_LCDCON1_TFT),
.lcdcon5 = (S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVDEN |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVCLK |
S3C2410_LCDCON5_HWSWP ),
},
setenv bootargs_init run set_bootargs_nfs
run set_root_nfs; setenv bootargs ${bootargs_base} ${bootargs_init} ${mini2440} ${root_nfs} ${ifconfig}
setenv root_nfs root=/dev/nfs rw nfsroot=${serverip}:${root_nfs}
setenv bootcmd nfs 0x32000000 ${serverip}:/nfs/uImage; bootm
setenv bootdelay 1
printenv
saveenv
MINI2440 # printenv
baudrate=115200
ethaddr=04:25:fe:ed:00:18
netmask=255.255.255.0
usbtty=cdc_acm
root_nand=root=/dev/mtdblock3 rootfstype=jffs2
root_mmc=root=/dev/mmcblk0p2 rootdelay=2
set_root_nfs=setenv root_nfs root=/dev/nfs rw nfsroot=${serverip}:${root_nfs}
ifconfig_dhcp=run setenv ifconfig ip=dhcp
set_bootargs_mmc=setenv bootargs ${bootargs_base} ${bootargs_init} ${mini2440} ${root_mmc}
set_bootargs_nand=setenv bootargs ${bootargs_base} ${bootargs_init} ${mini2440} ${root_nand}
set_bootargs_nfs=run set_root_nfs; setenv bootargs ${bootargs_base} ${bootargs_init} ${mini2440} ${root_nfs} ${ifconfig}
mtdids=nand0=mini2440-nand
mtdparts=mtdparts=mini2440-nand:0x00040000(u-boot),0x00020000(u-boot_env),0x00500000(kernel),0x0faa0000(rootfs)
ipaddr=192.168.1.2
serverip=192.168.1.1
gatewayip=192.168.1.1
bootcmd=nfs 0x32000000 192.168.1.1:/nfs/uImage; bootm
bootdelay=1
mini2440=mini2440=5tb
ifconfig_static=setenv ifconfig ip=192.168.1.2:192.168.1.1::255.255.255.0:mini2440:eth0
ifconfig=ip=192.168.1.2:192.168.1.1::255.255.255.0:mini2440:eth0
bootargs_base=console=ttySAC0,115200 noinitrd consoleblank=0
root_nfs=root=/dev/nfs rw nfsroot=192.168.1.1:root=/dev/nfs rw nfsroot=192.168.1.1:/nfs/rootfs
bootargs=console=ttySAC0,115200 noinitrd consoleblank=0 mini2440=5tb root=/dev/nfs rw nfsroot=192.168.1.1:root=/dev/nfs rw nfsroot=192.168.1.1:/nfs/rootfs ip=192.168.1.2:192.168.1.1::255.255.255.0:mini2440:eth0
partition=nand0,0
mtddevnum=0
mtddevname=u-boot
Environment size: 1449/131068 bytes
apt-get install ia32-libs uboot-mkimage patch
wget http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 tar xjvfo arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 -C /usr/local export PATH=$PATH:/usr/local/arm-2008q3/bin export CROSS_COMPILE=arm-none-linux-gnueabi-
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.1.tar.bz2 tar xfvj linux-2.6.39.1.tar.bz2
CROSS_COMPILE=/usr/local/arm-2008q3/bin/arm-none-linux-gnueabi- ARCH=arm make mini2440_defconfig
wget http://www.friendlyarm.net/forum/attachment/11933 tar xzf 11933
patch -p1 < 0001-s3c2440-mini2440-Add-support-for-new-LCD-panels.patch patch -p1 < 0002-s3c2440-mini2440-Add-touchscreen-support-for-mini244.patch patch -p1 < 0003-s3c2440-mini2440-Select-touchscreen-by-default.patch patch -p1 < 0004-s3c2440-mini2440-Enable-the-backlight-LED-earlier-at.patch
Networking support --> Networking options -->
[X] IP: kernel level autoconfiguration
File systems --> Network File Systems -->
[X] NFS client support (v3)
[X] Root file system on NFS
vim fs/nfs/nfsroot.c
/* Default NFSROOT mount options. */ #define NFS_DEF_OPTIONS "udp"
/* Default NFSROOT mount options. */ #define NFS_DEF_OPTIONS "vers=2,udp,rsize=4096,wsize=4096"
Device Drivers -->
[X] I2C support -->
[X] Enable compatibility bits for old user-space
[X] I2C device interface
[X] I2C bus multiplexing support
[X] Autoselect pertinent helper modules
[X] I2C Hardware Bus support -->
[X] S3C2410 I2C Driver
[X] Simtec Generic I2C interface
[X] GPIO support -->
[X] /sys/class/gpio/... sysfs interface
[X] SPI support
[X] Samsung S4C24XX series SPI
[X] MMC/SD/SDIO card support
[X] Real Time Clock
[X] LED support
[X] LED Support for Samsung S3C24XX GPIO LEDs
[X] LED Support for GPIO connected LEDs
[X] LED backlight trigger
... einige mehr
Input device support -->
[X] Touchscreen
...
Device Drivers -->
[X] Sound card support -->
[X] Preclaim OSS device numbers
[X] Advanced Linux Sound Architecture -->
[X] OSS Mixer API
[X] OSS PCM (digital audio) API
[X] OSS PCM (digital audio) API - Include plugin system
[X] Support for old ALSA API
[X] Verbose procfs contents
[X] Debug
[X] ALSA for SoC audio support -->
[X] ASoC support for Samsung
[X] SoC I2S Audio support UDA134X wired to a S3C24XX
CROSS_COMPILE=/usr/local/arm-2008q3/bin/arm-none-linux-gnueabi- ARCH=arm make menuconfig
CROSS_COMPILE=/usr/local/arm-2008q3/bin/arm-none-linux-gnueabi- ARCH=arm make -j4 all CROSS_COMPILE=/usr/local/arm-2008q3/bin/arm-none-linux-gnueabi- ARCH=arm make uImage
U-Boot 1.3.2-mini2440 (May 10 2011 - 17:55:30)
I2C: ready
DRAM: 64 MB
NOR Flash not found. Use hardware switch and 'flinit'
Flash: 0 kB
NAND: 256 MiB
Found Environment offset in OOB..
USB: S3C2410 USB Deviced
In: serial
Out: serial
Err: serial
MAC: 04:25:fe:ed:00:18
Hit any key to stop autoboot: 0
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 04:25:fe:ed:00:18
File transfer via NFS from server 192.168.1.1; our IP address is 192.168.1.2
Filename '/nfs/uImage'.
Load address: 0x32000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
##############################*** ERROR: Cannot umount
## Booting kernel from Legacy Image at 32000000 ...
Image Name: Linux-2.6.39
Created: 2011-06-02 16:16:15 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2145800 Bytes = 2 MB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Linux version 2.6.39 (root@workstation) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #1 Thu Jun 2 18:15:54 CEST 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: MINI2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: console=ttySAC0,115200 noinitrd consoleblank=0 mini2440=5tb root=/dev/nfs rw nfsroot=192.168.1.1:root=/dev/nfs rw nfsroot=192.168.1.1:/nfs/rootfs ip=192.168.1.2:192.168.1.1::255.255.255.0:mini2440:eth0
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60476k/60476k available, 5060k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
vmalloc : 0xc4800000 - 0xf6000000 ( 792 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.init : 0xc0008000 - 0xc0029000 ( 132 kB)
.text : 0xc0029000 - 0xc03f8f8c (3904 kB)
.data : 0xc03fa000 - 0xc041e6c0 ( 146 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:85
irq: clearing pending status 02000000
irq: clearing subpending status 00000002
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop... 201.52 BogoMIPS (lpj=503808)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
gpiochip_add: gpios 288..303 (GPIOK) failed to register
gpiochip_add: gpios 320..334 (GPIOL) failed to register
gpiochip_add: gpios 352..353 (GPIOM) failed to register
NET: Registered protocol family 16
MINI2440: Option string mini2440=5tb
MINI2440: LCD 0:240x320 1:800x480 2:1024x768 3:240x320 4:640x480 [5:240x320]
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C244X: Clock Support, DVS off
s3c-adc s3c24xx-adc: attached adc driver
bio: create slab <bio-0> at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
Advanced Linux Sound Architecture Driver Version 1.0.24.
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 118
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 60x53
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
at24 0-0050: 1024 byte 24c08 EEPROM, writable, 16 bytes/write
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Creating 4 MTD partitions on "nand":
0x000000000000-0x000000040000 : "u-boot"
uncorrectable error :
0x000000040000-0x000000060000 : "u-boot-env"
ftl_cs: FTL header not found.
0x000000060000-0x000000560000 : "kernel"
ftl_cs: FTL header not found.
0x000000560000-0x000010000000 : "root"
ftl_cs: FTL header not found.
dm9000 Ethernet Driver, V1.31
dm9000 dm9000: eth0: Features changed: 0x00004800 -> 0x00004000
eth0: dm9000e at c486a300,c486e304 IRQ 51 MAC: 04:25:fe:ed:00:18 (chip)
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver libusual
s3c2440-usbgadget s3c2440-usbgadget: S3C2440: increasing FIFO to 128 bytes
mousedev: PS/2 mouse device common for all mice
input: gpio-keys as /devices/platform/gpio-keys/input/input0
samsung-ts s3c2440-ts: driver attached, registering input device
input: S3C24XX TouchScreen as /devices/virtual/input/input1
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
cpuidle: using governor ladder
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
s3c-sdi s3c2440-sdi: powered down.
s3c-sdi s3c2440-sdi: mmc0 - using pio, sw SDIO IRQ
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
ALSA device list:
No soundcards found.
TCP cubic registered
NET: Registered protocol family 17
Registering the dns_resolver key type
s3c-rtc s3c2410-rtc: setting system clock to 2000-01-15 17:15:54 UTC (947956554)
dm9000 dm9000: eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
IP-Config: Complete:
device=eth0, addr=192.168.1.2, mask=255.255.255.0, gw=255.255.255.255,
host=mini2440, domain=, nis-domain=(none),
bootserver=192.168.1.1, rootserver=192.168.1.1, rootpath=
VFS: Mounted root (nfs filesystem) on device 0:14.
Freeing init memory: 132K
Initializing random number generator... done.
Starting network...
ip: RTNETLINK answers: File exists
Welcome to Buildroot
buildroot login:
i2c /dev entries driver lm75 0-0048: hwmon0: sensor 'lm75'
# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: UU UU UU UU -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
# ls -al /sys/devices/platform/s3c2440-i2c/i2c-0/0-0048/ total 0 drwxr-xr-x 4 root root 0 Jun 10 01:01 . drwxr-xr-x 9 root root 0 Jun 10 01:01 .. lrwxrwxrwx 1 root root 0 Jun 10 01:05 driver -> ../../../../../bus/i2c/drivers/lm75 drwxr-xr-x 3 root root 0 Jun 10 01:01 hwmon -r--r--r-- 1 root root 4096 Jun 10 01:05 modalias -r--r--r-- 1 root root 4096 Jun 10 01:01 name drwxr-xr-x 2 root root 0 Jun 10 01:05 power lrwxrwxrwx 1 root root 0 Jun 10 01:01 subsystem -> ../../../../../bus/i2c -r--r--r-- 1 root root 4096 Jun 10 01:01 temp1_input -rw-r--r-- 1 root root 4096 Jun 10 01:01 temp1_max -rw-r--r-- 1 root root 4096 Jun 10 01:01 temp1_max_hyst -rw-r--r-- 1 root root 4096 Jun 10 01:05 uevent
# cat /sys/devices/platform/s3c2440-i2c/i2c-0/0-0048/temp1_input 23000
# sensors lm75-i2c-0-48 Adapter: s3c2410-i2c temp1: +22.5 C (high = +80.0 C, hyst = +75.0 C)
# ls -al /sys/class/gpio/ total 0 drwxr-xr-x 2 root root 0 Jun 10 01:46 . drwxr-xr-x 29 root root 0 Jun 10 2011 .. --w------- 1 root root 4096 Jun 10 01:46 export lrwxrwxrwx 1 root root 0 Jun 10 01:46 gpiochip0 -> ../../devices/virtual/gpio/gpiochip0 lrwxrwxrwx 1 root root 0 Jun 10 01:46 gpiochip128 -> ../../devices/virtual/gpio/gpiochip128 lrwxrwxrwx 1 root root 0 Jun 10 01:46 gpiochip160 -> ../../devices/virtual/gpio/gpiochip160 lrwxrwxrwx 1 root root 0 Jun 10 01:46 gpiochip192 -> ../../devices/virtual/gpio/gpiochip192 lrwxrwxrwx 1 root root 0 Jun 10 01:46 gpiochip224 -> ../../devices/virtual/gpio/gpiochip224 lrwxrwxrwx 1 root root 0 Jun 10 01:46 gpiochip256 -> ../../devices/virtual/gpio/gpiochip256 lrwxrwxrwx 1 root root 0 Jun 10 01:46 gpiochip32 -> ../../devices/virtual/gpio/gpiochip32 lrwxrwxrwx 1 root root 0 Jun 10 01:46 gpiochip64 -> ../../devices/virtual/gpio/gpiochip64 lrwxrwxrwx 1 root root 0 Jun 10 01:46 gpiochip96 -> ../../devices/virtual/gpio/gpiochip96 --w------- 1 root root 4096 Jun 10 01:46 unexport
# ls -al /sys/class/gpio/gpiochip160/ total 0 drwxr-xr-x 3 root root 0 Jun 10 01:46 . drwxr-xr-x 11 root root 0 Jun 10 01:46 .. -r--r--r-- 1 root root 4096 Jun 10 01:48 base -r--r--r-- 1 root root 4096 Jun 10 01:48 label -r--r--r-- 1 root root 4096 Jun 10 01:48 ngpio drwxr-xr-x 2 root root 0 Jun 10 01:48 power lrwxrwxrwx 1 root root 0 Jun 10 01:48 subsystem -> ../../../../class/gpio -rw-r--r-- 1 root root 4096 Jun 10 01:48 uevent # cat label GPIOF
# echo 160 > export # cd gpio160/ # ls -al total 0 drwxr-xr-x 3 root root 0 Jun 10 01:50 . drwxr-xr-x 12 root root 0 Jun 10 01:46 .. -rw-r--r-- 1 root root 4096 Jun 10 01:50 active_low -rw-r--r-- 1 root root 4096 Jun 10 01:50 direction -rw-r--r-- 1 root root 4096 Jun 10 01:50 edge drwxr-xr-x 2 root root 0 Jun 10 01:50 power lrwxrwxrwx 1 root root 0 Jun 10 01:50 subsystem -> ../../../../class/gpio -rw-r--r-- 1 root root 4096 Jun 10 01:50 uevent -rw-r--r-- 1 root root 4096 Jun 10 01:50 value
# cat direction in # echo out > direction # cat direction out
# cat value 0 # echo 1 > value # cat value 1
#!/bin/bash
# LED GPIO Ports
LEDR=160
LEDY=161
LEDG=162
# Path to GPIO ports
GPIOPATH=/sys/class/gpio
# Amount of times to test traffic lights
AMOUNT=3
# Function to write on LED
led()
{
echo $2 > $GPIOPATH/gpio$1/value
}
# Check if gpio folder exists for each LED
if [ ! -d $GPIOPATH/gpio$LEDR/ ]; then
echo $LEDR > $GPIOPATH/export
echo "out" > $GPIOPATH/gpio$LEDR/direction
fi
if [ ! -d $GPIOPATH/gpio$LEDY/ ]; then
echo $LEDY > $GPIOPATH/export
echo "out" > $GPIOPATH/gpio$LEDY/direction
fi
if [ ! -d $GPIOPATH/gpio$LEDG/ ]; then
echo $LEDG > $GPIOPATH/export
echo "out" > $GPIOPATH/gpio$LEDG/direction
fi
# Start traffic light
while [ $AMOUNT -gt 0 ]; do
# do the show
led $LEDR 1
sleep 1
led $LEDY 1
sleep 1
led $LEDG 1
sleep 2
led $LEDG 0
sleep 1
led $LEDY 0
sleep 1
#decrement counter
let AMOUNT=AMOUNT-1
done
led $LEDR 0
echo 32 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio32/direction echo 1 > /sys/class/gpio/gpio32/value
# fbv /var/www/rrd/temp_lcd.png fbv - The Framebuffer Viewer /var/www/rrd/temp_lcd.png 240 x 321
echo "Hallo World" > /dev/tty1
* BusyBox Version (BusyBox 1.18.x) * Show packages that are also provided by busybox
* rrdtool * directfb * fbdump * fbgrab * fbset * fbv * imagemagick
* e2fsprogs * i2c-tools * input-tools * lm-sensors * mtd/jffs2 tools * setserial
* microperl
* dropbear * lighttpd * netsnmp * ntp * wget
* screen
* htop * syslogd
* nano * less
mknod -m 0660 /dev/adc c 10 59 mknod -m 0660 /dev/audio c 14 4 mknod -m 0660 /dev/backlight c 10 63 mknod -m 0660 /dev/buttons c 10 61 mknod -m 0660 /dev/camera c 10 58 mknod -m 0660 /dev/controlC0 c 116 0 mknod -m 0660 /dev/cpu_dma_latency c 10 57 mknod -m 0660 /dev/device c 90 8 mknod -m 0660 /dev/dsp c 14 3 mknod -m 0660 /dev/full c 1 7 mknod -m 0660 /dev/leds c 10 62 mknod -m 0660 /dev/mixer c 14 0 mknod -m 0660 /dev/pwm c 10 60 mknod -m 0660 /dev/timer c 116 33 mknod -m 0660 /dev/watchdog c 10 130
mkdir /dev/misc mknod /dev/misc/rtc c 254 0
hwclock -r
hwclock -w
GMT-1CET
NTPSERVERS="192.168.1.1"
Getting initial time via ntp. Starting network time protocol daemon: ntpd.
export TSLIB_TSDEVICE=/dev/input/event1
ts_calibrate ts_test
# cat /dev/input/event1 | hexdump 0000000 6cd6 4df7 e31f 0006 0003 0000 01fa 0000 0000010 6cd6 4df7 e33f 0006 0003 0001 01c6 0000 0000020 6cd6 4df7 e345 0006 0001 014a 0001 0000 0000030 6cd6 4df7 e34a 0006 0000 0000 0000 0000 0000040 6cd6 4df7 f6ec 0006 0003 0000 01ff 0000 ...
# microperl -v This is perl, v5.8.8 built for unknown
cp /elinux/buildroot/output/build/perl-5.8.8/lib/*.pm /nfs/rootfs/usr/lib/perl5/5.8.8 cp /elinux/buildroot/output/build/perl-5.8.8/lib/Config_heavy.pl /nfs/rootfs/usr/lib/perl5/5.8.8
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=linux, osvers=2.6.32-32-generic, archname=i686-linux
uname='linux buildroot 2.6.32-32-generic #62-ubuntu smp wed apr 20 21:54:21 utc 2011 i686 gnulinux '
Characteristics of this binary (from libperl):
Compile-time options: PERL_USE_SAFE_PUTENV
Built under unknown
Compiled at Jun 3 2011 15:35:02
@INC:
/usr/lib/perl5/5.8.8
mkdir /etc/lighttpd mkdir /var/www addgroup -S www-data
# Verzeichnisse
server.document-root = "/var/www/"
server.errorlog = "/var/log/lighttpd.error.log"
server.pid-file = "/var/run/lighttpd.pid"
# Einstellungen
server.port = 80
server.username = "www-data"
server.groupname = "www-data"
# Dateitypen
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png"
)
static-file.exclude-extensions = ( ".fcgi", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )
# CGI/PERL/BASH Ausführung
server.modules += ( "mod_cgi" )
cgi.assign = ( ".sh" => "/bin/sh",
".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl" )
# Directory Listing
dir-listing.encoding = "utf-8"
server.dir-listing = "enable"
#! /bin/sh
# Lighttpd Startup Script by Morschi
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="lighttpd HTTP daemon"
NAME=lighttpd
CONFIG=/etc/lighttpd/lighttpd.conf
DAEMON=/usr/sbin/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
case "$1" in
start)
echo -n "Starting $DESC: OK"
start-stop-daemon -S -q -x $DAEMON -- -f $CONFIG
echo "."
chmod 777 /sys/class/leds/led2/brightness
;;
stop) echo -n "Stopping $DESC: OK"
start-stop-daemon -K -q -n $NAME
echo "."
;;
reload|force-reload) echo -n "Reloading $DESC configuration..."
start-stop-daemon -K -q -n $NAME -s 1
echo "done."
;;
restart) echo "Restarting $DESC: OK"
$0 stop
sleep 1
$0 start
;;
*) echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0
<html><head></head><body>Example Document powered by Morschi <form action="cgi-bin/toggle_led2.cgi" method="post"> <input type="submit" name="sub" value="Toggle LED2"> </form></body></html>
#!/bin/sh echo $2 > /sys/class/leds/led$1/brightness
#!/usr/bin/perl -w
use strict;
use warnings;
my $URL = "../index.html";
my $status = `cat /sys/class/leds/led2/brightness`;
if($status == 0){
system("/var/www/cgi-bin/led.sh 2 1");
}else{
system("/var/www/cgi-bin/led.sh 2 0");
}
print "Location: $URL\n\n
rrdtool create temp.rrd --step 3 \ DS:data:GAUGE:12:U:U \ RRA:AVERAGE:0.5:20:1440 \ RRA:AVERAGE:0.5:200:4320 \ RRA:MAX:0.5:20:1440 \ RRA:MAX:0.5:200:4320 \ RRA:MIN:0.5:20:1440 \ RRA:MIN:0.5:200:4320 \
# ls -al total 1076 -rw-r--r-- 1 www-data root 1074072 Jun 6 00:46 temp.rrd
rrdtool update temp.rrd N:23
rrdtool graph temp.png -t "Average Temperature over 1h" -s -1h --width 239 --height 175 DEF:avg=temp.rrd:temperature:AVERAGE LINE2:avg#ff0000
# rrdtool graph temp.png -t "Temperature over last 24h" --height 220 --start -24h --end now \ DEF:avg=temp.rrd:temperature:AVERAGE \ DEF:max=temp.rrd:temperature:MAX \ DEF:min=temp.rrd:temperature:MIN \ LINE2:avg#0000FF:"Average" \ LINE2:max#FF0000:"Max" \ LINE2:min#00FF00:"Min" # 481x299
rrdtool dump temp.rrd > temp.xml
rrdtool restore -f -r temp.xml temp.rrd
rrdtool fetch temp.rrd AVERAGE -s -1h
convert -rotate 270 temp_lcd.png temp_lcd.png
fbv temp_lcd.png
echo 0 > /sys/class/graphics/fbcon/cursor_blink
# sensors
lm75-i2c-0-48
Adapter: s3c2410-i2c
temp1: +23.0 C (high = +80.0 C, hyst = +75.0 C)
--with-mib-modules="ucd-snmp/lmsensorsMib" --with-ldflags="-lsensors"
# ldd /usr/sbin/snmpd libnetsnmpagent.so.25 => /usr/lib/libnetsnmpagent.so.25 (0x40181000) libnetsnmpmibs.so.25 => /usr/lib/libnetsnmpmibs.so.25 (0x40103000) libnetsnmp.so.25 => /usr/lib/libnetsnmp.so.25 (0x401af000) libdl.so.0 => /lib/libdl.so.0 (0x400ef000) libsensors.so.4 => /usr/lib/libsensors.so.4 (0x4013b000) libc.so.0 => /lib/libc.so.0 (0x4022b000) libm.so.0 => /lib/libm.so.0 (0x40150000) ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x40071000)
# snmpd Config File syslocation home syscontact "Michael Morscher, morscher@hs-augsburg.de" sysdescr "mini2440 Wetterstation 1" sysservices 12 # Access policy rocommunity public
snmpwalk -v1 -c public 192.168.1.2
SNMPv2-MIB::sysDescr.0 = STRING: "mini2440 Wetterstation 1" SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.8072.3.2.10 SNMPv2-MIB::sysUpTime.0 = Timeticks: (61681) 0:10:16.81 SNMPv2-MIB::sysContact.0 = STRING: "Michael Morscher, morscher@hs-augsburg.de" SNMPv2-MIB::sysName.0 = STRING: deathstar SNMPv2-MIB::sysLocation.0 = STRING: home
IF-MIB::ifNumber.0 = INTEGER: 2 IF-MIB::ifIndex.1 = INTEGER: 1 IF-MIB::ifIndex.2 = INTEGER: 2 IF-MIB::ifDescr.1 = STRING: lo IF-MIB::ifDescr.2 = STRING: eth0 IF-MIB::ifType.1 = INTEGER: softwareLoopback(24) IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6) IF-MIB::ifMtu.1 = INTEGER: 16436 IF-MIB::ifMtu.2 = INTEGER: 1500 IF-MIB::ifSpeed.1 = Gauge32: 10000000 IF-MIB::ifSpeed.2 = Gauge32: 100000000 IF-MIB::ifPhysAddress.1 = STRING: IF-MIB::ifPhysAddress.2 = STRING: 4:25:fe:ed:0:18 IF-MIB::ifAdminStatus.1 = INTEGER: up(1) IF-MIB::ifAdminStatus.2 = INTEGER: up(1) IF-MIB::ifOperStatus.1 = INTEGER: up(1) IF-MIB::ifOperStatus.2 = INTEGER: up(1) IF-MIB::ifLastChange.1 = Timeticks: (0) 0:00:00.00 IF-MIB::ifLastChange.2 = Timeticks: (0) 0:00:00.00 IF-MIB::ifInOctets.1 = Counter32: 40527 IF-MIB::ifInOctets.2 = Counter32: 8100788
HOST-RESOURCES-MIB::hrSWRunIndex.776 = INTEGER: 776 HOST-RESOURCES-MIB::hrSWRunIndex.779 = INTEGER: 779 HOST-RESOURCES-MIB::hrSWRunIndex.783 = INTEGER: 783 HOST-RESOURCES-MIB::hrSWRunIndex.787 = INTEGER: 787 HOST-RESOURCES-MIB::hrSWRunIndex.788 = INTEGER: 788 HOST-RESOURCES-MIB::hrSWRunIndex.789 = INTEGER: 789 HOST-RESOURCES-MIB::hrSWRunIndex.965 = INTEGER: 965 HOST-RESOURCES-MIB::hrSWRunPath.776 = STRING: "/usr/sbin/ntpd" HOST-RESOURCES-MIB::hrSWRunPath.779 = STRING: "/usr/sbin/dropbear" HOST-RESOURCES-MIB::hrSWRunPath.783 = STRING: "/usr/sbin/lighttpd" HOST-RESOURCES-MIB::hrSWRunPath.787 = STRING: "-sh" HOST-RESOURCES-MIB::hrSWRunPath.788 = STRING: "/sbin/syslogd" HOST-RESOURCES-MIB::hrSWRunPath.789 = STRING: "/sbin/klogd" HOST-RESOURCES-MIB::hrSWRunPath.965 = STRING: "/usr/sbin/snmpd" HOST-RESOURCES-MIB::hrSWRunParameters.783 = STRING: "-f /etc/lighttpd/lighttpd.conf" HOST-RESOURCES-MIB::hrSWRunParameters.788 = STRING: "-n -m 0" HOST-RESOURCES-MIB::hrSWRunParameters.789 = STRING: "-n" HOST-RESOURCES-MIB::hrSWRunParameters.790 = STRING: "-f /var/log/messages" HOST-RESOURCES-MIB::hrSWRunParameters.965 = STRING: "-Lsd -Lf /dev/null -p /var/run/snmpd.pid 127.0.0.1"
# snmpwalk -v1 -c public 192.168.1.2 lmSensors LM-SENSORS-MIB::lmTempSensorsIndex.1 = INTEGER: 1 LM-SENSORS-MIB::lmTempSensorsDevice.1 = STRING: temp1 LM-SENSORS-MIB::lmTempSensorsValue.1 = Gauge32: 23000
rm /var/spool mkdir /var/spool mkdir /var/spool/cron mkdir /var/spool/cron/crontab
# #For more information see the manual pages of crontab(5) and cron(8) # ## m h dom mon dow command */5 * * * * /var/www/cgi-bin/pic_reload.cgi
#! /bin/sh
# Crond Startup Script by Morschi
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="cronjob daemon"
LOGFILE=/var/log/crond.log
NAME=crond
DAEMON=/usr/sbin/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
case "$1" in
start)
echo -n "Starting $DESC: OK"
start-stop-daemon -S -q -x $DAEMON -- -L $LOGFILE
echo "."
;;
stop) echo -n "Stopping $DESC: OK"
start-stop-daemon -K -q -n $NAME
echo "."
;;
reload|force-reload) echo -n "Reloading $DESC configuration..."
start-stop-daemon -K -q -n $NAME -s 1
echo "done."
;;
restart) echo "Restarting $DESC: OK"
$0 stop
sleep 1
$0 start
;;
*) echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <syslog.h>
#include <string.h>
#include <assert.h>
#include <signal.h>
// allgemein
#define DAEMON_NAME "tempd"
#define LOG_PATH "/var/log/tempd.log"
#define PID_FILE "/var/run/tempd.pid"
#define QUERY_TIME 3
// spezifisch
#define SENSOR_PATH "/sys/devices/platform/s3c2440-i2c/i2c-0/0-0048/temp1_input"
#define RRD_PATH "/usr/bin/rrdtool"
#define RRD_FILE "/var/www/rrd/temp.rrd"
#define RRD_TIME_1 "1h"
#define RRD_TIME_2 "1d"
#define RRD_TIME_3 "30d"
int main(void) {
float temperature;
char command[512];
char buffer[6];
int counter;
// Prozess ID
pid_t pid, sid; // Prozess und Session ID
pid = fork(); // Forken des Parent Prozesses
if (pid < 0) { exit(EXIT_FAILURE); } // Fehler bei merkwürdiger Process ID
if (pid > 0) { exit(EXIT_SUCCESS); } // Kill Vater Prozess
umask(0); // Change file mode mask
// Setup syslog logging - see SETLOGMASK(3)
#if defined(DEBUG)
setlogmask(LOG_UPTO(LOG_DEBUG));
openlog(DAEMON_NAME, LOG_CONS | LOG_NDELAY | LOG_PERROR | LOG_PID, LOG_USER);
#else
setlogmask(LOG_UPTO(LOG_INFO));
openlog(DAEMON_NAME, LOG_CONS, LOG_USER);
#endif
// Session ID
sid = setsid(); // Session ID für Kind Prozess erzeugen
pid = getpid();
if (sid < 0) { exit(EXIT_FAILURE); } // Session ID Checken
if ((chdir("/")) < 0) { exit(EXIT_FAILURE); } // Wechsel PATH
/* Close out the standard file descriptors */
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
// Correct PID file creates by start-stop daemon
syslog(LOG_INFO, "starting the daemonizing process with pid %i", pid);
FILE *datei;
datei = fopen(PID_FILE, "w");
fprintf(datei, "%i", pid);
fclose(datei);
counter = 0;
// Real Work forever
while (1) {
// Get Temperature
FILE *datei;
datei = fopen(SENSOR_PATH, "r");
fgets(buffer, 6, datei);
temperature = atof(buffer);
temperature = temperature / 1000;
fclose(datei);
// Prepare RRD update and do it
sprintf(command, "%s update %s N:%.1f", RRD_PATH, RRD_FILE, temperature);
system(command);
if(counter == 20){
// File 1
sprintf(command, "%s graph /var/www/rrd/temp_%s.png -t \"Average Temperature over last %s\" -s -%s --height 220 DEF:avg=%s:temperature:AVERAGE LINE2:avg#FF0000", RRD_PATH, RRD_TIME_1, RRD_TIME_1,RRD_TIME_1, RRD_FILE);
system(command);
// File 2
sprintf(command, "%s graph /var/www/rrd/temp_%s.png -t \"Average Temperature over last %s\" -s -%s --height 220 DEF:avg=%s:temperature:AVERAGE LINE:avg#FF0000 AREA:avg#FF0000", RRD_PATH, RRD_TIME_2, RRD_TIME_2, RRD_TIME_2, RRD_FILE);
system(command);
// File 3
sprintf(command, "%s graph /var/www/rrd/temp_%s.png -t \"Average Temperature over last %s\" -s -%s --height 206 DEF:avg=%s:temperature:AVERAGE DEF:max=%s:temperature:MAX DEF:min=%s:temperature:MIN LINE2:avg#0000FF:\"Average\" LINE2:max#FF0000:\"Maximum\" LINE2:min#00FF00:\"Minimum\"", RRD_PATH, RRD_TIME_3, RRD_TIME_3, RRD_TIME_3, RRD_FILE, RRD_FILE, RRD_FILE);
system(command);
counter = 0;
}
// Wait
sleep(QUERY_TIME);
counter++;
}
exit(EXIT_SUCCESS);
}
<html><head></head><body> <h2>FriendlyARM mini2440 Studienarbeit by Michael Morscher</h2> <h3>Actions:</h3> <form action="cgi-bin/toggle_led2.cgi" method="post"> <input type="submit" name="sub" value="Toggle LED2"> </form> <form action="cgi-bin/pic_reload.cgi" method="post"> <input type="submit" name="sub" value="Reload graph"> </form> <h3>Graphs:</h3> <img src="rrd/temp_1h.png"><br> <img src="rrd/temp_1d.png"><br> <img src="rrd/temp_30d.png"> </body></html>
arm-linux-gcc -o tempd tempd.c
#! /bin/sh
# Crond Startup Script by Morschi
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="temperature daemon"
PIDFILE=/var/run/tempd.pid
NAME=tempd
DAEMON=/usr/sbin/$NAME
case "$1" in
start)
echo -n "Starting $DESC: OK"
start-stop-daemon -S -m -q -x $DAEMON -p $PIDFILE
echo "."
;;
stop) echo -n "Stopping $DESC: OK"
start-stop-daemon -K -q -p $PIDFILE
echo "."
;;
restart) echo "Restarting $DESC: OK"
$0 stop
sleep 1
$0 start
;;
*) echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
mkdir /path/to/buildroot/package/tempd
config BR2_PACKAGE_TEMPD bool "tempd" help tempd is a small temperature polling daemon that collects data and writes it in a RRD Database http://www.hs-augsburg.de
TEMPD_VERSION=1.0 TEMPD_SOURCE=tempd-$(TEMPD_VERSION).tar.bz2 TEMPD_SITE=httpd://www.hs-augsburg.de/~morscher/elinux/tempd TEMPD_DIR=$(BUILD_DIR)/tempd-$(TEMPD_VERSION) TEMPD_CAT:=$(BZCAT) TEMPD_BINARY:=tempd TEMPD_TARGET_BINARY:=usr/bin/$(TEMP_BINARY)
$(DL_DIR)/$(TEMPD_SOURCE):
$(WGET) -P $(DL_DIR) $(DUMMY_SITE)/$(DUMMY_SOURCE)
$(TEMPD_DIR)/.unpacked: $(DL_DIR)/$(TEMPD_SOURCE)
touch $@
$(TEMPD_DIR)/$(TEMPD_BINARY): $(TEMPD_DIR)/.configured
$(MAKE) -C $(TEMPD_DIR)
(TARGET_DIR)/$(TEMPD_TARGET_BINARY): $(TEMPD_DIR)/$(TEMPD_BINARY)
$(INSTALL) -D $(TEMPD_DIR)/$(TEMPD_BINARY) $@
$(STRIPCMD) $@
tempd-clean:
-$(MAKE) -C $(TEMPD_DIR) clean
tempd-dirclean:
rm -rf $(TEMPD_DIR)
source "package/tempd/Config.in"
#!/usr/bin/perl -w use strict; use warnings; my $URL = "../index.html"; my $WWWPATH = "/var/www"; `rrdtool graph $WWWPATH/rrd/temp.png -t Temperature -s -1h --width 240 --height 175 DEF:Var2=$WWWPATH/rrd/temp.rrd:temperature:AVERAGE LINE2:Var2#ff0000`; `convert -rotate 270 $WWWPATH/rrd/temp.png $WWWPATH/rrd/temp_lcd.png`; `fbv $WWWPATH/rrd/temp_lcd.png`; print "Location: $URL\n\n";
<img src="rrd/temp.png"> <form action="cgi-bin/pic_reload.cgi" method="post"> <input type="submit" name="sub" value="Reload graph"> </form>
#/etc/init.d/S21screenfix echo -n "Fixing screen issues..." chmod 777 /dev/fb0 echo 0 > /sys/class/graphics/fbcon/cursor_blink echo " done."
#!/bin/bash
# Fixed parameters
CURLPATH=/usr/bin/curl
GPIOPATH=/sys/class/gpio
LEDR=160
LEDY=161
LEDG=162
# Icinga Server Parameter
USER=icinga
PASSWORD=th!$i$n0t$3cUR3
IP=192.168.1.200
SCRIPTPATH=icinga/cgi-bin/status.cgi
# Functions to write on LED
led(){
echo $2 > $GPIOPATH/gpio$1/value
}
# Check if gpio folder exists for each LED
if [ ! -d $GPIOPATH/gpio$LEDR/ ]; then
echo $LEDR > $GPIOPATH/export
echo "out" > $GPIOPATH/gpio$LEDR/direction
fi
if [ ! -d $GPIOPATH/gpio$LEDY/ ]; then
echo $LEDY > $GPIOPATH/export
echo "out" > $GPIOPATH/gpio$LEDY/direction
fi
if [ ! -d $GPIOPATH/gpio$LEDG/ ]; then
echo $LEDG > $GPIOPATH/export
echo "out" > $GPIOPATH/gpio$LEDG/direction
fi
# Get actual status from nagios
HOSTS=`$CURLPATH -s -u $USER:$PASSWORD http://$IP/$SCRIPTPATH | grep hostTotalsPROBLEMS | sed 's/.*\([0-9]\{1,3\}\).*/\1/'`
SWARNING=`$CURLPATH -s -u $USER:$PASSWORD http://$IP/$SCRIPTPATH | grep serviceTotalsWARNING | sed 's/.*\([0-9]\{1,3\}\).*/\1/'`
SUNKNOWN=`$CURLPATH -s -u $USER:$PASSWORD http://$IP/$SCRIPTPATH | grep serviceTotalsUNKNOWN | sed 's/.*\([0-9]\{1,3\}\).*/\1/'`
SCRITICAL=`$CURLPATH -s -u $USER:$PASSWORD http://$IP/$SCRIPTPATH | grep serviceTotalsCRITICAL | sed 's/.*\([0-9]\{1,3\}\).*/\1/'`
# Check if variables are NULL
if [ "$HOSTS" == '' ]; then
HOSTS=0
fi
if [ "$SWARNING" == '' ]; then
SWARNING=0
fi
if [ "$SUNKNOWN" == '' ]; then
SUNKNOWN=0
fi
if [ "$SCRITICAL" == '' ]; then
SCRITICAL=0
fi
# check for errors (LED red)
if ([ $HOSTS != 0 ] || [ $SCRITICAL != 0 ]); then
led $LEDR 1
led $LEDY 0
led $LEDG 0
exit
fi
# check for warnings (LED yellow)
if ([ $SUNKNOWN != 0 ] || [ $SWARNING != 0 ]); then
led $LEDY 1
led $LEDR 0
led $LEDG 0
exit
fi
# else everything "must" be fine (LED green)
led $LEDG 1
led $LEDR 0
led $LEDY 0
VFS: Mounted root (nfs filesystem) on device 0:14. Freeing init memory: 128K Initializing random number generator... done. Fixing screen issues... done. Starting network... ip: RTNETLINK answers: File exists Getting initial time via ntp. Starting network time protocol daemon: OK. Starting dropbear sshd: OK Starting lighttpd HTTP daemon: OK. Starting cronjob daemon: OK. Starting temperature daemon: OK. Starting temp daemon: OK. Starting network management services: OK. Surrender! Resistance is futile! deathstar login:
MINI2440 # s3c24xx speed get FCLK = 405 MHz, HCLK = 101 MHz, PCLK = 50 MHz, UCLK = 48 MHz MINI2440 # s3c24xx speed set 460 FCLK = 460 MHz, HCLK = 115 MHz, PCLK = 57 MHz, UCLK = 48 MHz MINI2440 # s3c24xx speed get FCLK = 460 MHz, HCLK = 115 MHz, PCLK = 57 MHz, UCLK = 48 MHz
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177 CPU: VIVT data cache, VIVT instruction cache Machine: MINI2440 Memory policy: ECC disabled, Data cache writeback CPU S3C2440A (id 0x32440001) S3C24XX Clocks, Copyright 2004 Simtec Electronics S3C244X: core 460.800 MHz, memory 115.200 MHz, peripheral 57.600 MHz CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
deathstar login: root # cat /proc/cpuinfo Processor : ARM920T rev 0 (v4l) BogoMIPS : 229.17 Features : swp half thumb
#!/usr/bin/perl -w
########################################################################
# Created by Michael Morscher (michael.morscher@hs-augsburg.de) #
# Version 1.1 created 20.05.2011 #
########################################################################
# Automated Script for Installing Buildroot,Toolchain and Kernel #
########################################################################
# Print script usage
sub printusage {
print "FriendlyARM Mini2440 Help Script\n";
print "################################\n";
print "Available parameters:\n";
print " - install-buildroot\n";
print " - install-toolchain\n";
print " - install-kernel\n";
print "################################\n";
}
./scripts/magic.pl