[Udpcast] pxe undi network driver

Alain Knaff alain at knaff.lu
Fri Dec 5 09:54:45 CET 2003


begin  Friday 05 December 2003 02:02, Eric Becker quote:
> Ahhh...I see. Thank you for the reply.
>
> I have gotten a custom compiled kernel (with my bcm5700 net drivers) to
> work using the makeImage utility.  I can successfully create floppy and
> cdrom utilites that work with my hardware.  I can also boot using PXE with
> my custom kernel.
>
> However, I would like to include hdparm in initrd. I'm using the following
> syntax when running makeImage  "./makeImage -k
> /usr/src/linux-2.4.22/arch/i386/boot/bzImage -c
> /tftpboot/udpcast/images/udpcd.img -i /tftpboot/udpcast/initrd --bzip -m
> bcm5700 --merge /bin/hdparm=/sbin/hdparm".  I boot up my PXE client and go
> to the console and type /sbin/hdparm, but I get "no such file or directory.
>  I can see the file if I do an ls, but I can't execute it.  Any ideas?

By default, initrd uses the "busybox" system, for space efficiency; in
order to make everything small enough to fit on a boot floppy.

Busybox uses the following setup to save space:
 1. There are no shared libraries, because these are huge nowadays
(because they contain lots of function which are not actually needed
on an embedded system)
 2. Instead, everything (ifconfig, dhcpcd, ...) is linked together in
a same single executable, which behaves differently depending on how
it is called.

"Normal" programs that are just copied off a full Linux systems do
need the shared libraries however. So you need to copy these as well
to the initrd. It will make the initrd *much* larger, but in your
case, this should not be cause of concern, as you are booting from PXE
rather than floppy, thus there are no space constraints.

Here is how to find out which libraries you need.

 1. On your main system, set up directories /chroot-test,
/chroot-test/bin, /chroot-test/lib, /chroot-test/usr/lib, 
 2. Copy your app (hdparm) to this directory:
  cp /sbin/hdparm /chroot-test/bin/

 3. Copy also /lib/ld-linux.so.2 :
  cp /lib/ld-linux.so.2 /chroot-test/lib
 This ld-linux.so.2 is the first shared library you need. It is also
that part that allows you to get clearer error messages for the
*other* libraries that may be missing

 4. Now try running it using chroot:

  chroot /chroot-test /bin/hdparm

 You should now get an error message such as the following:
 /bin/hdparm: error while loading shared libraries: libc.so.6: cannot open 
shared object file: No such file or directory

  Keep adding those files (in this case /lib/libc.so.6) until you no
longer get these

  cp /lib/libc.so.6 /chroot-test/lib

 now you have all shared libraries in /chroot-test/lib


On the machine I just tested (Red Hat Fedora), ld-linux.so.2 and
libc.so.6 were enough to make it run; however depending on your
distribution (or if you want to use a different app than hdparm), you
may need more libraries.

 Once you have these, just include everything under /chroot-test onto
your initrd:

./makeImage -k /usr/src/linux-2.4.22/arch/i386/boot/bzImage -c \
/tftpboot/udpcast/images/udpcd.img -i /tftpboot/udpcast/initrd --bzip \
-m bcm5700 --merge /bin/hdparm=/chroot-test/bin/hdparm /lib=/chroot-test/lib


Again, such a technique will work for PXE and for CD-Rom
boot. However, for floppy, the resulting image will be hopelessly
oversized...

Regards,

Alain





More information about the Udpcast mailing list