[nas-2000] Re: custom kernel/ initrd problem

  • From: philipp Wehrheim <flipstar@xxxxxxx>
  • To: nas-2000@xxxxxxxxxxxxx
  • Date: Fri, 04 Jan 2008 22:26:18 +0100


Felix Mellmann wrote:
> Hmm, okay I guessed your answer already :)
> Nevertheless, did you complete my debian how-to and have this image
> running?
> When you did this, you installed the initrd-image shipped with the disk
> image.

I have no idea about Debian ... but do they support uclibc?
Statically linked uclibc bins can be executed in a glibc env so this can
save lots of size.


busybox   glibc    1.3 Mbyte
busybox   uclibc   0.6 Mbyte

> A fresh NAS box has got a bootloader, linux kernel, initrd-image,
> application image and some misc files. The bootloader loads the kernel
> and the initrd-image and starts the kernel. The kernel itself unpacks
> the initrd and starts /sbin/init from that image (for making that issue
> complete - normally the kernel will run /linuxrc but due to
> root=/dev/ram on the kernel command line, the kernel will run /sbin/init
> ; the kernel command line is not changeable, because its included in the
> bootloader).

The kernelcmd is compiled into the kernel!


> /sbin/init treats itself differently wether it has the process ID (PID)
> 1 or an other PID greater than 1.
> So I summed up - I didn't want to change the bootloader and the kernel.
> So the kernel will always load /sbin/init from flash and give the PID 1
> to that process. If I would write a program, that calls /sbin/init from
> hdd to start the boot process of debian, that process will get an higher
> PID and doesn't boot debian. Philipp helped me out, there is a system
> command, which exchanges the flash with the hdd and the boot process
> starts. And so does my little initrd. This one is essential for booting
>> from hdd and shouldn't be replaced.
> About the kernel - I think there are some people in the forum, who know
> much more about the kernel and the hardware specialities on the NAS than
> me ^^
> As far as I know, there is a kernel from an other NAS available with
> usb-support available and it should work very well. But I wonder if
> there is a way to get dmraid compiled...
> BTW.: I have written a little program which reacts on pressing the power
> button and shuts down the NAS. I should post it in the wiki ..
> My NAS does its job very well, I have Samba, NFS server and a subversion
> server running. IMAP mailserver is planned, as soon as I get the NAS to
> power on on telephone ring ^^
> greetings, Felix
> Dan Luedtke schrieb:
>> Hi Felix,
>> Am 04.01.2008 um 16:10 schrieb Felix Mellmann:
>>> .. but you can use a larger initrd if you want, but you have to
>>> remove the "Application" file in flash. I kept that one because its
>>> then easier to switch to the old system.
>> OK, thanks for that, i will try it.
>>> If you have a look on my initrd, there are just some needed devices,
>>> 2 essential libraries and the modified /sbin/init which swaps from
>>> flash to hdd.
>> How to swap over to hdd? I thought the kernel doesnt care where the
>> initrd comes from as long as it is startet in some way. The bootloader
>> starts the initrd, doesnt he?! I will see, as long as the
>> redbootloader is working i will have all oportunities :)
>>> I don't know what you want to do with cryptonas
>> it's less an important thing, its more a
>> how-far-can-i-go-with-this-little-gadget thing for wasting my free
>> time :)
>> Maybe some day i'll plug my usb thmubdrive holding the keyfile into
>> the unused USB port, then the NAS starts decrypting the volume and
>> grants me access to it via network (samba for example would be nice)
>> as long as the thumbdrive is in the port.
>> An easy way of open and close encrypted volumes with personal data for
>> reading/backup.
>> But thats just a possiblity, today it's still this testiing/learning
>> thing.
>>> Btw. can you please tell me which kernel sources you have used? The
>>> vanilla (unpatched) kernel sources don't include the drivers for the
>>> board used in the NAS... so I haven't build a kernel for the NAS by
>>> myself.
>> Uhm, ok. Thats not good to hear.
>> I have the vanilla from kernel.org
>> Shoul i use the debian kernel source? Another long night of compiling
>> for the NAS :) I really should think about cross compiling.
>> Where do you have the kernel from? Are there prebuild kernels
>> somewhere on the net?
>> I need the device mapper, loopback device, usb support etc :( Thats
>> the problem.
>>> 2nd Btw. where did your 3 MB initrd image came from?
>> shame on me, i just used
>> % make menuconfig
>> % make-kpkg --initrd kernel-image
>> Then there was an initrd.img-2.6.xxx-xx-blah in /boot.
>> Using debian on the NAS is a great deal! Thanks for that btw. I saw
>> the drive at "Media Markt" (an annoying German end-consumer electronic
>> market, for those how don't know) with the sticker saying "New
>> Firmware. Supports Bonjour, HDD Encryption, Twonky Media...".
>> HDD-Encryption made me thinking "Uhhm, lets see what they call
>> encryption." Spending my last money to the NAS i now have a little toy
>> for big games (see above) including world domination :)
>> Greetings,
>> Dan

Other related posts: