Re: ldminfo compilation

From: Luciano Rocha
Date: Wed Dec 12 2007 - 11:41:27 EST


On Wed, Dec 12, 2007 at 03:29:55PM +0000, Luciano Rocha wrote:
> On Wed, Dec 12, 2007 at 04:57:39PM +0200, Alon Bar-Lev wrote:
> > On 12/12/07, Luciano Rocha <luciano@xxxxxxxxxxx> wrote:
> > > Those are for the kernel module setting the partition tables. If you're
> > > only interested in the ldminfo utility:
> > > make -C ldmutil CPP='g++ -static'
> > >
> > > Substitute g++ for the C++ compiler you want to use.
> >
> > Hi!
> > Thank you for your reply!
> >
> > I don't really understand how to use the output of ldmutil in order to
> > do the dmsetup... All the instructions are for ldminfo...
>
> Ah, sorry. Somehow I got the impression that the ldmutil directory
> included the ldminfo binary. I'll see if I can compile the ldminfo
> statically in an older system I have.

OK, the statically compiled version is at:
ftp://gil.di.uminho.pt/pub/users/strange/ldminfo
sha1sum: 71c1451f9cbd1a4256bb072d4c930418acc8e2fb

Anyway, how to compile with the sources of:
- linux-2.4.20
- linux-ldm-0.0.8

ldm=linux-ldm-0.0.8
kernel=linux-2.4.20

1. Decompress linux-ldm-0.0.8:
curl -s http://dl.sourceforge.net/sourceforge/linux-ntfs/$ldm.tar.bz2 \
| tar xjf -

2. Enter the directory:
cd $ldm

3. Decompress the Linux kernel sources:
curl -s ftp://ftp.di.uminho.pt/pub/kernel/v2.4/$kernel.tar.bz2 \
| tar xjf -

4. Change test/Makefile to compile ldminfo statically:
sed -e 's/ -o/ -static &/' -i test/Makefile

5. Correct KERNEL path in Makefile:
sed -e "s,KERNEL.*=.*,KERNEL = $PWD/$kernel," -i Makefile

6. Force i386 arch in Makefile:
sed -e 's/-march=.*/-march=i386/' -i Makefile

7. Generate kernel's option files:
yes n | make -C $kernel ARCH=i386 oldconfig dep

8. Compile ldminfo and ldmutil:
make ARCH=i386

This worked on a Centos 3.8, 32bits but running x86_64 kernel, but not
on my Fedora 8. YMMV.

Shell script:

ldm=linux-ldm-0.0.8
kernel=linux-2.4.20
curl -s http://dl.sourceforge.net/sourceforge/linux-ntfs/$ldm.tar.bz2 \
| tar xjf - &&
cd $ldm &&
curl -s ftp://ftp.di.uminho.pt/pub/kernel/v2.4/$kernel.tar.bz2 \
| tar xjf - &&
sed -e 's/ -o/ -static &/' -i test/Makefile &&
sed -e "s,KERNEL.*=.*,KERNEL = $PWD/$kernel," -i Makefile &&
sed -e 's/-march=.*/-march=i386/' -i Makefile &&
yes n | make -C $kernel ARCH=i386 oldconfig dep &&
make ARCH=i386

--
Luciano Rocha <luciano@xxxxxxxxxxx>
Eurotux Informática, S.A. <http://www.eurotux.com/>

Attachment: pgp00000.pgp
Description: PGP signature