Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 211426 - sys-fs/mdadm: mdassemble missing
Summary: sys-fs/mdadm: mdassemble missing
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-25 19:22 UTC by Jimmy.Jazz
Modified: 2008-04-16 19:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
mdadm with mdassemble and static flag (mdadm-ebuild.diff,2.29 KB, patch)
2008-02-25 19:28 UTC, Jimmy.Jazz
Details | Diff
add mdassemble and mdadm.static in Makefile (mdadm-add-mdassemble.patch,284 bytes, patch)
2008-02-25 19:29 UTC, Jimmy.Jazz
Details | Diff
Makefile (mdadm-Makefile.patch,820 bytes, patch)
2008-03-17 22:40 UTC, Jimmy.Jazz
Details | Diff
ebuild with mdassemble (mdadm-2.6.4-r1.ebuild,3.33 KB, text/plain)
2008-03-22 12:56 UTC, Jimmy.Jazz
Details
Mafile patch (mdadm-Makefile.diff,2.46 KB, patch)
2008-03-22 12:57 UTC, Jimmy.Jazz
Details | Diff
ebuild with mdassemble (mdadm-2.6.4-r2.ebuild,3.35 KB, text/plain)
2008-03-22 13:29 UTC, Jimmy.Jazz
Details
correct the directory name where mdadm will look for mdadm.conf (ebuild-corrective,1012 bytes, patch)
2008-03-22 13:47 UTC, Jimmy.Jazz
Details | Diff
ebuild with mdassemble (mdadm-2.6.4-r2.ebuild,3.33 KB, text/plain)
2008-03-22 23:33 UTC, Jimmy.Jazz
Details
Makefile more generic (Makefile,3.28 KB, text/plain)
2008-03-24 18:38 UTC, Jimmy.Jazz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jimmy.Jazz 2008-02-25 19:22:27 UTC
mdassemble is a lightweight program to assemble raid devices  that can be called directly for an initramfs filesystem. It weights 88ko compiled statically with dietlibc. Also, it would be great to see it in a mdadm ebuild with mdadm.static.


Reproducible: Always
Comment 1 Jimmy.Jazz 2008-02-25 19:28:53 UTC
Created attachment 144625 [details, diff]
mdadm with mdassemble and static flag

It is not quite a good example but that was the only one that has survived. It works well with crossdev.
Comment 2 Jimmy.Jazz 2008-02-25 19:29:58 UTC
Created attachment 144627 [details, diff]
add mdassemble and mdadm.static in Makefile
Comment 3 SpanKY gentoo-dev 2008-03-16 08:05:53 UTC
Comment on attachment 144625 [details, diff]
mdadm with mdassemble and static flag

selection of a compiler is up to the user, not the ebuild.  same goes for static linking.

there's also a lot of extraneous noise/wrong lines in the ebuild diff.

post a patch against the Makefile to generate mdassemble using the normal compiler and i'll look at it.
Comment 4 Jimmy.Jazz 2008-03-17 22:37:20 UTC
(In reply to comment #3)
> (From update of attachment 144625 [details, diff] [edit])
> selection of a compiler is up to the user, not the ebuild.  same goes for
> static linking.
> 
> there's also a lot of extraneous noise/wrong lines in the ebuild diff.

I agree with you. Sorry for that. It is sometimes a pain in the neck to get a nice ebuild especially if everything goes wrong.

> 
> post a patch against the Makefile to generate mdassemble using the normal
> compiler and i'll look at it.
> 

I just patched the makefile to handle mdassemble as well as mdadm.uclibc (the initial makefile ignores mdadm.uclibc whereas mdadm binary works like expected even from an initramfs file. I'm not always so lucky with busybox ;))

The makefile works with the following flags,

LDFLAGS="-static" CHOST="x86_64-pc-linux-uclibc" make mdadm.uclibc
LDFLAGS="-static" CHOST="x86_64-pc-linux-uclibc" make mdassemble.uclibc
CFLAGS="-static" MDASSEMBLE_AUTO="dummy" make mdassemble
or to build a smaller program (~88k) CFLAGS="-static" make mdassemble

FYI, I was not able to play with uclibc successfully with neither device-mapper nor lvm ebuild configure file. The configure file always use gnu gcc even if CHOST, CBUILD or CTARGET is/are specified :( but that's an other story.

I hope I could help.
Comment 5 Jimmy.Jazz 2008-03-17 22:40:24 UTC
Created attachment 146418 [details, diff]
Makefile
Comment 6 SpanKY gentoo-dev 2008-03-18 11:32:02 UTC
i dont see how that patch helps us ... for the ebuild, we dont care about the random extraneous targets that mdadm's Makefile provides.

what exactly are you after ?  mdassemble ?  so fix the default "mdassemble" target so that it:
 - does not delete all random objects
 - does not hardcode static flags
 - uses the normal toolchain / flags

then when people do `emerge mdadm`, they get a normal dynamic "mdassemble" binary.  if they want a static one, they can build up with USE=static and copy mdassemble out of the tree.  or if they want to build with some random toolchain (like uclibc/dietlibc/whatever), they set their build environment accordingly.
Comment 7 Jimmy.Jazz 2008-03-22 12:54:48 UTC
(In reply to comment #6)
> i dont see how that patch helps us ... for the ebuild, we dont care about the
> random extraneous targets that mdadm's Makefile provides.

You asked me for a Makefile not an ebuild.

> what exactly are you after ?  

That's what i'm asking myself sometimes. Seriously, the idea was to get mdassemble and mdadm binaries as small as possible.

> then when people do `emerge mdadm`, they get a normal dynamic "mdassemble"
> binary.  if they want a static one, they can build up with USE=static and copy
> mdassemble out of the tree.  or if they want to build with some random
> toolchain (like uclibc/dietlibc/whatever), they set their build environment
> accordingly.
> 

I didn't test all the possibilities, but I hope it will now fit their needs.

I don't have tcc, klibc and dietlibc cross-compiler installed, I cannot test them.
It is still possible to use diet directly with the diet flag.

mdassemble works when compiled statically. Otherwise use mdadm instead.

For example,
USE="diet" ebuild mdadm-2.6.4-r1.ebuild install
USE=static CHOST=x86_64-pc-linux-uclibc ebuild mdadm-2.6.4-r1.ebuild install

I hope that will satisfy your requirements :)
Comment 8 Jimmy.Jazz 2008-03-22 12:56:20 UTC
Created attachment 146878 [details]
ebuild with mdassemble
Comment 9 Jimmy.Jazz 2008-03-22 12:57:27 UTC
Created attachment 146879 [details, diff]
Mafile patch
Comment 10 Jimmy.Jazz 2008-03-22 13:29:02 UTC
Created attachment 146886 [details]
ebuild with mdassemble
Comment 11 Jimmy.Jazz 2008-03-22 13:33:52 UTC
Comment on attachment 146878 [details]
ebuild with mdassemble

Wrong file + errors when using mailer and mdauto flags
Comment 12 Jimmy.Jazz 2008-03-22 13:47:32 UTC
Created attachment 146889 [details, diff]
correct the directory name where mdadm will look for mdadm.conf

Gentoo mdadm uses /etc/mdadm.conf instead
Comment 13 Jimmy.Jazz 2008-03-22 23:33:47 UTC
Created attachment 146958 [details]
ebuild with mdassemble

I'm not used to play with gentoo eclasses. mdadm and mdassemble need of course to have the executable flag set otherwise raidstart.sh will not be able to run mdadm and you will certainly end up with an unbootable system. So be careful.

To avoid any confusions I uploaded a full ebuild, hoping it won't be any errors this time.

Sorry for the inconvenience.
Comment 14 SpanKY gentoo-dev 2008-03-23 17:55:03 UTC
we dont control klibc/dietlibc/uclibc at all in ebuilds.  just fix the mdassemble target and that's it.
Comment 15 Jimmy.Jazz 2008-03-24 18:38:25 UTC
Created attachment 147155 [details]
Makefile more generic

(In reply to comment #14)
> we dont control klibc/dietlibc/uclibc at all in ebuilds.  just fix the
> mdassemble target and that's it.
> 

All right then. If I understand well you would prefer that the Makefile handles all the xxlibc stuff and nothing shall be add in the ebuild. Actually, I didn't look into a makefile for years and I'm a bit rusted. I will really appreciate if someone could look after it in detail.

For instance, the makefile is able to understand CFLAGS, LDFLAGS, CPPFLAGS, CC and for cross compiling CHOST and if CC is not set it will take the value make will attribute to it by default (cc I guess).

CFLAGS="-ggdb" LDFLAGS=-static CPPFLAGS=" -USendmail" CC="diet gcc" CHOST=x86_64-pc-linux-gnu make -f Makefile clean
CFLAGS="-ggdb" LDFLAGS=-static CPPFLAGS=" -USendmail" CC="gcc" CHOST=x86_64-pc-linux-gnu make -f Makefile clean
CFLAGS="-ggdb" LDFLAGS=-static CPPFLAGS=" -USendmail" CC="gcc" CHOST=x86_64-pc-linux-gnu make -f Makefile
CFLAGS="-ggdb" LDFLAGS=-static CPPFLAGS=" -USendmail" CC="gcc" CHOST=x86_64-pc-linux-gnu make -f Makefile clean
CFLAGS="-ggdb" LDFLAGS=-static CPPFLAGS=" -USendmail" CC="gcc" CHOST=x86_64-pc-linux-uclibc make -f Makefile clean
CFLAGS="-ggdb" LDFLAGS=-static CPPFLAGS=" -USendmail" CC="gcc" CHOST=x86_64-pc-linux-uclibc make -f Makefile 
CFLAGS="-ggdb" CPPFLAGS=" -USendmail" CC="gcc" CHOST=x86_64-pc-linux-uclibc make -f Makefile clean
CFLAGS="-ggdb" CPPFLAGS=" -USendmail" CC="gcc" CHOST=x86_64-pc-linux-uclibc make -f Makefile 
CFLAGS="-ggdb" CPPFLAGS=" -USendmail" CC="gcc" CHOST=x86_64-pc-linux-uclibc make -f Makefile clean
CFLAGS="-ggdb" CPPFLAGS=" -USendmail" CC="diet gcc" CHOST=x86_64-pc-linux-uclibc make -f Makefile
Comment 16 Jimmy.Jazz 2008-03-24 18:52:19 UTC
Oops, as usual when you are in a hurry you make mistakes :(
Just delete $(DIET) before $(CC) in the following rules. If set, diet is call from CC .

--- Makefile	2008-03-24 19:09:40.000000000 +0100
+++ /var/tmp/portage/sys-fs/mdadm-2.6.4-r1/work/mdadm-2.6.4/Makefile	2008-03-24 19:34:31.000000000 +0100

@@ -97,11 +96,11 @@
 all : mdadm mdassemble
 
 mdadm : $(OBJS) $(STATICOBJS)
-	$(DIET) $(CC) ${CFLAGS} $(LDFLAGS) -o mdadm $(OBJS) $(LDLIBS) $(STATICOBJS)
+	$(CC) ${CFLAGS} $(LDFLAGS) -o mdadm $(OBJS) $(LDLIBS) $(STATICOBJS)
 
 mdassemble : $(ASSEMBLE_SRCS) mdadm.h
 	rm -f $(OBJS)
-	$(DIET) $(CC) $(LDFLAGS) $(ASSEMBLE_FLAGS) -DHAVE_STDINT_H -o mdassemble $(ASSEMBLE_SRCS) $(STATICSRC)
+	$(CC) $(LDFLAGS) $(ASSEMBLE_FLAGS) -DHAVE_STDINT_H -o mdassemble $(ASSEMBLE_SRCS) $(STATICSRC)
 
 mdadm.man : mdadm.8
 	nroff -man mdadm.8 > mdadm.man
Comment 17 SpanKY gentoo-dev 2008-03-29 19:21:22 UTC
fixed with 2.6.4-r2
Comment 18 Jimmy.Jazz 2008-04-16 19:41:14 UTC
(In reply to comment #17)
> fixed with 2.6.4-r2
> 

Thanks,

Just to let you know in case you missed it, I rewrite a new Makefile that handled "standard" flags better, anyway if you want to cross compile. See last attachment.
The commented lines at the beginning of the file show some examples. 
I use it to generate uclibc binary for my own initramfs.