DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-01-04 21:07:15

puterboy
Member
Registered: 2008-09-18
Posts: 306

Using ffp-reloaded to run true Debian root without modding firmware

In case anybody is interested, I have succeeded in using Fonz's ffp reloaded module to boot and run a full debian root from a USB drive or from a hard drive partition. To me this has the advantage of:

- True debian root using latest & greatest kernel (versus the limitations of a Debian chroot environment on the now very old 2.6.12 kernel)
- No need to mess with firmware or risk bricking your machine
- No memory needed to hold the rootfs (as happens with a Debian chroot under the original firmware) - this means you have almost all of the 64MB minus the size of the kernel available.
- Preserves ability to launch and use the existing firmware whenever you want
- Easy ability to change kernels or play with multiple kernels

Only downside is that it takes about twice as long to boot since you need to boot the kernel twice.

Briefly the approach is as follows:
- Use cdebootstrap on an existing Debian system to build a base debian install. I run:
     cdebootstrap -aarmel  --include=locales,initramfs-tools,libuuid-perl,openssh-server lenny lenny-root ftp://ftp.debian.org/debian
     (note the additional includes are needed to install the kernel later and to add ssh)
     chroot lenny-root
     mount -t proc proc /proc
     dpkg-reconfigure locales
     dpkg-reconfigure tzdata
     dpkg -i linux-base_2.6.32-26_all.deb linux-image-2.6.32-5-orion5x_2.6.32-26_armel.deb
               (where the kernels are obtained from http://people.debian.org/~tbm/orion)

- If you want to be able to boot from a USB disk, add 'sd_mod' and 'usb_storage' to etc/initramfs-tools/modules and run 'update-initramfs -u'
- Copy over a valid .ssh to root/.ssh (so you can ssh in at least as root)
- Create an /etc/network/interfaces stanza for eth0
- IMPORTANT: add the lines: 'ifdown eth0; ifup eth0' to /etc/rc.local since it doesn't come up right the first time (or alternatively you could probably just do the full ifconfig eth0 line here)
- edit /etc/fstab as appropriate

THEN BACK On THE dns-323
Copy over the kernel (vmlinuz-2.6.32-5-orion5x)  and initrd (initrd.img-2.6.32-5-orion5x) from the debian boot directory to /ffp/boot
cd /ffp/boot
REBOOT THE KERNEL and wait about a minute:
./reload.sh -k vmlinuz-2.6.32-5-orion5x -r initrd.img-2.6.32-5-orion5x  -I root=/dev/sdc2 rootdelay=10

where sdc2 is the location of my debian lenny root.
You can modify this to boot from partition on the internal drives or to even have root be an lvm/raid device (though I still need to test that and it will likely require some changes to the initramfs)

You can make this into a script so that for example whenever your debian root is present in the usb drive, then automatically the system will reboot into debian on startup.

Note you can always chroot back into the original firmware from a running debian system if you unpack the firmware initrd in a directory and set up a few links (this is basically what one does when one uses ffp reloaded to reboot the original firmware off of a disk rather than from a ramdisk)

Note you only need a very minimal installation of Fonz's fun-plug to do this since all you are really doing is running the reload.sh script that installs the reloaded module. It is a TBD to see how few packages are needed. One could probably even re-write the script to only use the existing busybox functionality which would then only require the reloaded module itself (plus maybe the usb module if you are reloading from a usb drive)


- Install Fonz's fun-plug

Offline

 

#2 2011-01-06 12:22:15

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: Using ffp-reloaded to run true Debian root without modding firmware

This is great, been looking for it earlier, but I didnt find it. A few questions.
What hardware version of 323 do you run?
Does it support all HW, fan, Thermometer?

I am currently reloading into a fonz modified version of the dlink 1.04. It has true NFS server support. It is working well so I may not risk messing it up. Anyhow would be nice with access to a debian repo.

Offline

 

#3 2011-01-06 15:33:33

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: Using ffp-reloaded to run true Debian root without modding firmware

Well since I am using the patched 2.6.32 kernel from http://www.cyrius.com/journal/debian/or … k/dns-323, it does indeed have HW support. In particular.
fan speed can be adjusted from 0-255 manually by:
    echo N > /sys/class/hwmon/hwmon0/device/pwm1
where N=0 is off N=255 is highest
Reportedly, you can add the lm_sensors package to monitor and adjust fan speed dynamically. Though so far I just keep mine at a quiet and mellow 100.

You can see the raw temperate at: /sys/class/hwmon/hwmon1/device/temp1_input, though if you access it manually you will need to scale the units.
Or use lm_sensors to do it all automatically
The chip is an LM_75.

Offline

 

#4 2011-01-06 15:41:21

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: Using ffp-reloaded to run true Debian root without modding firmware

For 2 years, I was doing what you were doing though with a 1.05 Firmware.
I.e., reloading the firmware so that I could compile in true NFS support which I used to run BackupPC off my main Linux server.

HOWEVER, BEWARE -- NFS CONFLICTS WITH EXT3 -- specifically, when using ext3 (but NOT ext2), the NFS directory cache gets corrupted (particularly if you are accessing a lot of inodes like with 'find') so that some files and directories transiently don't show up until the cache is refreshed. This only occurs on the NFS side. I was never able to get anybody to help with fixes other than suggesting upgrading the kernel since the old 2.6.12 kernel is known to be buggy. In any case if you use ext3 you can get severe file corruption due to the wrong directory data.

So for the past 2 years I have run under ext2 - but ext2 doesn't have journalling and that is a particularly bad deficit on the dns-323 where it is often hard or impossible to shut down cleanly (particularly without console access) and where it is not easy to even run fsck to check and fix for errors (since you need to reload root and /ffp elsewhere so you can unmount the drive).

The bottom line is that I finally got around to installing a modern kernel and real (Debian) root so that I can now do things right and protect my data.

Offline

 

#5 2011-01-06 21:52:52

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: Using ffp-reloaded to run true Debian root without modding firmware

Thanx for the warning. I run ext2. I run ffp on usb so its not that hard to unmount the disks for fsck. No big deal if the usb FS gets f-edup. Anyhow it all works great and moving to debian will demand some config to get it working as is. Anyhow I will try to boot into debian and se if it is worth while. Generally I am very pleased with the dns323. I am on B as well.

Offline

 

#6 2011-01-08 01:48:59

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: Using ffp-reloaded to run true Debian root without modding firmware

I gave it a try.

When chrooting to lenny armel i get seg faults. Tried also lenny arm. Here I can chroot into it. So tried move on with arm instead, but I only found orion built for armel. So it seemed like a dead end to me and my skillset (and current determination or lack of it).

edit:
Tried squeeze armel it also segmentationfaults when chrooting.

edit again:

I found some info on this.

http://dns323.kood.org/forum/viewtopic.php?id=5231

I seems the conclusion in the thread is that armel cannot be chrooted with the stock kernel. What kernel did you use when chrooting?

Next step would be to reload a newer kernel and try again. Maybe alt-f is a prepacked ready to go platform for this. I will give it a go.

Last edited by bjby (2011-01-08 14:09:20)

Offline

 

#7 2011-01-08 17:23:56

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: Using ffp-reloaded to run true Debian root without modding firmware

Some updates.

I tried reloading alt-f it without success. I tried the fonz minimal fsck-env using zImage-2.6.25.1. It booted but I could only see the usb flashdisk not the harddisks. Also tried 2.6_orion, that one didnt boot. I pretty sure I am on rev B1 but after all this I am not too sure anymore. I think I will let this rest for a while now. 

http://www.inreto.de/dns323/fsck/

Offline

 

#8 2011-01-09 00:27:25

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: Using ffp-reloaded to run true Debian root without modding firmware

If you are talking about doing the chroot to set up the new Debian installation, then you are right, you can't chroot into an armel installation from the old 2.6.12 arm1 kernel.

I ended up using a plugcomputer running a recent armel installation to complete the chroot.
Alternatively, I think there is a way to divide the setup into a 'stage 1' and a 'stage 2' installation.
In stage 1 you basically just use cdebootstrap to download the packages.
The command is:
cdebootstrap --foregin -aarmel  --include=locales,initramfs-tools,libuuid-perl lenny <lenny root> ftp://ftp.debian.org/debian

Then you need to complete stage II on an armel machine (e.g. the dns-323). I haven't investigated exactly how to do it but I imagine it would involve putting a kernel on the partition and reloading into that kernel and then letting an auto-install type script finish the job (you will have to google to fill in the missing steps since I didn't have to do it that way.

Alternatively, if you or anybody else, can provide a couple of hundred MB of upload space, I saved a virgin copy of an armel Debian install that I would be willing to upload for you and anybody else who wants it. Obviously, from there you could customize etc.

Offline

 

#9 2011-01-09 11:37:32

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: Using ffp-reloaded to run true Debian root without modding firmware

I would like a virgin copy. At least it sounds good smile. I sent a forum message howto upload.

note: upload will not keep ownership, so better tar or simliar.

/thanx

Last edited by bjby (2011-01-09 12:16:36)

Offline

 

#10 2011-01-17 17:30:16

Treb
New member
Registered: 2011-01-17
Posts: 2

Re: Using ffp-reloaded to run true Debian root without modding firmware

Sounds great, but will this also work on the Conceptronic CH3MNAS ?

Bert

Offline

 

#11 2011-01-17 19:15:39

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: Using ffp-reloaded to run true Debian root without modding firmware

I imagine you will need to try it (either that or buy me a Conceptronic to play with tongue)

Offline

 

#12 2011-01-18 00:39:02

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: Using ffp-reloaded to run true Debian root without modding firmware

Thanx for the upload, but I never got it working, i guess i need to read up and try harder. Also figured out I have a A1 revision despite what the sticker says.
I bougth another used A1 for really cheep and a nokia cord to make a seriel cable. I d like to learn more.

Offline

 

#13 2011-01-18 20:04:47

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: Using ffp-reloaded to run true Debian root without modding firmware

you of course need to do the kernel reloading right... if any of the kernel line parameters are wrong or if your initrd is wrong or too big then you will have hangs

Offline

 

#14 2011-01-19 12:05:50

Treb
New member
Registered: 2011-01-17
Posts: 2

Re: Using ffp-reloaded to run true Debian root without modding firmware

puterboy wrote:

I imagine you will need to try it (either that or buy me a Conceptronic to play with tongue)

OK, this is what I did so far:
- HW CH3MNAS with latest FW
- Fonz_plug 0.5 is installed
- built a lenny ARM distro on a debian system
- tried to chroot it but got the error "chroot: cannot execute /ffp/bin/sh: No such file or directory"

A bit confused now...

Please help.

Thanks, Bert

Offline

 

#15 2011-01-19 13:21:19

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: Using ffp-reloaded to run true Debian root without modding firmware

you need to specify /bin/sh as shell. see this thread for info.

http://dns323.kood.org/howto:chroot_debian

Offline

 

#16 2011-01-19 17:36:36

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Using ffp-reloaded to run true Debian root without modding firmware

The following will run a bash shell in a debian chroot stored in the /mnt/md0/debian directory:

CHROOT="/mnt/md0/debian"
chroot $CHROOT /bin/bash

Offline

 

#17 2011-01-31 16:07:13

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: Using ffp-reloaded to run true Debian root without modding firmware

I ended up flashing with the debian installer for squeeze. I felt brave having the HW to build a serielcable. It is userfriendly to setup. I think there are two pitfalls. Make sure to install a ssh server as part of installation and pay attention to the fan not being off.

Debian is just superior to the hack made by dlink.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB