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 2007-04-08 15:47:40

radiusweb
Member
Registered: 2007-02-10
Posts: 17

Running a Linux distro on the DNS-323? READ THIS.

Whatever you do, DO NOT chmod the root of any partition to anything other than 777.  If you change the root of the partition to anything other than 777,  (drwxrwxrwx) the hotplug scripts on your DNS-323 will notice this change and react by executing this command:

chmod -R a+w /mnt/<your partition>
(Not exactly good news for your Linux distro.)

Remember this is the root of the "partition" I'm talking about.  If you have Linux installed to /mnt/HD_a2/sarge for example, then you can safely chmod sarge to 755.  This is in fact necessary or some applications will complain or not run at all.  But the partition it's self whether it be /mnt/HD_a2 or /mnt/HD_b2 or even /mnt/HD_z3 MUST have permissions 777 or the hotplug scripts will ruin the permissions of your entire partition.

Please note I've only confirmed this behavior on Rev 1.01 of the firmware.  The following scripts on your DNS-323 contains the code which implements the behavior described above:

/etc/hotplug/satamount
/etc/hotplug/usbmount
/usr/sbin/raidstart
/usr/sbin/chkbutton

(Pay particular attention to the $ACL variable and occurrences of the chmod -R command)

In response to this, I put together a couple scripts for backing up and restoring permissions if anyone is interested.

Last edited by radiusweb (2007-05-01 22:44:46)

Offline

 

#2 2007-05-01 21:58:53

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Running a Linux distro on the DNS-323? READ THIS.

radiusweb wrote:

Whatever you do, DO NOT chmod the root of any partition to anything other than 777.  If you change the root of the partition to anything other than 777,  (drwxrwxrwx) the hotplug scripts on your DNS-323 will notice this change and react by executing this command:

chmod -R a+w /mnt/<your partition>
(Not exactly good news for your Linux distro.)

Using the subdirectory idea, I think it's possible to work around this for non-chroot, i.e. booted Linux installations, too. With initramfs it's possible to boot with a subdirectory (e.g. linux/) as root. I've tried the following in an /init script of an initramfs, and it works nicely in qemu (I assume it'll also work on the real device):

Code:

/bin/mkdir -p /mnt
/bin/mount -t ext2 /dev/sda /mnt

cd /mnt/linux
exec /usr/sbin/chroot . /sbin/init

And having your custom firmware in a single separate directory (instead of filling your first volume with lots of directories) doesn't seem too bad.

Offline

 

#3 2007-05-04 03:16:57

radiusweb
Member
Registered: 2007-02-10
Posts: 17

Re: Running a Linux distro on the DNS-323? READ THIS.

Yep.  Sounds good.  I'm looking forward to a true firmware replacement.  Then at no point during system startup will any process try chmodding anything you don't want chmodded.  Control will finally be in the hands of the user.  The module based kernel replacement is a great start though.  At least you can run your own kernel as you see fit. smile

Now if only the mtd was field replaceable, testing could be done easily.  Bad flash?  Just put the chip in a programmer and reload the original data.  On the other hand the whole point of this is to keep costs low.  By the time we have a reliable new firmware, the DNS-323 might be discontinued?

I'd love to see at least one company make a low cost server appliance with a two sided firmware like with AIX.  Now a bad flash can be corrected just by resetting the device.

Offline

 

#4 2007-05-08 10:20:16

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Running a Linux distro on the DNS-323? READ THIS.

radiusweb wrote:

Yep.  Sounds good.  I'm looking forward to a true firmware replacement.  Then at no point during system startup will any process try chmodding anything you don't want chmodded.  Control will finally be in the hands of the user.  The module based kernel replacement is a great start though.  At least you can run your own kernel as you see fit. smile

I've uploaded a new Linux image yesterday. It's installed into "linux/' on the first volume and boots the 2.6.12.6 kernel. Included are new kernel loader modules for firmwares 1.02 and 1.03 that should be much more reliable than the first version. In addition to the led and poweroff programs, I've also added two more DNS323-specific small utilities for temperature, and fan control. Have a look at www.inreto.de/dns323/ - the binary image is in bob-clfs/, sources are in source/. Installing the image is only slightly more complicated than the fun-plug, and a script is included that creates an initial configuration automatically from firmware files.

Offline

 

#5 2007-05-08 11:18:16

radiusweb
Member
Registered: 2007-02-10
Posts: 17

Re: Running a Linux distro on the DNS-323? READ THIS.

Very cool.  Do you have any information on compiling your own kernel from sources on the 323?  My kernel compiled without complaint on the DNS-323 but I haven't tried booting it yet.  I'm wondering what's required to make a kernel that will run on the DNS-323?  Is there a bunch of strange customizations needed to the sources or any non-intuitive configuration changes required during the make config phase?  Or would it be sufficient to take vanilla sources, specify a processor and then just start it compiling?

Your latest bobclfs looks great.  Good job!

Offline

 

#6 2007-05-08 11:46:10

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Running a Linux distro on the DNS-323? READ THIS.

radiusweb wrote:

Do you have any information on compiling your own kernel from sources on the 323?

Kernel compilation is straight forward, but:
- Vanilla kernels won't work because they lack support for this specific platform. Use 2.6.12.6 sources from ftp.dlink.com. D-Link's kernel sources contain a .config file that you can start with
- Use gcc version 3, gcc4 doesn't work.
- Cross-compilation is much much much much much faster.
- Of course, you need a root filesystem to boot.
- And unless you install to the root of a drive (and get the problems you found), you will need an initrd or initramfs.

Offline

 

#7 2007-05-12 00:14:52

radiusweb
Member
Registered: 2007-02-10
Posts: 17

Re: Running a Linux distro on the DNS-323? READ THIS.

Nice.  The journey toward a truly custom DNS-323 seems to be getting shorter all the time.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB