Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
New Version: mkinitcpio-0.9.2.ebuild
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Fri May 11, 2012 5:28 pm    Post subject: New Version: mkinitcpio-0.9.2.ebuild Reply with quote

Hello gentoo forum,

after I read the neddy guide on udev 182, I start a thread on initrd creation for people eg running root on LVM with seperate /usr and/or /var partition.
See
https://forums.gentoo.org/viewtopic-t-920644.html
for details.

For this, I use arch linux's mkinitcpio tool, which works on arch like a charm.
It is in my opinion easy to set up, and atm a superior solution to genkernel.

The gentoo genkernel created initrd does not work that well for me, because I found that genkernel does not include the udev demon in the initrd.
The result, LVs don't get properly symlinked in
Code:
/dev/disk/by-label
or
Code:
/dev/disk/by-uuid
.
The
Code:
/dev/disk/by-path
directory is completely missing when using genkernel's initrd, and consequently LVs don't show eg in dolphin sidebar.

I created yesterday a patched ebuild for mkinitcpio-0.8.8.
It builds on my system, but I didn't have the time yet to generate an initrd.
Last one has been assembled by hand, but with the same structure.

Code:
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: mkinitcpio-0.8.8.ebuild $
EAPI=3
inherit eutils

DESCRIPTION="Modular initramfs image creation utility ported from Arch Linux"
HOMEPAGE="http://www.archlinux.org/"
SRC_URI="ftp://ftp.archlinux.org/other/${PN}/${PN}-${PV}.tar.gz"

LICENSE="GPL"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

DEPEND=">=sys-apps/busybox-1.19.3-r1[static]
   app-arch/cpio
   >=sys-apps/util-linux-2.21
   >=sys-apps/kmod-7
   sys-apps/grep
   sys-apps/sed
   sys-apps/findutils
   app-shells/bash
   sys-apps/file
   app-arch/gzip
   sys-apps/coreutils
   app-arch/libarchive"
RDEPEND="${DEPEND}"

src_prepare() {
   cd "${WORKDIR}/${P}/install"
   epatch "${FILESDIR}/${P}-base.patch"
   epatch "${FILESDIR}/${P}-consolefont.patch"
   epatch "${FILESDIR}/${P}-keymap.patch"
}

src_install() {
   emake DESTDIR="${D}" install || die "Install Failed"
}


Put patches inside files folder in overlay's mkinitcpio

eg: $PORTDIR_OVERLAY/sys-kernel/mkinitcpio/files

Code:
--- base   2012-05-11 02:35:54.364838672 +0200
+++ base.patched   2012-05-11 02:36:11.115837731 +0200
@@ -12,9 +12,12 @@
     add_symlink /bin usr/bin
     add_symlink /usr/sbin bin
 
-    add_binary /usr/lib/initcpio/busybox /bin/busybox
+    add_binary /bin/busybox /bin/busybox
 
-    for applet in $(/usr/lib/initcpio/busybox --list); do
+    add_device "/dev/console" c 5 1
+    add_device "/dev/mem" c 1 1
+   
+    for applet in $(/bin/busybox --list); do
         add_symlink "/usr/bin/$applet" busybox
     done
 


