Nobiscuit
Above average nerdiness
Kernel patch to support LEDs, buttons and sensors on the ix2-200
February 15, 2012
Posted by on This is a kernel patch based on the kernel sources release by Iomega for the iConnect and some guess work as to the GPIO pins to use. It has the following features:
- control of LEDs via leds-gpio
# echo 1 > /sys/class/leds/backup_led/brightness
- i2c sensors support
# sensors lm63-i2c-0-4c Adapter: mv64xxx_i2c adapter fan1: 0 RPM (min = 0 RPM) temp1: +57.0°C (high = +70.0°C) temp2: +56.2°C (low = +0.0°C, high = +70.0°C) (crit = +85.0°C, hyst = +75.0°C)
- buttons support
- removing redundant device configuration etc.
One note about the LEDs is that the leds-gpio driver lacks the support to switch them to their full brightness, so they will be a bit dimmer than you might be used to. This can be addressed by twiddling the appropriate GPIO directly, which is documented in the patch.
Update: Alan pointed out that my old patch didn’t apply cleaning on 3.3 or above. I’ve changed my patch to only update the setup file. I’ve also extracted the patch from 3.3 that fixed the GPIO config problem, which you will need if you’re using version 3.2 or older. I’ve put them on google drive, so hopefully they’ll stay available.
Setup file Patch
mpp.h patch
Kernel 3.4.4 Config
Kernel 3.0.18 Config
Setup file Patch
mpp.h patch
Kernel 3.4.4 Config
Kernel 3.0.18 Config
just tried your patch on a 3.2 kernel and the 3.0.18 kernel u mentioned in your post i can control the led’s but the command sensors u typed doesn’t work and pushing the buttons does nothing and i cant find any files for the buttons like the led’s to tell them what to do. do i need to write the kernel to flash or is there something else i’m missing to be able to use the buttons and sensors? im using kernel source from kernel.org not the debian source incase thats my mistake.
To get sensors to work you need the lm-sensors package (apt-get install lm-sensors). For the buttons, you need to decide what you want them to do and then you configure or write an application to do it. I haven’t done this last part yet, but I’ll give it a shot since I did say that it worked 🙂
If it’s the kernel you’re going to keep booting then I’d put it in flash and if you need to reinstall, just boot of a USB stick again.
I’ve written a quick script based on http://beagleboard.blogspot.com.au/2011/02/using-perl-to-read-linux-events.html . You need to run it as root, or a user that has permissions to read from /dev/input/event0 and you can change the printf’s to do whatever you want to happen when you press the button.
#!/usr/bin/perl
open(FILE, “/dev/input/event0”);
binmode(FILE);
while(1)
{
read(FILE, $buf, 16);
($time1, $time2, $type, $code, $value) = unpack(“iissi”, $buf);
printf(“%f %05d %05d 0x%08x\n”, $time1+$time2/1000000, $type, $code, $value);
if($code == 1 && $value == 1) # Power button pressed
{
printf(“Power button pressed\n”);
}
if ($code == 2 && $value == 1)
{
printf(“OTP button pressed\n”);
}
}
sorry for another post but i forgot to ask is there any advantage to haveing the newer kernel in the flash? and how does it affect say reintsalling the debian os?
cool gona try that as soon as i can.
so i just remove the lines:
printf(“%f %05d %05d 0x%08x\n”, $time1+$time2/1000000, $type, $code, $value);
printf(“Power button pressed\n”);
printf(“OTP button pressed\n”);
and replace with the command or script i want to be ran?
and do you think it would be possible to ever get the functionality similar to the origional buttons where power button actually turns the nas off and on?
as for the quick transfer button hmmm whatever cud that be used for lol.
and of course i forgot sumthing again do i need to run that script at boot? or do i need to put it somewhere so that its run whenever i press a button?
You need to change the script to do what you want e.g. if you want the script to shutdown the machine when the power button is pressed and blink the backup LED when you press the OTP button, you could use the following:
#!/usr/bin/perl
open(FILE, “/dev/input/event0”);
binmode(FILE);
while(1)
{
read(FILE, $buf, 16);
($time1, $time2, $type, $code, $value) = unpack(“iissi”, $buf);
if($code == 1 && $value == 1) # Power button pressed
{
system(“shutdown -h now”);
}
elsif ($code == 2 && $value == 1)
{
open(BACKUP,”>/sys/class/leds/backup_led/brightness”);
print BACKUP “1”;
close(BACKUP);
sleep(1);
open(BACKUP,”>/sys/class/leds/backup_led/brightness”);
print BACKUP “0”;
close(BACKUP);
}
}
You could then set it to start automatically on boot by calling it from /etc/rc.local. There’s plenty of other things you could do, like make it so you have to hold the power button down to shutdown etc.
cool thanks but im guessing powering up by pressing the power button a second time wont work? at least for the moment anyway. and shud say brilliant work was tryin for ages to figure out how to port the patches and stuff but didnt realy have a clue what i was doin.
No worries!
Yeah, I’m not sure how you could do the power on thing without making changes to uboot. I did look at getting a new version of uboot installed early on, but could never compile something that worked. Might have another look at some point now I’ve learnt a bit more.
yeah i think the uboot is a modified version aswel tried to compile it myself but without a jtag i wudnt dare flash it as had my first ix2-200 die on me(which i got replaced hehe) before i put a jack plug on it for the serial connection so i didnt have to open it.to reinstall. but since the shutdown power up worked on the origional os uboot shud essentialy be already setup for it i think. shud just be a question of how do ye pass a powerup command / reboot command after debian has been shutdown / halted. i havent removed the origional kernel from flash yet cud there be sumthing in it that cud help?
Any news on this?? with the original kernel it boots ok, but it is imposible to boot up the unit without unplug and plug the power cord again…
Does this only work with Ubuntu? I installed Debian and there seems not to be anything else than mice in /dev/input?
Is this on an ix2-200? Ubuntu doesn’t support ARMv5 CPUs. Do you see something like the following in the kernel messages?
[ 19.698837] input: gpio-keys as /devices/platform/gpio-keys/input/input0
It is ix2-200 and Debian 6.xx installed according to your instructions here:
https://blog.nobiscuit.com/2011/08/06/installing-debian-to-disk-on-an-ix2-200/
I first checked File Server option while installing and it ended with a nonworkig install. Then I installed a plain Debian first only added with ssh.
But I can’t see anything about gpio-keys anywhere.
… I suppose there is just something missing. Any extra installation packages? I did install lm-sensors, but does it need something else too?
You need to build a new kernel for yourself using this patch first. The kernel that comes with Debian doesn’t have the right configuration to support the buttons.
Patch is this lm-sensors, I suppose. Nothing else needed and building kernel does not need any extra switches used?
I’ll try it …
… did try it, without expected result. So I suppose you meant your kernel patch and config. Can you tell me how to use them?
… and here is what I get:
__ __ _ _
|_|\__,_|_| \_/ \___|_|_|
|___| |_) | (_) | (_) | |_
| \/ | __ _ _ ____ _____| | |
| |\/| |/ _` | ‘__\ \ / / _ \ | |
| | | | (_| | | \ V / __/ | |
_ _ ____ _
| | | | | __ ) ___ ___ | |_
| | | |___| _ \ / _ \ / _ \| __|
|
\___/ |____/ \___/ \___/ \__|
** MARVELL BOARD: RD-88F6281A LE
U-Boot 1.1.4 (Sep 8 2009 – 09:31:54) Marvell version: 3.4.14
Mapower version: 2.0 (32MB) (2009/09/08)
U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CEE60
Soc: 88F6281 A0 (DDR2)
CPU running @ 1000Mhz L2 running @ 333Mhz
SysClock = 333Mhz , TClock = 200Mhz
DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000 size 256MB
DRAM Total size 256MB 16bit width
Flash: 0 kB
Addresses 8M – 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M – 7M): Done
NAND:32 MB
CPU : Marvell Feroceon (Rev 1)
Streaming disabled
Write allocate disabled
Module 0 is RGMII
Module 1 is TDM
USB 0: host mode
PEX 0: interface detected no Link.
Net: egiga0, egiga1 [PRIME]
Fan lookup table initialized.
Current remote temperature: 36
Current fan speed: 0
Hit any key to stop autoboot: 3 2 1 0
NAND read: device 0 offset 0x100000, size 0x300000
3145728 bytes read: OK
NAND read: device 0 offset 0x540000, size 0x1000000
16777216 bytes read: OK
## Booting image at 00800000 …
Image Name: Linux-2.6.32-5
Created: 2012-03-21 14:32:26 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1435120 Bytes = 1.4 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum … OK
OK
## Loading Ramdisk Image at 01100000 …
Image Name: initramfs
Created: 2012-03-21 14:32:02 UTC
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 5470137 Bytes = 5.2 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum … OK
Starting kernel …
Uncompressing Linux… done, booting the kernel.
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 2.6.32-5-kirkwood (Debian 2.6.32-41) (ben@decadent.org.uk) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 Tue Jan 17 05:11:52 UTC 2012
[ 0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine: Marvell RD-88F6281 Reference Board
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
[ 0.000000] Kernel command line: console=ttyS0,115200 mtdparts=orion_nand:0x300000@0x100000(uImage),0x1000000@0x540000(uInitrd) root=/dev/sda1
[ 0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Memory: 256MB = 256MB total
[ 0.000000] Memory: 249984KB available (3516K code, 583K data, 124K init, 0K highmem)
[ 0.000000] SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] NR_IRQS:114
[ 0.000000] Console: colour dummy device 80×30
[ 0.000162] Calibrating delay loop… 992.87 BogoMIPS (lpj=4964352)
[ 0.240075] Security Framework initialized
[ 0.240098] SELinux: Disabled at boot.
[ 0.240129] Mount-cache hash table entries: 512
[ 0.240504] Initializing cgroup subsys ns
[ 0.240524] Initializing cgroup subsys cpuacct
[ 0.240536] Initializing cgroup subsys devices
[ 0.240547] Initializing cgroup subsys freezer
[ 0.240557] Initializing cgroup subsys net_cls
[ 0.240628] CPU: Testing write buffer coherency: ok
[ 0.241595] devtmpfs: initialized
[ 0.243632] regulator: core version 0.5
[ 0.243903] NET: Registered protocol family 16
[ 0.244538] Kirkwood: MV88F6281-A0, TCLK=200000000.
[ 0.244555] Feroceon L2: Enabling L2
[ 0.244594] Feroceon L2: Cache support initialised.
[ 0.245714] Kirkwood PCIe port 0:
[ 0.245722] link down, ignoring
[ 0.247006] bio: create slab at 0
[ 0.247340] vgaarb: loaded
[ 0.247885] Switching to clocksource orion_clocksource
[ 0.252508] NET: Registered protocol family 2
[ 0.252802] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.253725] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.253945] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.254059] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.254070] TCP reno registered
[ 0.254251] NET: Registered protocol family 1
[ 0.254466] Unpacking initramfs…
[ 0.679301] Freeing initrd memory: 5340K
[ 0.679434] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.679736] audit: initializing netlink socket (disabled)
[ 0.679778] type=2000 audit(0.670:1): initialized
[ 0.687579] VFS: Disk quotas dquot_6.5.2
[ 0.687894] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.688116] JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 0.688908] msgmni has been set to 499
[ 0.690963] alg: No test for stdrng (krng)
[ 0.691112] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[ 0.691128] io scheduler noop registered
[ 0.691137] io scheduler anticipatory registered
[ 0.691146] io scheduler deadline registered
[ 0.691372] io scheduler cfq registered (default)
[ 0.698616] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[ 0.699191] serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
[ 1.031446] console [ttyS0] enabled
[ 1.035613] NAND device: Manufacturer ID: 0xad, Chip ID: 0x75 (Hynix NAND 32MiB 3,3V 8-bit)
[ 1.044059] Scanning device for bad blocks
[ 1.221860] Bad eraseblock 1621 at 0x000001954000
[ 1.272241] 2 cmdlinepart partitions found on MTD device orion_nand
[ 1.278557] Creating 2 MTD partitions on “orion_nand”:
[ 1.283729] 0x000000100000-0x000000400000 : “uImage”
[ 1.289433] 0x000000540000-0x000001540000 : “uInitrd”
[ 1.295848] mice: PS/2 mouse device common for all mice
[ 1.301435] rtc-mv rtc-mv: rtc core: registered rtc-mv as rtc0
[ 1.307377] i2c /dev entries driver
[ 1.311139] cpuidle: using governor ladder
[ 1.315401] cpuidle: using governor menu
[ 1.319442] mv_xor_shared mv_xor_shared.0: Marvell shared XOR driver
[ 1.325850] mv_xor_shared mv_xor_shared.1: Marvell shared XOR driver
[ 1.367960] mv_xor mv_xor.0: Marvell XOR: ( xor cpy )
[ 1.407954] mv_xor mv_xor.1: Marvell XOR: ( xor fill cpy )
[ 1.447954] mv_xor mv_xor.2: Marvell XOR: ( xor cpy )
[ 1.487955] mv_xor mv_xor.3: Marvell XOR: ( xor fill cpy )
[ 1.494892] TCP cubic registered
[ 1.498164] NET: Registered protocol family 17
[ 1.503044] registered taskstats version 1
[ 1.508006] rtc-mv rtc-mv: setting system clock to 2012-03-21 21:16:03 UTC (1332364563)
[ 1.516110] Initalizing network drop monitor service
[ 1.521182] Freeing init memory: 124K
Loading, please wait…
[ 1.618446] udev[44]: starting version 164
[ 1.982419] SCSI subsystem initialized
[ 2.109359] usbcore: registered new interface driver usbfs
[ 2.115695] usbcore: registered new interface driver hub
[ 2.121872] usbcore: registered new device driver usb
[ 2.136448] MV-643xx 10/100/1000 ethernet driver version 1.4
[ 2.148840] mv643xx_eth smi: probed
[ 2.152591] mmc0: mvsdio driver initialized, using GPIO 28 for card detection
[ 2.254269] net eth0: port 0 with MAC address 00:xxxxxxx
[ 2.289394] net eth1: port 0 with MAC address 00:xxxxxxx
[ 2.324807] ehci_hcd: USB 2.0 ‘Enhanced’ Host Controller (EHCI) Driver
[ 2.333241] orion-ehci orion-ehci.0: Marvell Orion EHCI
[ 2.338630] orion-ehci orion-ehci.0: new USB bus registered, assigned bus number 1
[ 2.367965] orion-ehci orion-ehci.0: irq 19, io mem 0xf1050000
[ 2.387925] orion-ehci orion-ehci.0: USB 2.0 started, EHCI 1.00
[ 2.393936] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 2.400774] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.408048] usb usb1: Product: Marvell Orion EHCI
[ 2.412770] usb usb1: Manufacturer: Linux 2.6.32-5-kirkwood ehci_hcd
[ 2.419164] usb usb1: SerialNumber: orion-ehci.0
[ 2.424915] usb usb1: configuration #1 chosen from 1 choice
[ 2.430920] hub 1-0:1.0: USB hub found
[ 2.434730] hub 1-0:1.0: 1 port detected
[ 2.438966] sata_mv sata_mv.0: version 1.28
[ 2.443296] sata_mv sata_mv.0: slots 32 ports 2
[ 2.464481] scsi0 : sata_mv
[ 2.468202] scsi1 : sata_mv
[ 2.471547] ata1: SATA max UDMA/133 irq 21
[ 2.475684] ata2: SATA max UDMA/133 irq 21
[ 2.757935] usb 1-1: new high speed USB device using orion-ehci and address 2
[ 2.908258] usb 1-1: New USB device found, idVendor=058f, idProduct=6254
[ 2.914999] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.923699] usb 1-1: configuration #1 chosen from 1 choice
[ 2.935882] hub 1-1:1.0: USB hub found
[ 2.946765] hub 1-1:1.0: 4 ports detected
[ 2.987959] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
[ 3.027963] ata1.00: ATA-8: ST32000542AS, CC38, max UDMA/133
[ 3.033654] ata1.00: 3907029168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[ 3.178032] ata1.00: configured for UDMA/133
[ 3.182694] scsi 0:0:0:0: Direct-Access ATA ST32000542AS CC38 PQ: 0 ANSI: 5
[ 3.537942] ata2: SATA link down (SStatus 0 SControl F300)
[ 3.579099] sd 0:0:0:0: [sda] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)
[ 3.588090] sd 0:0:0:0: [sda] Write Protect is off
[ 3.593030] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA
[ 3.603392] sda: sda1 sda2
[ 3.655538] sd 0:0:0:0: [sda]] Attached SCSI disk
Begin: Loading essential drivers … done.
Begin: Running /scripts/init-premount … done.
Begin: Mounting root file system … Begin: Running /scripts/local-top … done.
Begin: Running /scripts/local-premount … done.
[ 4.176355] kjournald starting. Commit interval 5 seconds
[ 4.181928] EXT3-fs: mounted filesystem with ordered data mode.
Begin: Running /scripts/local-bottom … done.
done.
Begin: Running /scripts/init-bottom … done.
INIT: version 2.88 booting
Using makefile-style concurrent boot in runlevel S.
Starting the hotplug events dispatcher: udevd[ 5.344656] udev[164]: starting version 164
.
Synthesizing the initial hotplug events…done.
Waiting for /dev to be fully populated…done.
Activating swap…[ 6.487074] Adding 58606328k swap on /dev/sda2. Priority:-1 extents:1 across:58606328k
done.
Checking root file system…fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
Debian: clean, 22946/118663056 files, 9256481/473726976 blocks
done.
[ 8.063789] EXT3 FS on sda1, internal journal
Cleaning up ifupdown….
[ 8.350817] loop: module loaded
Loading kernel modules…done.
Setting up networking….
Activating lvm and md swap…done.
Checking file systems…fsck from util-linux-ng 2.17.2
done.
Mounting local filesystems…done.
Activating swapfile swap…done.
Cleaning up temporary files….
Configuring network interfaces…Setting kernel variables …done.
done.
Starting portmap daemon….
Starting NFS common utilities: statd.
Cleaning up temporary files….
Setting sensors limits.
INIT: Entering runlevel: 2
Using makefile-style concurrent boot in runlevel 2.
Starting portmap daemon…Already running..
Starting NFS common utilities: statd.
Starting enhanced syslogd: rsyslogd.
Starting deferred execution scheduler: atd.
Starting periodic command scheduler: cron.
Starting system message bus: dbus.
[ 12.036844] NET: Registered protocol family 10
[ 12.046824] ADDRCONF(NETDEV_UP): eth1: link is not ready
Starting Samba daemons: nmbd smbd.
Starting MTA:[ 12.574777] eth1: link up, 1000 Mb/s, full duplex, flow control disabled
[ 12.581871] ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
Starting OpenBSD Secure Shell server: sshd.
exim4.
Debian GNU/Linux 6.0 Iomega ttyS0
Iomega login:
Debian GNU/Linux 6.0 Iomega ttyS0
Iomega login:
So you’re definitely running a standard Debian kernel and not one with my patches applied. You need to download, patch and compile the kernel sources from kernel.org to get the features I’ve put in this post. If I get some time, I’ll do a quick blog post covering this over the weekend, but there are plenty of howtos to do this out there. The only slightly tricky bit is creating the uboot images, but you can just use the commands from the blog post on installing Debian (mkimage…)
just so you know the patch does not fully work on kernel 3.3 the mpp.h file that it modifies is slightly different in the 3.3 kernel so that part of the patch fails but i manually edited the lines and the buttons and lights are working so just fyi if u want to update the patch or your own kernel to the newest.
Thanks Alan. I’ve updated the post based on your comment.
I still do not know what’s wrong, but I can’t get it booting with newly compiled uImage and uInitrd.
How about the config file? Does it need some editing too?
Maybe you can give the edited and working mpp.h file to be used by others too. Newbies like me would like it very much.
no the config file does not need any editing as far as i know but i used the config posted above and have updated from 3.0.18 to a 3.1 then 3.2 and so on so iv been updateing my config in stages but not enableing any new options so use the config above and just keep hitting enter until all the new options are configured with defaults.
As for the mpp.h file its actualy pretty easy to modify (with the entries from the patch above) you can just gedit or nano the file then:
find the line starting with “define MPP11_PTP_CLK”
overwrite it and the lines after it they are all 1 after each other
deleting the define MPP12_GPO line as its replaced with the gpio line from the patch
then just save the file and build like normal.
i applied the patch saw the mpp.h parts were rejected and then edited it so you can do it that way aswel so the other files are patched as they need to be.
Hope this helps sum1 wud hate to of written all this for nothing lol.
Well, I’ll try it again. Do you think this:
http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html
is valid for compiling 3.x kernel too?
the instructions for building the kernel i use are here:
http://forum.doozan.com/read.php?2,6010,6010
these are for patching and building the 3.0 kernel for the goflex net but are essentialy the same for us only real differences are the source code (either debian source or kernel.org source) and the patch. if you use the latest debian source its almost just copy paste enter for each of the commands on that page just remember you dont need the archlinuxarm.patch and use the config file from here not the one in those instructions and when you do the config there will be alot more new entries depending on which kernel / source your using.
after that if you follow those instructions you should have a working 3.x kernel i am currently using the 3.3 kernel built using those instructions and i think the debian source (i forget which i used) and the patch and base config file from here. i would attach my config but dont see any options to.
oh and heres sumthing people might be interested in i did it to my ix2-200:
http://wiki.scottn.us/goflex:serialport
its basically a 2.5 mm jack plug that you use to connect to the serial console without haveing to take your nas apart incase your like me and like to reinstall alot or “EXPERIMENT” on your nas. those are for the goflex home but I have put it on a goflex net and my ix2-200 and it works perfectly.
damn its only like half my config file in that post below sorry
I might found my problem – I suppose you all more experienced users knew this all the time – it looses environment settings and will not boot unless bootargs are set again after booting even though it is saved in the nand memory.
Well .. not luck yet. There seems to be lots of different instructions, but I can’t make any them work completely to the very end.
I might found my problem – I suppose you all more experienced users knew this all the time – it looses environment settings and will not boot unless bootargs are set again after booting even though it is saved in the nand memory. This happends while tftpboot is used to load the files. I do not know yet what happends, if new kernel is loaded from the nand memory.
it shudnt loose environment settings i have mine booting the kernel from usb and everytime i update and recreate the new uimage and uinitrd with the new kernel it boots fine so unless your changeing the bootargs installing the new kernel and then haveing to change them back after you put the kernel on the nand or perhaps its somthing to do with replacing the kernel on the nand that wipes the bootargs
I suppose the bootargs are just in wrong order within nand. I suppose this can be handled.
I got working uInitrd and uImage now, but now the last one is too big to fit in.
Jessss … it’s working !! Needed just to make more space for kernel files and change environment settings to fit new file locations and sizes. Next the bash script …
ha cool do u have the os files on a usb was it and ye ran outa space? what ye planning next a bash script to compile and flash new kernel’s?
Sorry, but did you ask me? I flashed them in. uImage is a bit less than 4 MB and uInitrd less than 5 MB in size. They fit well in flash memory, but not to the original space.
Is it possible maybe that because they dont fit to the origional space that maybe thats causing your environment settings to disappear? and i was just curious about what you plan to do with the bash script you mentioned to see if it would give me an idea for sumthing else to do with my own nas.
Putting uImage and uInitrd in a different space in flash memory can’t be reason to the environment things, because the device boots OK from flash. Problem comes up only while tftpbooting from other images. I have not had enough time to see what’s going on there, but I will.
I have now problems with 3.2.x kernel. It boots up fine until it should read files from hard disk. I suppose it misses something from partition or filesystem. My root system is on ext3 partition. 3.0.8 version boots fine, but 3.2.x not.
I had that same problem with kernels i compiled aswel after enableing some extra options in the config file dont remember which ones but went back to the origional (the config here updated without enableing anything new) and the kernel booted fine. other than that are you sure you set where the root is in uboot?
hello,
Can someone post a tutorial how to compile the new 3.x kernel on ix2-200d?
I tried the http://forum.doozan.com/read.php?2,6010,6010 tutorial but I have lot of errors.
I tried the standard method (make menuconfig (load .config), make && make install) but i don’t know how to generate the uImage.
Thank you
these 2 lines:
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs -d initrd.img-2.6.32-5-kirkwood uInitrd
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-2.6.32-5 -d vmlinuz-2.6.32-5-kirkwood uImage
from the tutorial on this site are how you make the uimage and uinitrd u need to be in the /boot directory and you change the 2.6.32-5-kirkwood for whatever the newest one is that you installed.
as for that tutorial i posted the link to it and its just the bisic command’s you need to change them depending on which version of the kernel your building.
Thanks Alan.
I’ve also updated my previous post on compiling kernels for the ix2-200 to include the rest of the process that I use for compiling and installing the kernel:
https://blog.nobiscuit.com/2011/11/04/compiling-kernels-for-the-marvell-kirkwood-soc-under-ubuntu-11-10/
No Problem but i think these 2 commands to compile the kernel and the headers into .deb install files wud be easier especialy for people new to compileing and installing kernels:
Compile kernel:
make-kpkg –rootcmd fakeroot –arch armel –cross-compile arm-none-linux-gnueabi- –append-to-version=-(insert-version-here) –revision=1.1 –initrd kernel_image
Compile headers:
make-kpkg –rootcmd fakeroot –arch armel –cross-compile arm-none-linux-gnueabi- –append-to-version=-(insert-version-here) –revision=1.1 –initrd kernel_headers
then just copy them or scp them over into a directory and run:
dpkg -i *.deb
and your commands from your other post to make the uimage and uinitrd is a little less messy and easier. i think anyway.
Pingback: Compiling kernels for the Marvell Kirkwood SoC under Ubuntu 11.10 « Nobiscuit
Hello,
Sorry, I solved the problem. The idea is that you have to put the system in “–cross-compile arm-none-linux-gnueabi-“.
So, now the kernel is ok “Linux xxxx 3.3.0-custom #1 Sun Apr 1 02:54:47 PDT 2012 armv5tel GNU/Linux”.
Thank you for the patch.
One question: My system temperature is around 60 degrade C and my hdd drive is 62 C
Adapter: mv64xxx_i2c adapter
fan1: 0 RPM (min = 0 RPM)
temp1: +58.0°C (high = +70.0°C)
temp2: +57.1°C (low = +0.0°C, high = +70.0°C)
(crit = +85.0°C, hyst = +75.0°C)
hddtemp /dev/sda /dev/sdb
/dev/sda: WDC WD10EALX-759BA1: 63°C
/dev/sdb: WDC WD10EALX-759BA1: 61°C
Is this normal? I can see that the fun has 0 RPM. Is there a way to keep the fan allays on?
Thank you in advance.
there is in a way in uboot u need to change the fan start temp in the uboot settings its fantempstart i think but u just printenv and you should see it there then just setenv fantempstart at a lower temp and it will be fine i have mine set to 40 degrees and usually hovers around 43 ish while the nas is in use and when the hdd’s spindown it takes a lil while but the fan turns off and its completly silent after i dont use it for a while.
… there is also fan hysteresis in environment settings. Might be useful to try setting an other value for it too.
I have now 3.2.13 kernel working fine. What should be good practice in daemonizing button control perl script?
Although it’s fine most of the time, some days here in Melbourne can be 35+ degrees, so I have a USB fan that I’ve plugged into one of the ix2-200s that keeps things reasonably cool. That, plus adjusting the fan start temp does the trick for me.
not sure about the daemonising i just put it in the rc.local startup file and have it running in the backround with a line like this:
su -c “cd (dir where the script is) && ./scriptname&”
that does the trick for me with the buttons script
All right … here is how to run it as a daemon:
1. install: apt-get install lm-sensors libproc-pid-file-perl libproc-daemon-perl
2. edit rc.local: exec /”some_path”/button.pl
3. put next code (between ****-lines) into button.pl and make it executable:
*******************************************************************************
#!/usr/bin/perl
use strict;
use warnings;
use Proc::Daemon;
use Proc::PID::File;
MAIN:
{
# Daemonize
Proc::Daemon::Init();
open(FILE, “/dev/input/event0″);
binmode(FILE);
my($buf)=””;
my($time1)=””;
my($time2)=””;
my($type)=””;
my($code)=””;
my($value)=””;
#my($buf)=””;
while(1)
{
read(FILE, $buf, 16);
($time1, $time2, $type, $code, $value) = unpack(“iissi”, $buf);
sleep(2);
if($code == 1 && $value == 1) # Power button pressed
{
system(“shutdown -h now”);
}
elsif ($code == 2 && $value == 1)
{
open(BACKUP,”>/sys/class/leds/backup_led/brightness”);
print BACKUP “1”;
close(BACKUP);
sleep(1);
open(BACKUP,”>/sys/class/leds/backup_led/brightness”);
print BACKUP “0”;
close(BACKUP);
}
}
}
*******************************************************************************
4. reboot
Is there any way to do this right on the NAS? I don’t have an actual Linux PC around to do the compiling. I followed your previous directions on getting a plain Debian install going, that worked well but it would probably be a good idea to have a functioning fan.
There’s no way to add the necessary drivers without recompiling the kernel?
Thanks,
Todd
Well, apparently the fan still works even without the modified kernel and patch. I’ve had the thing sitting here all afternoon copying files to it and all of a sudden the fan turned on. Granted, there’s no way of monitoring temperature or RPM (or is there?), but all I was really concerned with is the unit not overheating.
Any idea why it can work without all the extra work? is U Boot turning it on at a much lower level than the OS?
I’d still be interested in your thoughts on the original question, though. It’d be nice to get the buttons to do something.
Thanks,
Todd
The fan is definitely controlled by hardware that doesn’t need the OS to do its job. My patch is really only required to actually read the temperature and fan speed. As far as temperatures go, the hard disk temperatures are probably more important and you can read these via the smartmon tools without any patches.
You can build the kernel on the system itself, it will just be very slow. You can simply follow one of the many guides available on building linux kernels (no cross compiling required), and include the step to add the patch that I made from my post on compiling kernels.
As told before, the fan is controlled by hardware. Kernel support is not needed.
However there are some settings in environment. Temperature for starting fan and hysteresis can be changed. I did change fan starting temperature to 40 degrees, because by default settings the hard disks seem to be a bit hot.
Iv created a new patch that add’s device tree support for the ix2-200 to the latest 3.6 kernel i have tested it and it wokred fine if anyone else would like to test it for me before i submit it to the linux kernel let me know. The buttons and led’s work with the patch aswel.
The only issue at the moment is that something was broken in the sata_mv (not by me or my patch) and you have to set nr-ports to 1 in the dts file and only 1 of the sata ports will work until a fix is found for the sata_mv.
A fix has been found for the sata_mv issue so now it works perfectly both sata’s work fine.
awesome, I’d like to give it a go if you still need some testing done.
yeah iv only tested it myself so far and it seems to work fine but makeing the uimgae isnt as straightforward as it is in your tutorial you have to compile the dts file append that to the zimage and then compile the uImage file but i seen a patch to make that part easier aswel. I used the board config that your patch makes as a kind of base for my new one.
Also i was going to ask if you could take a look at the config file for me as in the 3.4 kernel there were 790 or so modules and in the 3.6 version i compiled only had 710. email me if you can get my email from this post as i don’t wanna go posting it all over the net yet.
I am also just waiting for a reply from someone to see about submitting it to the mainline kernel.
Hey Alan, sorry it doesn’t show your email so you’ll need to post it or something. Mine’s on my main site: http://www.nobiscuit.com.
ok i will need to find the right version of the patch (have like 10 of them i was fiddleing with) and you will need to use at least 3.6-rc1. and i think the gpio-keys control for the buttons has been messed up in 3.6-rc2 and the linux-next’s. i was given a patch to test for a fix but the buttons still did not work after applying it.
my email is alanbutty12@gmail.com
my patch that enables the ix2-200 to work on the newer kernels is now included in the linux next branch of the kernel source if anyone wanted to try out the newest kernel.
Can you tell exactly which version it is with?
Is there some specific configuration file needed?
you need to get the latest linux next from git (the 3.7 kernel).
so basically you open a terminal and type git clone (the git address) i believe its
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
if you realy wanna try the latest you can try 3.7 rc1 it has my patch included and you should be able to just use your previous config and just update it and select the ix2-200 options when compileing
Hi Nigel/Alan, Just checking if the patch you’re talking about for 3.7rc1 includes the changes to the leds (from rd88f6291-setup.c)?.
I’m using kernel 3.8.3 (with my config from a working 3.4.4), which boots & works perfectly fine without any patches. However I can’t get any sensor info (can’t find sensor) or control my leds. (/sys/class/leds/ is empty).
Any tips?
The dts file (arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts) has all the sensors and LED info in there, but I haven’t figured out how to get a uImage that includes a dtb appended to the zImage it was built from to work. It either doesn’t boot or doesn’t detect the dtb. The version of u-boot on the ix2-200 doesn’t support specifying a dtb file seperately, so the append method seems to be the only way to use it. If I continue to have no luck I might look into upgrading u-boot to a newer version.
there is a patch here:
https://patchwork.kernel.org/patch/1133461/
that allows you to build a uimage with the dtb appeneded i think thats how i used to do it after i submitted the device tree patch for the ix2-200 to the kernel.
i think after applying the patch (i dont know if it applies ok on newer kernels) you use something like:
make uimage-dtb.iomega_ix2-200
and your uimage is created with the dtb appended and it worked for me.
Any news on the power on problem with a debian installed?
I haven’t spent any more time working on it sorry.
is it possible you have an up to date kernel config for the ix2-200 nigel as i havent used mine in ages and was hopeing to repurpose mine
Never found anything in initrd nor etc filesys. How do you change temperature target in ix200 ???