Code:
--- consolefont   2012-03-24 20:43:12.000000000 +0100
+++ consolefont.patched   2012-05-11 02:52:29.449782797 +0200
@@ -5,14 +5,14 @@
 
     # subshell to avoid namespace pollution
     (
-        for cfg in etc/{rc,vconsole}.conf; do
+        for cfg in etc/conf.d/consolefont; do
             [[ -s $BASEDIR/$cfg ]] && . "$BASEDIR/$cfg"
         done
 
         [[ $FONT ]] && CONSOLEFONT=$FONT
 
         if [[ $CONSOLEFONT ]]; then
-            for file in "$BASEDIR/usr/share/kbd/consolefonts/$CONSOLEFONT".psf?(u)?(.gz); do
+            for file in "$BASEDIR/usr/share/consolefonts/$CONSOLEFONT".psf?(u)?(.gz); do
                 if [[ -e $file ]]; then
                     [[ $file =~ \.(psfu?)(\.gz)?$ ]] && ext=${BASH_REMATCH[1]}
                     if [[ $file = *.gz ]]; then


Code:
--- keymap   2012-05-11 02:53:50.575778240 +0200
+++ keymap.patched   2012-05-11 02:54:26.326776233 +0200
@@ -7,7 +7,7 @@
         l=$LANG
         unset LANG
 
-        for cfg in etc/{rc,vconsole,locale}.conf; do
+        for cfg in etc/env.d/02locale; do
             [[ -s $BASEDIR/$cfg ]] && . "$BASEDIR/$cfg"
         done
 



I would like to ask people to test the ebuild, probably not necessarily on a productive machine.
I'd recommend vbox, in case something goes wrong, and the system is not bootable.


Set hooks in
Code:
/etc/mkinitcpio.conf

(read explanation comments for hooks in this file)
eg for LVM or mdadm

Usage:
Code:
mkinitcpio <kernel version>

Or for default:
Code:
mkinitcpio -p linux


ToDo:
-implement optional dependencies for various compression formats(once I figured out how to do it, since this is provided by libarchive)
-provide a default config file for gentoo kernels(atm it is still set to Arch kernel) in
Code:
/etc/mkinitcpio.d/*.preset



Any advice, improvement etc on the ebuild as well as feedback are highly welcomed.


Last edited by udeved on Sun Jul 01, 2012 3:33 pm; edited 5 times in total
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Sun May 13, 2012 9:41 am    Post subject: Reply with quote

I have now successfully ported the tool.
It boots perfectly root on LVM with almost everything on seperate LV partitons with generated ramdisk.
Contrary to genkernel's ramdisk tool, it creates properly all device links.

Fixed in mkinitcpio-0.8.8-r1.ebuild:
-added hooks: lvm2, mdadm, udev, encrypt
-added installs: lvm2, mdadm, udev, encrypt, mdadm_udev, pcmcia
-added udev rules: dm-initramfs
-added gentoo preset
-added /etc/modprobe.d/usb-load-ehci-first-conf
-base patch changes

Changes mkinitcpio-0.8.8-r2.ebuild
-added lvm, raid, pcmcia, crypt, udev use-flags

ToDo:
-Check kernel config for required modules
-testing on raid and/or crypt setup

Download ebuilds:
http://www.filehosting.org/file/details/341555/sys-kernel.tar.gz
http://www.xup.in/dl,11968372/sys-kernel.tar.gz/


Install:
extract to PORTDIR_OVERLAY
eventually run
Code:
ebuild mkinitcpio-0.8.8-r2.ebuild digest


Usage:
edit /etc/mkinitcpio.conf and set hooks to your needs
Code:
mkinitcpio -p gentoo

preset is set to kernel 3.3.4 in /etc/mkinitcpio.d/gentoo.preset
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Sun May 13, 2012 6:46 pm    Post subject: mkinitcpio-0.8.8-r3.ebuild Reply with quote

Code:
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: mkinitcpio-0.8.8-r3 $
EAPI=3
inherit eutils linux-info

DESCRIPTION="Modular initramfs image creation utility ported from Arch Linux"
HOMEPAGE="http://www.archlinux.org/"
SRC_URI="ftp://ftp.archlinux.org/other/${PN}/${PN}-${PV}.tar.gz"

LICENSE="GPL"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 sh ~sparc ~x86"
IUSE="udev clvm cryptsetup mdadm pcmcia custom_kernel"
USE="udev clvm -cryptsetup -mdadm -pcmcia custom_kernel"

DEPEND=">=sys-apps/busybox-1.19.3-r1[static]
   app-arch/cpio
   >=sys-apps/util-linux-2.21
   >=sys-apps/kmod-7
   sys-apps/grep
   sys-apps/sed
   sys-apps/findutils
   app-shells/bash
   sys-apps/file
   app-arch/gzip
   sys-apps/coreutils
   app-arch/libarchive
   udev? ( sys-fs/udev )
   mdadm? ( sys-fs/mdadm[static] )
   cryptsetup? ( sys-fs/cryptsetup[static] )
   clvm? ( sys-fs/lvm2[static] )
   pcmcia? ( sys-apps/pcmciautils )"
RDEPEND="${DEPEND}"

pkg_setup() {

  if kernel_is -lt 2 6 32; then
      die "Sorry, your kernel must be 2.6.32-r103 or newer!"
  fi
  if linux_config_exists; then
      local CONFIG_CHECK #=""
     
      if use udev; then
     CONFIG_CHECK+=" ~DEVTMPFS"
      fi
   
      if use custom_kernel; then
    if use mdadm; then
     CONFIG_CHECK+=" ~MD ~MD_LINEAR ~MD_RAID0 \
     ~MD_RAID1 ~MD_RAID10 ~MD_RAID456"
    fi
   
    if use clvm; then
     CONFIG_CHECK+=" ~BLK_DEV_DM ~DM_SNAPSHOT \
     ~DM_MIRROR ~DM_RAID ~DM_UEVENT"
    fi
   
    if use cryptsetup; then
     CONFIG_CHECK+=" ~DM_CRYPT"
    fi
      fi
  fi   
     
   
   check_extra_config
}


src_prepare() {
   cd "${WORKDIR}/${P}/install"
   epatch "${FILESDIR}/${P}-base.patch"
   epatch "${FILESDIR}/${P}-consolefont.patch"
   epatch "${FILESDIR}/${P}-keymap.patch"
}

src_install() {
     #insinto /usr/lib/initcpio/hooks/

     if use udev; then
       insinto /usr/lib/initcpio/hooks/

       doins ${FILESDIR}/hooks/udev || die
    
       insinto /usr/lib/initcpio/install/
    
       doins ${FILESDIR}/install/udev || die
      
       insinto /usr/lib/initcpio/udev/
      
       doins ${FILESDIR}/udev/11-dm-initramfs.rules || die
     fi
    
     if use clvm; then
       insinto /usr/lib/initcpio/hooks/
      
       doins ${FILESDIR}/hooks/lvm2 || die
      
       insinto /usr/lib/initcpio/install/
      
       doins ${FILESDIR}/install/lvm2 || die
     fi
    
     if use mdadm; then
       insinto /usr/lib/initcpio/hooks/
      
       doins ${FILESDIR}/hooks/mdadm || die
       dosym /usr/lib/initcpio/hooks/mdadm /usr/lib/initcpio/hooks/raid
      
       insinto /usr/lib/initcpio/install/
      
       doins ${FILESDIR}/install/mdadm || die
       doins ${FILESDIR}/install/mdadm_udev || die
     fi
    
     if use cryptsetup; then
       insinto /usr/lib/initcpio/hooks/
      
       doins ${FILESDIR}/hooks/encrypt || die
      
       insinto /usr/lib/initcpio/install/
      
       doins ${FILESDIR}/install/encrypt || die
    fi   
      
    if use pcmcia; then
       insinto /usr/lib/initcpio/install/

       doins ${FILESDIR}/install/pcmcia || die
      
    
     fi
   
   insinto /etc/mkinitcpio.d/
     doins ${FILESDIR}/preset/gentoo.preset || die
   
   insinto /etc/modprobe.d/
     doins ${FILESDIR}/usb-load-ehci-first.conf || die
   
   emake DESTDIR="${D}" install || die "Install Failed"
}




ToDo:
-ebuild tweaking and improvement
-advise is welcome
-create proper ChangeLog
-idea for a more dynamic preset approach, preset generator
-raid and crypt testing
-get the sysinit logging to work
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sun May 13, 2012 8:25 pm    Post subject: Re: mkinitcpio-0.8.8-r3.ebuild Reply with quote

Nice work :-)
Code:

      if use udev; then
     CONFIG_CHECK+=" ~DEVTMPFS"
      fi
   
      if use custom_kernel; then
    if use mdadm; then
     CONFIG_CHECK+=" ~MD ~MD_LINEAR ~MD_RAID0 \
     ~MD_RAID1 ~MD_RAID10 ~MD_RAID456"
    elif use clvm; then
     CONFIG_CHECK+=" ~BLK_DEV_DM ~DM_SNAPSHOT \
     ~DM_MIRROR ~DM_RAID ~DM_UEVENT"
    elif use cryptsetup; then
     CONFIG_CHECK+=" ~DM_CRYPT"
   fi
    fi
  fi   

I think these should be separate if's, not an elif chain: what happens if the user requires lvm over mdadm? or with encryption, or all 3?

In src_install, all your uses of "$FILESDIR" should be quoted, so:
Code:
doins ${FILESDIR}/hooks/udev || die

should be:
Code:
doins "${FILESDIR}"/hooks/udev || die

or more simply:
Code:
doins "$FILESDIR"/hooks/udev || die

or:
Code:
doins "$FILESDIR/hooks/udev" || die

as you only ever need a ${var} expansion when it's immediately followed by an alphanumeric character or _ which would be considered part of the variable name (eg echo "${var}Text".) Any decent editor will highlight such a case, as variable names should be displayed in a different colour. Not saying you don't occasionally mess up, but 1) it's rare, though perhaps more common in ebuilds with ${PN}_$PV 2) you notice it straightaway, as the output which you've just coded is borked, so it doesn't lead to bugs, and 3) using $var, or more likely "$var" is a lot easier to type and read (eg: SRC_URI="ftp://ftp.archlinux.org/other/$PN/$PN-$PV.tar.gz" is roughly how kate or nano show it to me.)

Quoting is a much more important habit to get into (cf: /msg greybot quotes on irc.freenode.net)

I tend to use the last form, as string highlighting shows me immediately that this is one parameter to whichever command, which is the point of the whole thing: to avoid field splitting, or more generally to control precisely what gets passed as a parameter.

If you're not aware of POSIX Sh and utilities I highly recommend it, and sticking to the commands and options given there, as far as possible. (If you need to use sed -r, use sed -E instead, as both BSD and GNU support it [though GNU didn't document it, they have supported it for years], and it's been accepted for standardisation.)
_________________
creaker wrote:
systemd. It is a really ass pain

update - "a most excellent portage wrapper"

#friendly-coders -- We're still here for you™ ;)
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Sun May 13, 2012 8:42 pm    Post subject: Re: mkinitcpio-0.8.8-r3.ebuild Reply with quote

steveL wrote:
Nice work :-)
Code:

      if use udev; then
     CONFIG_CHECK+=" ~DEVTMPFS"
      fi
   
      if use custom_kernel; then
    if use mdadm; then
     CONFIG_CHECK+=" ~MD ~MD_LINEAR ~MD_RAID0 \
     ~MD_RAID1 ~MD_RAID10 ~MD_RAID456"
    elif use clvm; then
     CONFIG_CHECK+=" ~BLK_DEV_DM ~DM_SNAPSHOT \
     ~DM_MIRROR ~DM_RAID ~DM_UEVENT"
    elif use cryptsetup; then
     CONFIG_CHECK+=" ~DM_CRYPT"
   fi
    fi
  fi   

I think these should be separate if's, not an elif chain: what happens if the user requires lvm over mdadm? or with encryption, or all 3?

In src_install, all your uses of "$FILESDIR" should be quoted, so:
Code:
doins ${FILESDIR}/hooks/udev || die

should be:
Code:
doins "${FILESDIR}"/hooks/udev || die

or more simply:
Code:
doins "$FILESDIR"/hooks/udev || die

or:
Code:
doins "$FILESDIR/hooks/udev" || die

as you only ever need a ${var} expansion when it's immediately followed by an alphanumeric character or _ which would be considered part of the variable name (eg echo "${var}Text".) Any decent editor will highlight such a case, as variable names should be displayed in a different colour. Not saying you don't occasionally mess up, but 1) it's rare, though perhaps more common in ebuilds with ${PN}_$PV 2) you notice it straightaway, as the output which you've just coded is borked, so it doesn't lead to bugs, and 3) using $var, or more likely "$var" is a lot easier to type and read (eg: SRC_URI="ftp://ftp.archlinux.org/other/$PN/$PN-$PV.tar.gz" is roughly how kate or nano show it to me.)

Quoting is a much more important habit to get into (cf: /msg greybot quotes on irc.freenode.net)

I tend to use the last form, as string highlighting shows me immediately that this is one parameter to whichever command, which is the point of the whole thing: to avoid field splitting, or more generally to control precisely what gets passed as a parameter.

If you're not aware of POSIX Sh and utilities I highly recommend it, and sticking to the commands and options given there, as far as possible. (If you need to use sed -r, use sed -E instead, as both BSD and GNU support it [though GNU didn't document it, they have supported it for years], and it's been accepted for standardisation.)


Thanks for the suggestions. 8)

You basically say the doins expects a string, quite logic, yes.
Don't slap me, but I come from win/db development, and run since years linux at home.
I have just been very lazy do something productive on linux. :lol:

Yes, right, the elifs needed to go, you wrote the post while I also noticed it and already updated r3.
I spend the WE reading ebuild manuals and tested some stuff.
With r3, I'll start to test the crypt, mdadm and all combined on vbox.
I didn't have the time yet, I have just created 4 virtual hard discs for the raid.
But, I still try to figure out why the sysinit runlevel is not logged.
Would be nice to have that working before moving on to mdadm and crypt.

Is there a convenient way to upload the ebuild to some overlay?
I read to file a bug report is the way to go?

PS:
The devmanual needs to be updated.

Cleaned up r4:

Code:
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: mkinitcpio-0.8.8-r4 $
EAPI=3
inherit eutils linux-info

DESCRIPTION="Modular initramfs image creation utility ported from Arch Linux"
HOMEPAGE="http://www.archlinux.org/"
SRC_URI="ftp://ftp.archlinux.org/other/${PN}/${PN}-${PV}.tar.gz"

LICENSE="GPL"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 sh ~sparc ~x86"
IUSE="udev clvm cryptsetup mdadm pcmcia custom_kernel"
USE="udev clvm -cryptsetup -mdadm -pcmcia custom_kernel"

DEPEND=">=sys-apps/busybox-1.19.3-r1[static]
   app-arch/cpio
   >=sys-apps/util-linux-2.21
   >=sys-apps/kmod-7
   sys-apps/grep
   sys-apps/sed
   sys-apps/findutils
   app-shells/bash
   sys-apps/file
   app-arch/gzip
   sys-apps/coreutils
   app-arch/libarchive
   udev? ( sys-fs/udev )
   mdadm? ( sys-fs/mdadm[static] )
   cryptsetup? ( sys-fs/cryptsetup[static] )
   clvm? ( sys-fs/lvm2[static] )
   pcmcia? ( sys-apps/pcmciautils )"
RDEPEND="${DEPEND}"

pkg_setup() {

  if kernel_is -lt 2 6 32; then
      die "Sorry, your kernel must be 2.6.32-r103 or newer!"
  fi
  if linux_config_exists; then
      local CONFIG_CHECK #=""
     
      if use udev; then
     CONFIG_CHECK+=" ~DEVTMPFS"
      fi
   
      if use custom_kernel; then
     if use mdadm; then
       CONFIG_CHECK+=" ~MD ~MD_LINEAR ~MD_RAID0 \
             ~MD_RAID1 ~MD_RAID10 ~MD_RAID456"
     fi
   
     if use clvm; then
       CONFIG_CHECK+=" ~BLK_DEV_DM ~DM_SNAPSHOT \
             ~DM_MIRROR ~DM_RAID ~DM_UEVENT"
     fi
   
     if use cryptsetup; then
       CONFIG_CHECK+=" ~DM_CRYPT"
     fi
      fi
  fi   
     
   
   check_extra_config
}

src_prepare() {
   cd "${WORKDIR}/${P}/install"
   epatch "${FILESDIR}/${P}-base.patch"
   epatch "${FILESDIR}/${P}-consolefont.patch"
   epatch "${FILESDIR}/${P}-keymap.patch"
}

src_install() {

     if use udev; then
       insinto /usr/lib/initcpio/hooks/

       doins "${FILESDIR}/hooks/udev" || die "udev hook install failed"
    
       insinto /usr/lib/initcpio/install/
    
       doins "${FILESDIR}/install/udev" || die "udev install failed"
      
       insinto /usr/lib/initcpio/udev/
      
       doins "${FILESDIR}/udev/11-dm-initramfs.rules" || die "udev rule install failed"
     fi
    
     if use clvm; then
       insinto /usr/lib/initcpio/hooks/
      
       doins "${FILESDIR}/hooks/lvm2" || die"lvm2 hook install failed"
      
       insinto /usr/lib/initcpio/install/
      
       doins "${FILESDIR}/install/lvm2" || die "lvm2 install failed"
     fi
    
     if use mdadm; then
       insinto /usr/lib/initcpio/hooks/
      
       doins "${FILESDIR}/hooks/mdadm" || die "mdadm hook install failed"
       dosym /usr/lib/initcpio/hooks/mdadm /usr/lib/initcpio/hooks/raid
      
       insinto /usr/lib/initcpio/install/
      
       doins "${FILESDIR}/install/mdadm" || die "mdadm install failed"
       doins "${FILESDIR}/install/mdadm_udev" || die "mdadm_udev install failed"
     fi
    
     if use cryptsetup; then
       insinto /usr/lib/initcpio/hooks/
      
       doins "${FILESDIR}/hooks/encrypt" || die "encrypt hook install failed"
      
       insinto /usr/lib/initcpio/install/
      
       doins "${FILESDIR}/install/encrypt" || die "encrypt install failed"
    fi   
      
    if use pcmcia; then
       insinto /usr/lib/initcpio/install/

       doins "${FILESDIR}/install/pcmcia" || die "pcmcia install failed"   
   fi
   
   insinto /etc/mkinitcpio.d/
     doins "${FILESDIR}/preset/gentoo.preset" || die "gentoo.preset install failed"
   
   insinto /etc/modprobe.d/
     doins "${FILESDIR}/usb-load-ehci-first.conf" || die "usb-load-ehci-first install failed"
   
   emake DESTDIR="${D}" install || die "Install Failed"
}


Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Mon May 14, 2012 2:58 pm    Post subject: Reply with quote

I have been thinking about the presets and the separate /usr partition.

The best solution to me seems to possibly patch the gentoo-sources ebuild to install a preset with the kernel version.
This way, there wouldn't be the need for preset maintenance, as the preset would be set dynamically during install.
The other idea is to introduce a new use flag for gentoo-sources, say sep-usr or mkinit, which installs mkinitcpio if checked as optional dependency.

ebuild-r5 aims to provide nfs utils for mkinitcpio to make the package complete.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Mon May 14, 2012 6:17 pm    Post subject: Re: mkinitcpio-0.8.8-r3.ebuild Reply with quote

udeved wrote:
steveL wrote:

I tend to use the last form, as string highlighting shows me immediately that this is one parameter to whichever command, which is the point of the whole thing: to avoid field splitting, or more generally to control precisely what gets passed as a parameter.

You basically say the doins expects a string, quite logic, yes.

Not quite: all parameters and variables in shell are strings.

Any command which gets executed, is called with an array of strings, char *argv[] in C (akin to "$@", where argc=count same as $#). All a shell does is prepare the parameters for the command, expanding any variable-expansions and filename paths (including globbing). It also performs word-splitting on the result of any variable-expansion (formally known as parameter-expansion) which is not inside quotes: this last point is why you must always quote a parameter-expansion, unless you specifically want spaces to result in separate arguments. An example of the latter is CFLAGS from your make.conf.

Functions are called in the same way as external commands, with string arguments.
Quote:
But, I still try to figure out why the sysinit runlevel is not logged.
Would be nice to have that working before moving on to mdadm and crypt.

I'd post a separate question on this, first in #gentoo et al on irc, then on forums or gentoo-user mailing list.

Quote:
Is there a convenient way to upload the ebuild to some overlay?
I read to file a bug report is the way to go?

Yeah, /join #gentoo-sunrise to find about the best way to get things in. You'll need to file a bug for a new ebuild, which becomes maintainer-wanted and then can be added to sunrise overlay, where it gets quality control from gentoo devs before possible inclusion in main tree. You can also set up your own overlay at the same time, if you want: you'll always be using a local one in any case, to prepare new ebuilds.

Quote:
The devmanual needs to be updated.

How exactly? You'll need to file a bug report once you've formulated how it needs to change.

Quote:
Cleaned up r4:

Nice one :)
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Mon May 14, 2012 6:46 pm    Post subject: Re: mkinitcpio-0.8.8-r3.ebuild Reply with quote

steveL wrote:
udeved wrote:
steveL wrote:

I tend to use the last form, as string highlighting shows me immediately that this is one parameter to whichever command, which is the point of the whole thing: to avoid field splitting, or more generally to control precisely what gets passed as a parameter.

You basically say the doins expects a string, quite logic, yes.

Not quite: all parameters and variables in shell are strings.

Any command which gets executed, is called with an array of strings, char *argv[] in C (akin to "$@", where argc=count same as $#). All a shell does is prepare the parameters for the command, expanding any variable-expansions and filename paths (including globbing). It also performs word-splitting on the result of any variable-expansion (formally known as parameter-expansion) which is not inside quotes: this last point is why you must always quote a parameter-expansion, unless you specifically want spaces to result in separate arguments. An example of the latter is CFLAGS from your make.conf.
Functions are called in the same way as external commands, with string arguments.


Thats good info.
I have never done more than some simple media file conversion or splitting scripts or mounting stuff.


steveL wrote:

Yeah, /join #gentoo-sunrise to find about the best way to get things in. You'll need to file a bug for a new ebuild, which becomes maintainer-wanted and then can be added to sunrise overlay, where it gets quality control from gentoo devs before possible inclusion in main tree. You can also set up your own overlay at the same time, if you want: you'll always be using a local one in any case, to prepare new ebuilds.


Yes, some quality control would be a good thingy, reason to consider filing a bug report then..


steveL wrote:
How exactly? You'll need to file a bug report once you've formulated how it needs to change.


The image of the examples show doins without quotation marks. :wink:

I have encountered a strange problem with the mkinitcpio-nfs-utils addon ebuild.

The error message says that the tar.xz source package can't be unpacked, due to unknown tar format.
xz-utils are installed, and eapi is set to 3(or 4).

Code:
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: mkinitcpio-nfs-utils-0.3.ebuild $
EAPI=4
inherit eutils unpacker

DESCRIPTION="ipconfig and nfsmount tools for NFS root support in mkinitcpio ported from Arch Linux"
HOMEPAGE="http://www.archlinux.org/"
SRC_URI="ftp://ftp.archlinux.org/other/mkinitcpio/${PN}-${PV}.tar.xz"

LICENSE="GPL"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
USE=""

DEPEND="sys-libs/glibc
   >=sys-kernel/mkinitcpio-0.8.8-r5"
RDEPEND="${DEPEND}"

src_install() {

      emake DESTDIR="${D}" install || die "Install Failed"
}


Code:
* ERROR: sys-kernel/mkinitcpio-nfs-utils-0.3 failed (unpack phase):
 *   unpacking /var/tmp/portage/sys-kernel/mkinitcpio-nfs-utils-0.3/distdir/mkinitcpio-nfs-utils-0.3.tar.xz failed (comp=xz -dc arch=tar --no-same-owner -xof)
 *
 * Call stack:
 *               ebuild.sh, line   85:  Called src_unpack
 *             environment, line 2577:  Called unpacker_src_unpack
 *             environment, line 3168:  Called unpacker
 *             environment, line 3163:  Called _unpacker 'mkinitcpio-nfs-utils-0.3.tar.xz'
 *             environment, line  397:  Called assert 'unpacking /var/tmp/portage/sys-kernel/mkinitcpio-nfs-utils-0.3/distdir/mkinitcpio-nfs-utils-0.3.tar.xz failed (comp=xz -dc arch=tar --no-same-owner -xof)'
 *   isolated-functions.sh, line   14:  Called die
 * The specific snippet of code:
 *              [[ $x -eq 0 ]] || die "$@"
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Tue May 15, 2012 5:24 am    Post subject: Re: mkinitcpio-0.8.8-r3.ebuild Reply with quote

udeved wrote:
steveL wrote:
Not quite: all parameters and variables in shell are strings.
Any command which gets executed, is called with an array of strings
..
Functions are called in the same way as external commands, with string arguments.
..
How exactly? You'll need to file a bug report once you've formulated how it needs to change.

The image of the examples show doins without quotation marks. ;)

That doesn't matter: anything you type into shell or script is a string already. So:
Code:
doins extras/cdsymlinks.conf
calls doins with one (string) argument. It can't possibly be any more than one, since there's no whitespace, no parameter-expansion and no globbing characters (* ? or [..] sequence.)
Code:
newins "${FILESDIR}/udev.conf.post_050" udev.conf
calls newins with two arguments. The first contains a parameter expansion, so it is quoted. Again, while it's possible just to quote that part, it reads better if the entire argument is quoted.

Quote:
I have encountered a strange problem with the mkinitcpio-nfs-utils addon ebuild.

The error message says that the tar.xz source package can't be unpacked, due to unknown tar format.
xz-utils are installed, and eapi is set to 3(or 4).

That's odd. (I can't find xz-utils in deps for portage, but it's a dep of coreutils here, based on equery depends xz-utils.) I'd ask for help in #gentoo-dev-help
edit:
#gentoo-dev-help wrote:

<igli> if you're using a .tar.xz in SRC_URI in an EAPI-3+ ebuild, do you need to DEPEND on anything to get it to unpack?
<Zero_Chaos> no
<desultory> thus spake PMS http://dev.gentoo.org/~ulm/pms/4/pms.html#x1-142001r14

PMS says: "It is up to the ebuild to ensure that the relevant external utilities are available, whether by being in the system set or via dependencies." And since coreutils deps on it, that's not the issue (as you said, it's already installed.)
Back to top
View user's profile Send private message
SamuliSuominen
Retired Dev
Retired Dev


Joined: 30 Sep 2005
Posts: 2133
Location: Finland

PostPosted: Tue May 15, 2012 12:37 pm    Post subject: Re: mkinitcpio-0.8.8 gentoo port(modular initrd generation t Reply with quote

udeved wrote:
Code:
--- keymap   2012-05-11 02:53:50.575778240 +0200
+++ keymap.patched   2012-05-11 02:54:26.326776233 +0200
@@ -7,7 +7,7 @@
         l=$LANG
         unset LANG
 
-        for cfg in etc/{rc,vconsole,locale}.conf; do
+        for cfg in etc/env.d/02locale; do
             [[ -s $BASEDIR/$cfg ]] && . "$BASEDIR/$cfg"
         done
 



This is too fragile to be used for any real packaging because using 02locale is not mandatory, and you can setup these in, for example 01foobar.

What I mean to say is that it's just "Number ordering" and "Alphabetical ordering" and 02locale is just used as an *example* filename by the
localization guide, it doesn't mean everyone is using this particular file to setup their locales.

- Samuli
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Tue May 15, 2012 10:58 pm    Post subject: Re: mkinitcpio-0.8.8 gentoo port(modular initrd generation t Reply with quote

ssuominen wrote:
udeved wrote:
Code:
--- keymap   2012-05-11 02:53:50.575778240 +0200
+++ keymap.patched   2012-05-11 02:54:26.326776233 +0200
@@ -7,7 +7,7 @@
         l=$LANG
         unset LANG
 
-        for cfg in etc/{rc,vconsole,locale}.conf; do
+        for cfg in etc/env.d/02locale; do
             [[ -s $BASEDIR/$cfg ]] && . "$BASEDIR/$cfg"
         done
 



This is too fragile to be used for any real packaging because using 02locale is not mandatory, and you can setup these in, for example 01foobar.

What I mean to say is that it's just "Number ordering" and "Alphabetical ordering" and 02locale is just used as an *example* filename by the
localization guide, it doesn't mean everyone is using this particular file to setup their locales.

- Samuli


Thanks SteveL and ssuominen for the kind help.

mkinitcpio-0.8.8-r7

mkinitcpio-nfs-utils-0.3

StevelL, your great bash hints will follow in r8.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Wed May 16, 2012 2:50 am    Post subject: Re: mkinitcpio-0.8.8 gentoo port(modular initrd generation t Reply with quote

udeved wrote:
Thanks SteveL and ssuominen for the kind help.
..
StevelL, your great bash hints will follow in r8.

Aww, shucks, it's comments like that which keep people motivated to help you, and others. (yvw iow ;)
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Wed May 16, 2012 8:21 am    Post subject: Reply with quote

BTW udeved, take a look at this post wrt the device node issues you were having.
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Fri May 18, 2012 10:37 pm    Post subject: mkinitcpio-0.8.8-r8 Reply with quote

Code:
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: mkinitcpio-0.8.8-r8 $
EAPI=3
inherit eutils linux-info

DESCRIPTION="Modular initramfs image creation utility ported from Arch Linux"
HOMEPAGE="http://www.archlinux.org/"
SRC_URI="ftp://ftp.archlinux.org/other/${PN}/${PN}-${PV}.tar.gz"

LICENSE="GPL"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
IUSE="udev clvm cryptsetup mdadm pcmcia custom_kernel"
USE="udev clvm cryptsetup mdadm pcmcia custom_kernel"

MODULE_DEPEND="udev? ( sys-fs/udev )
         clvm? ( sys-fs/lvm2[static] )
         cryptsetup? ( sys-fs/cryptsetup[static] )
         mdadm? ( sys-fs/mdadm[static] )
         pcmcia? ( sys-apps/pcmciautils )"
        
DEPEND="${MODULE_DEPEND}
   app-shells/bash
   app-arch/cpio
   >=sys-apps/busybox-1.19.3-r1[static]
   sys-apps/coreutils
   sys-apps/findutils
   sys-apps/file
   sys-apps/grep
   >=sys-apps/kmod-7
   sys-apps/sed
   >=sys-apps/util-linux-2.21
   app-arch/gzip
   app-arch/libarchive"
   
RDEPEND="${DEPEND}"

pkg_setup() {

  if kernel_is -lt 2 6 32; then
      die "Sorry, your kernel must be 2.6.32-r103 or newer!"
  fi
  if linux_config_exists; then
      local CONFIG_CHECK #=""
     
      if use udev; then
     CONFIG_CHECK+=" ~DEVTMPFS"
      fi
   
      if use custom_kernel; then
     if use mdadm; then
       CONFIG_CHECK+=" ~MD ~MD_LINEAR ~MD_RAID0 \
             ~MD_RAID1 ~MD_RAID10 ~MD_RAID456"
     fi
   
     if use clvm; then
       CONFIG_CHECK+=" ~BLK_DEV_DM ~DM_SNAPSHOT \
             ~DM_MIRROR ~DM_RAID ~DM_UEVENT"
     fi
   
     if use cryptsetup; then
       CONFIG_CHECK+=" ~DM_CRYPT"
     fi
      fi
  fi   
     
   
   check_extra_config
}

src_prepare() {
   cd "${WORKDIR}/${P}/install"
   epatch "${FILESDIR}/${P}-base.patch"
   epatch "${FILESDIR}/${P}-consolefont.patch"
   epatch "${FILESDIR}/${P}-keymap.patch"
   cd "${WORKDIR}/${P}"
   epatch "${FILESDIR}/${P}-functions.patch"
}

src_install() {

     if use udev; then
       insinto /usr/lib/initcpio/hooks/

       doins "${FILESDIR}/hooks/udev" || die "udev hook install failed"
    
       insinto /usr/lib/initcpio/install/
    
       doins "${FILESDIR}/install/udev" || die "udev install failed"
      
       insinto /usr/lib/initcpio/udev/
      
       doins "${FILESDIR}/udev/11-dm-initramfs.rules" || die "udev rule install failed"
     fi
    
     if use clvm; then
       insinto /usr/lib/initcpio/hooks/
      
       doins "${FILESDIR}/hooks/lvm2" || die"lvm2 hook install failed"
      
       insinto /usr/lib/initcpio/install/
      
       doins "${FILESDIR}/install/lvm2" || die "lvm2 install failed"
     fi
    
     if use mdadm; then
       insinto /usr/lib/initcpio/hooks/
      
       doins "${FILESDIR}/hooks/mdadm" || die "mdadm hook install failed"
       dosym /usr/lib/initcpio/hooks/mdadm /usr/lib/initcpio/hooks/raid
      
       insinto /usr/lib/initcpio/install/
      
       doins "${FILESDIR}/install/mdadm" || die "mdadm install failed"
       doins "${FILESDIR}/install/mdadm_udev" || die "mdadm_udev install failed"
     fi
    
     if use cryptsetup; then
       insinto /usr/lib/initcpio/hooks/
      
       doins "${FILESDIR}/hooks/encrypt" || die "encrypt hook install failed"
      
       insinto /usr/lib/initcpio/install/
      
       doins "${FILESDIR}/install/encrypt" || die "encrypt install failed"
    fi   
      
    if use pcmcia; then
       insinto /usr/lib/initcpio/install/

       doins "${FILESDIR}/install/pcmcia" || die "pcmcia install failed"   
   fi
   
   insinto /etc/mkinitcpio.d/
     newins "${FILESDIR}/preset/gentoo.preset" "${KV}.preset" || die "${KV}.preset install failed"
   
   insinto /etc/modprobe.d/
     doins "${FILESDIR}/usb-load-ehci-first.conf" || die "usb-load-ehci-first install failed"
   
   emake DESTDIR="${D}" install || die "Install Failed"
}

pkg_postinst() {
      sed -i "s/KV/${KV}/g" "/etc/mkinitcpio.d/${KV}.preset" || die "preset ${KV} failed"
     
      elog "Set your hooks in /etc/mkinitcpio.conf"
}


Something with the static use flags is not right, and produces some error if doing emerge --depclean asking for bdeps

I'll have a ask on irc.
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Fri Jun 01, 2012 3:18 pm    Post subject: New version: mkinitcpio-0.9.0-r1 Reply with quote

New version:

mkinitcpio-0.9.0-r1.ebuild

Code:
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: mkinitcpio-0.9.0-r1 $

EAPI=3
inherit eutils linux-info

DESCRIPTION="Modular initramfs image creation utility ported from Arch Linux"
HOMEPAGE="http://www.archlinux.org/"
LICENSE="GPL"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"

IUSE="udev device-mapper cryptsetup mdadm pcmcia custom_kernel"

PKG_ARCH="x86_64"
PKG_EXT="pkg.tar.xz"

PN_UDEV="udev-182-4"
PN_CS="cryptsetup-1.4.2-1"
PN_DM="device-mapper-2.02.95-4"
PN_LVM="lvm2-2.02.95-4"
PN_MDADM="mdadm-3.2.5-2"
PN_PCMCIA="pcmciautils-018-4"

URI_CORE="ftp://ftp.archlinux.org/core/os/${PKG_ARCH}"

URI_UDEV="${URI_CORE}/${PN_UDEV}-${PKG_ARCH}.${PKG_EXT}"
URI_CS="${URI_CORE}/${PN_CS}-${PKG_ARCH}.${PKG_EXT}"
URI_DM="${URI_CORE}/${PN_DM}-${PKG_ARCH}.${PKG_EXT}"
URI_LVM="${URI_CORE}/${PN_LVM}-${PKG_ARCH}.${PKG_EXT}"
URI_MDADM="${URI_CORE}/${PN_MDADM}-${PKG_ARCH}.${PKG_EXT}"
URI_PCMCIA="${URI_CORE}/${PN_PCMCIA}-${PKG_ARCH}.${PKG_EXT}"

MODULES_URI="udev? ( ${URI_UDEV} )
        device-mapper? ( ${URI_DM} ${URI_LVM} )
        cryptsetup? ( ${URI_CS} )
        mdadm? ( ${URI_MDADM} )
        pcmcia? ( ${URI_PCMCIA} )"

SRC_URI="ftp://ftp.archlinux.org/other/${PN}/${PN}-${PV}.tar.gz ${MODULES_URI}"

MODULE_DEPEND="udev? ( sys-fs/udev )
          device-mapper? ( sys-fs/lvm2[static] )
          cryptsetup? ( sys-fs/cryptsetup[static] )
          mdadm? ( sys-fs/mdadm[static] )
          pcmcia? ( sys-apps/pcmciautils[static] )"
        
DEPEND="${MODULE_DEPEND}
   app-shells/bash
   app-arch/cpio
   >=sys-apps/busybox-1.19.3-r1[static]
   sys-apps/coreutils
   sys-apps/findutils
   sys-apps/file
   sys-apps/grep
   >=sys-apps/kmod-7
   sys-apps/sed
   >=sys-apps/util-linux-2.21
   app-arch/gzip
   app-arch/libarchive"
   
RDEPEND="${DEPEND}"

HOOK_DIR="/usr/lib/initcpio/hooks/"   
INST_DIR="/usr/lib/initcpio/install/"   

HOOK_UDEV="udev"
HOOK_DM="lvm2"
HOOK_MDADM="mdadm"
HOOK_CS="encrypt"

INST_UDEV="udev"
INST_DM="lvm2"
INST_MDADM="mdadm"
INST_MDADM_UDEV="mdadm_udev"
INST_CS="encrypt"
INST_PCMCIA="pcmcia"

UDEV_DIR="/usr/lib/initcpio/udev/"

UDEV_RULE="11-dm-initramfs.rules"

PRESET_DIR="/etc/mkinitcpio.d/"

MODPROBE_DIR="/etc/modprobe.d/"

pkg_setup() {

  if kernel_is -lt 2 6 32; then
      die "Sorry, your kernel must be 2.6.32-r103 or newer!"
  fi
  if linux_config_exists; then
      local CONFIG_CHECK #=""
     
      if use udev; then
     CONFIG_CHECK+=" ~DEVTMPFS"
      fi
   
      if use custom_kernel; then
     if use mdadm; then
       CONFIG_CHECK+=" ~MD ~MD_LINEAR ~MD_RAID0 \
             ~MD_RAID1 ~MD_RAID10 ~MD_RAID456"
     fi
   
     if use device-mapper; then
       CONFIG_CHECK+=" ~BLK_DEV_DM ~DM_SNAPSHOT \
             ~DM_MIRROR ~DM_RAID ~DM_UEVENT"
     fi
   
     if use cryptsetup; then
       CONFIG_CHECK+=" ~DM_CRYPT"
     fi
      fi
  fi   
     
   
   check_extra_config
}

src_prepare() {
   
   cd "${S}/install"
   
   epatch "${FILESDIR}/${PN}-base-install.patch"
   epatch "${FILESDIR}/${PN}-consolefont-install.patch"
   epatch "${FILESDIR}/${PN}-keymap-install.patch"
   
   if use udev; then
   
     cd "${WORKDIR}${INST_DIR}"
     epatch "${FILESDIR}/${PN}-udev-install.patch"
    
     cd "${WORKDIR}${HOOK_DIR}"
     epatch "${FILESDIR}/${PN}-udev-hook.patch"
   
   fi
   
   if use device-mapper; then
   
     cd "${WORKDIR}${INST_DIR}"
     epatch "${FILESDIR}/${PN}-lvm2-install.patch"
    
   fi
   
   if use mdadm; then
   
     cd "${WORKDIR}${INST_DIR}"
     epatch "${FILESDIR}/${PN}-mdadm_udev-install.patch"
    
   fi
   
   if use pcmcia; then
   
     cd "${WORKDIR}${INST_DIR}"
     epatch "${FILESDIR}/${PN}-pcmcia-install.patch"
    
   fi
   
   if use cryptsetup; then
   
     cd "${WORKDIR}${INST_DIR}"
     epatch "${FILESDIR}/${PN}-encrypt-install.patch"
    
   fi
   
   cd "${S}"
   epatch "${FILESDIR}/${PN}-functions.patch"
}

src_install() {

      if use udev; then

      insinto "${HOOK_DIR}"
            
      doins "${WORKDIR}${HOOK_DIR}${HOOK_UDEV}"
    
      insinto "${INST_DIR}"
    
      doins "${WORKDIR}${INST_DIR}${INST_UDEV}"
      
    fi
    
    if use device-mapper; then
   
      insinto "${HOOK_DIR}"
      
      doins "${WORKDIR}${HOOK_DIR}${HOOK_DM}"
      
      insinto "${INST_DIR}"
      
      doins "${WORKDIR}${INST_DIR}${INST_DM}"
      
       if use udev; then
      
         insinto "${UDEV_DIR}"
      
         doins "${WORKDIR}${UDEV_DIR}${UDEV_RULE}"
      
       fi
          
     fi
    
     if use mdadm; then
    
       insinto "${HOOK_DIR}"
      
       doins "${WORKDIR}${HOOK_DIR}${HOOK_MDADM}"
       dosym "${WORKDIR}${HOOK_DIR}${HOOK_MDADM}" "${HOOK_DIR}/raid"
      
       insinto "${INST_DIR}"
      
       doins "${WORKDIR}${INST_DIR}${INST_MDADM}"
       doins "${WORKDIR}${INST_DIR}${INST_MDADM_UDEV}"
     fi
    
     if use cryptsetup; then
    
       insinto "${HOOK_DIR}"
      
       doins "${WORKDIR}${HOOK_DIR}${HOOK_CS}"
      
       insinto "${INST_DIR}"
      
       doins "${WORKDIR}${INST_DIR}${INST_CS}"
    fi   
      
    if use pcmcia; then
   
       insinto "${INST_DIR}"

       doins "${WORKDIR}${INST_DIR}${INST_PCMCIA}"   
   fi
   
   insinto "${PRESET_DIR}"
   
     newins "${FILESDIR}/preset/gentoo.preset" "${KV}.preset"
   
   insinto "${MODPROBE_DIR}"
   
     doins "${FILESDIR}/modprobe.d/usb-load-ehci-first.conf"
   
   emake DESTDIR="${D}" install
   
}

pkg_postinst() {

      sed -i "s/KV/${KV}/g" "${PRESET_DIR}${KV}.preset"

      echo
      ewarn "Set your hooks in /etc/mkinitcpio.conf accordingly!"
      ewarn "Missing hooks can lead to an unbootanle system!"
      echo
}



Todo: sysinit logging, still no success

Changes: see Changelog
Back to top
View user's profile Send private message
himpierre
l33t
l33t


Joined: 31 Aug 2002
Posts: 867
Location: Berlin

PostPosted: Sat Jun 30, 2012 7:07 am    Post subject: Reply with quote

Hello.

Thanks for the work. But i seem to miss the mdadm hook . Is this hook still included?

Also the 0.9 ebuild cant find the sources to download.

cheers
Back to top
View user's profile Send private message
yngwin
Retired Dev
Retired Dev


Joined: 19 Dec 2002
Posts: 4572
Location: Suzhou, China

PostPosted: Sun Jul 01, 2012 5:58 am    Post subject: Reply with quote

Please consider adding documentation about this to the Gentoo Wiki and submitting your ebuild to Sunrise overlay.
_________________
"Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Sun Jul 01, 2012 3:24 pm    Post subject: Reply with quote

himpierre wrote:
Hello.

Thanks for the work. But i seem to miss the mdadm hook . Is this hook still included?

Also the 0.9 ebuild cant find the sources to download.

cheers


I have an updated ebuild for version 0.9.2.
The sources are unavailable, since arch linux is a rolling release distro, meaning new versions almost every day.

The best would be to create a git ebuild in the near future.

As for mdadm, it is included with the mdadm useflag.

I'll upload the new version soon, it will also support plymouth and dmraid.

You can temporaily fix the unavailable source with replacing the version string from this site:
ftp://ftp.archlinux.org/core/os/x86_64/

and do a eg:

Code:
ebuild mkinitcpio-0.9.0.ebuild digest


yngwin wrote:
Please consider adding documentation about this to the Gentoo Wiki and submitting your ebuild to Sunrise overlay.


I already considered that, and I will do it once the last issue with sysinit boot logging is resolved hopefully.

Edit:

mkinitcpio-0.9.2.ebuild

version 0.9.2-r1 souldn't be installed at the moment, because I thought about making the plymouth hook a standalone package with mkinitcpio dependency like nfs module.
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Tue Jul 03, 2012 11:17 am    Post subject: Reply with quote

http://wiki.gentoo.org/wiki/Mkinitcpio

mkinitcpio-0.9.2 is now in the main portage tree,
Back to top
View user's profile Send private message
miroR
l33t
l33t


Joined: 05 Mar 2008
Posts: 826

PostPosted: Thu Sep 20, 2012 2:46 am    Post subject: Reply with quote

Code:
# emerge -avtuDN mkinitcpio

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
[ebuild  N     ] sys-kernel/mkinitcpio-0.9.2-r1  USE="device-mapper mdadm udev -cryptsetup -dmraid -pcmcia" 0 kB

...
Code:
install -m644 bash-completion /dev/shm/portage/sys-kernel/mkinitcpio-0.9.2-r1/image//usr/share/bash-completion/completions/mkinitcpio
ln -s mkinitcpio /dev/shm/portage/sys-kernel/mkinitcpio-0.9.2-r1/image//usr/share/bash-completion/completions/lsinitcpio
install: cannot stat ‘install/{mdadm}’: No such file or directory
!!! doins: install/{mdadm} does not exist
install: cannot stat ‘install/{mdadm_udev}’: No such file or directory
!!! doins: install/{mdadm_udev} does not exist
 * ERROR: sys-kernel/mkinitcpio-0.9.2-r1 failed (install phase):
 *   doins failed
 *

...
What am I missing?
emerge --info '=sys-kernel/mkinitcpio-0.9.2-r1':
http://pastebin.com/fmrzWSBp
emerge -pqv '=sys-kernel/mkinitcpio-0.9.2-r1':
Code:
# emerge -pqv '=sys-kernel/mkinitcpio-0.9.2-r1'
[ebuild  N    ] sys-kernel/mkinitcpio-0.9.2-r1  USE="device-mapper mdadm udev -cryptsetup -dmraid -pcmcia"
#

/dev/shm/portage/sys-kernel/mkinitcpio-0.9.2-r1/temp/build.log:
http://pastebin.com/ZfW8WYrn
/dev/shm/portage/sys-kernel/mkinitcpio-0.9.2-r1/temp/environment:
http://pastebin.com/wefGvJnS
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Thu Sep 20, 2012 9:40 am    Post subject: Reply with quote

miroR wrote:
Code:
# emerge -avtuDN mkinitcpio

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
[ebuild  N     ] sys-kernel/mkinitcpio-0.9.2-r1  USE="device-mapper mdadm udev -cryptsetup -dmraid -pcmcia" 0 kB

...
Code:
install -m644 bash-completion /dev/shm/portage/sys-kernel/mkinitcpio-0.9.2-r1/image//usr/share/bash-completion/completions/mkinitcpio
ln -s mkinitcpio /dev/shm/portage/sys-kernel/mkinitcpio-0.9.2-r1/image//usr/share/bash-completion/completions/lsinitcpio
install: cannot stat ‘install/{mdadm}’: No such file or directory
!!! doins: install/{mdadm} does not exist
install: cannot stat ‘install/{mdadm_udev}’: No such file or directory
!!! doins: install/{mdadm_udev} does not exist
 * ERROR: sys-kernel/mkinitcpio-0.9.2-r1 failed (install phase):
 *   doins failed
 *

...
What am I missing?
emerge --info '=sys-kernel/mkinitcpio-0.9.2-r1':
http://pastebin.com/fmrzWSBp
emerge -pqv '=sys-kernel/mkinitcpio-0.9.2-r1':
Code:
# emerge -pqv '=sys-kernel/mkinitcpio-0.9.2-r1'
[ebuild  N    ] sys-kernel/mkinitcpio-0.9.2-r1  USE="device-mapper mdadm udev -cryptsetup -dmraid -pcmcia"
#

/dev/shm/portage/sys-kernel/mkinitcpio-0.9.2-r1/temp/build.log:
http://pastebin.com/ZfW8WYrn
/dev/shm/portage/sys-kernel/mkinitcpio-0.9.2-r1/temp/environment:
http://pastebin.com/wefGvJnS


Off the top of my head, version 0.9.2-r1 contains a bug, which was introduced with this version and the mdadm use flag.

Try find the doins line for mdadm in the install routine and correct it to:

Code:
   use mdadm && doins install/{mdadm,mdadm_udev}


If it works, please file a bug report.




XMW, please fix back to this. :)
Back to top
View user's profile Send private message
miroR
l33t
l33t


Joined: 05 Mar 2008
Posts: 826

PostPosted: Thu Sep 20, 2012 1:20 pm    Post subject: Reply with quote

udeved wrote:
miroR wrote:
...
Code:

install: cannot stat ‘install/{mdadm}’: No such file or directory
!!! doins: install/{mdadm} does not exist
install: cannot stat ‘install/{mdadm_udev}’: No such file or directory
!!! doins: install/{mdadm_udev} does not exist
 * ERROR: sys-kernel/mkinitcpio-0.9.2-r1 failed (install phase):
 *   doins failed
 *

...
What am I missing?
...


Off the top of my head, version 0.9.2-r1 contains a bug, which was introduced with this version and the mdadm use flag.

Try find the doins line for mdadm in the install routine and correct it to:

Code:
   use mdadm && doins install/{mdadm,mdadm_udev}


If it works, please file a bug report.




XMW, please fix back to this. :)

That worked, mkinitcpio, with that exact change in ebuild, installed, and I am in the process of filing a bug.
Thanks, udeved. I was already in the process of filing a bug, as I realized, only too late, I should have filed it all in bug.gentoo.org instead of here, but wasn't well. So now doing it.
EDIT Bug filed:
https://bugs.gentoo.org/show_bug.cgi?id=435642
Back to top
View user's profile Send private message
miroR
l33t
l33t


Joined: 05 Mar 2008
Posts: 826

PostPosted: Sat Sep 22, 2012 2:53 pm    Post subject: Reply with quote

I'm trying to move/upgrade my installation onto a raid/lvm2 setup.
All the filesystem is there.
I have tried the other approach:
https://forums.gentoo.org/viewtopic-t-920644-postdays-0-postorder-asc-start-25.html#7145606
I might still go back there.
But I was wondering if mkinitcpio could make it for me instead.
Trying it, and, mind that I am no expert, so if my question is not to the point, take my word that I have tried my best to understand the matter.
It looks to me that a lot in the setup should be changed with this program to get it to work on Gentoo, and not just user's configuration stuff, but rather programmer's changing of files in:
Code:
 /usr/lib/initcpio/install

and
Code:
/usr/lib/initcpio/hooks

Is that at all feasible for a non-programmer like me?
Esp. since I have to install the initramfs-my-kernel.img from a not yet bootable new setup installation I mentioned above.
Here's one of my tries, surely from sysresccd chrooted environment:
Code:
sysresccd / # mkinitcpio  -k /boot/vmlinuz-3.5.4-hardened-r1-120922_0600 -g /boot/initramfs-3.5.4-hardened-r1-120922_0600.img -s
==> Starting build: 3.5.4-hardened-r1-120922_0600
  -> Running build hook: [base]
  -> Running build hook: [udev]
==> ERROR: file not found: `/lib/udev/udevd'
==> ERROR: file not found: `/lib/udev/rules.d/50-udev-default.rules'
==> ERROR: file not found: `/lib/udev/rules.d/60-persistent-storage.rules'
==> ERROR: file not found: `/lib/udev/rules.d/80-drivers.rules'
==> ERROR: file not found: `/lib/udev/ata_id'
==> ERROR: file not found: `/lib/udev/scsi_id'
  -> Running build hook: [autodetect]
  -> Running build hook: [mdadm]
Custom /etc/mdadm.conf file will be used in initramfs for assembling arrays.
  -> Running build hook: [mdadm_udev]
Custom /etc/mdadm.conf file will be used in initramfs for assembling arrays.
  -> Running build hook: [lvm2]
==> ERROR: module not found: `dm-mod'
==> ERROR: module not found: `dm-snapshot'
==> ERROR: module not found: `dm-mirror'
==> ERROR: binary dependency `libudev.so.13' not found for `/sbin/lvm'
==> ERROR: binary dependency `libudev.so.13' not found for `/sbin/lvm'
==> ERROR: binary dependency `libudev.so.13' not found for `/sbin/dmsetup'
  -> Running build hook: [pata]
  -> Running build hook: [scsi]
  -> Running build hook: [sata]
  -> Running build hook: [filesystems]
  -> Running build hook: [usbinput]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip initcpio image: /boot/initramfs-3.5.4-hardened-r1-120922_0600.img
bsdcpio: Failed to set default locale
==> WARNING: errors were encountered during the build. The image may not be complete.
==> build directory saved in /tmp/mkinitcpio.ZrEPTB
sysresccd / #


I noted that at installation (before udeved who ported this for us from Arch-gnu-Linux found the bug upon my reporting failed installation here i this thread, I noted that at that failed installation mkinitcpio compiained that it was missing
Code:
CONFIG_MD_LINEAR
CONFIG_DM_UEVENT

and I don't think I need those (or do I? mind my insuffuciency if I misunderstand something here; LINEAR is for appending raid devices, not that, but UEVENT, I don't know really, little documented in kernel at `make menuconfig`)...
Today, before reinstalling mkinitcpio with the new kernel, I left those two unchecked when configuring and installing the kernel, and it is *not* a requirement, mkinitcpio did install, only mentioned those were not there.

Also, these rules:
Code:
/lib/udev/rules.d/50-udev-default.rules
/lib/udev/rules.d/60-persistent-storage.rules
/lib/udev/rules.d/80-drivers.rules

surely couldn't have been found IIUC, because they are not part of Gentoo installation, IIUC...
I was able to find, at the line 10 in
/usr/lib/initcpio/install/udev
Code:
    for rules in 50-udev-default.rules 60-persistent-storage.rules 80-drivers.rules; do
        add_file "/lib/udev/rules.d/$rules"
    done

and how does a user pronto become a programmer to apply the necessary changes there?
Else, it looks like a mean and lean programme, mkinitcpio. And maybe not much wor for a programmer to sort these issues...
Back to top
View user's profile Send private message
zoltak
n00b
n00b


Joined: 01 Mar 2005
Posts: 40

PostPosted: Wed Oct 03, 2012 12:55 pm    Post subject: CONFIG_SYSFS_DEPRECATED disabled? Reply with quote

Hi,

I was having a issue where /dev/disks/by-path was not being created by udev.

Using genkernel I disabled CONFIG_SYSFS_DEPRECATED_V2 and CONFIG_SYSFS_DEPRECATED in the kernel configuration and rebuilt the kernel and regenerated the ramdisk.

This solved the issue! Upon the net reboot /dev/disk/by-path appeared!!

Not sure if this will solve your problem but I thought it was worth mentioning.

Regards,
Zoltak
Back to top
View user's profile Send private message
miroR
l33t
l33t


Joined: 05 Mar 2008
Posts: 826

PostPosted: Fri Oct 26, 2012 5:44 pm    Post subject: Reply with quote

zoltak wrote:
Hi,

I was having a issue where /dev/disks/by-path was not being created by udev.

Using genkernel I disabled CONFIG_SYSFS_DEPRECATED_V2 and
CONFIG_SYSFS_DEPRECATED in the kernel configuration and rebuilt the kernel and regenerated the ramdisk.


Not using genkernel (although to achieve some feats it is sometimes necessary for non-experts like me)...
That option is disabled in my home-made grsecurity/pax harderned kernel, though.

zoltak wrote:
This solved the issue! Upon the net reboot /dev/disk/by-path appeared!!

Not sure if this will solve your problem but I thought it was worth mentioning.

Regards,
Zoltak

Thanx for caring. Sorry for late reply, I was away in all this time.

But, I was thinking, did you really managed to put mkinitcpio to real use?
Other people reported threy couldn't either, such as:
https://forums.gentoo.org/viewtopic-t-920644-start-25.html#7157164
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum