From: Michael Tremer Date: Thu, 29 Jul 2010 10:09:12 +0000 (+0200) Subject: Merge branch 'master' into dracut X-Git-Tag: v2.9-beta1~48^2~5^2~2^2~141 X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff_plain;h=953d72838a35b10983e260c4d5421e3b22498372;hp=f824c939b9e23597a706fcaa328876b76e391f82 Merge branch 'master' into dracut --- diff --git a/config/install/rc b/config/install/rc index dd1fc1d4a4..ba1da5e5cd 100644 --- a/config/install/rc +++ b/config/install/rc @@ -38,13 +38,13 @@ modprobe libata echo "Starting udev daemon" /sbin/udevd --daemon -/sbin/udevtrigger -/sbin/udevsettle +/sbin/udevadm trigger +/sbin/udevadm settle sleep 3 for file in /dev/.udev/failed/*/uevent ; do echo "add" >"${file}" done 2>/dev/null -/sbin/udevsettle +/sbin/udevadm settle echo "Loading Installer..." diff --git a/config/mkinitcpio/load-modules.sh b/config/mkinitcpio/load-modules.sh deleted file mode 100644 index 33f8b6b1d5..0000000000 --- a/config/mkinitcpio/load-modules.sh +++ /dev/null @@ -1,32 +0,0 @@ -#! /bin/sh -# Implement blacklisting for udev-loaded modules -# Includes module checking -# - Aaron Griffin & Tobias Powalowski for Archlinux -[ $# -ne 1 ] && exit 1 - -if [ -f /proc/cmdline ]; then - for cmd in $(cat /proc/cmdline); do - case $cmd in - *=*) eval $cmd ;; - esac - done -fi - -# get the real names from modaliases -i="$(/bin/modprobe -i --show-depends $1 | minised "s#^insmod /lib.*/\(.*\)\.ko.*#\1#g" | minised 's|-|_|g')" -# add disablemodules= from commandline to blacklist -k="$(echo ${disablemodules} | minised 's|-|_|g' | minised 's|,| |g')" - -if [ "${k}" != "" ] ; then - for o in ${k}; do - echo "${o}.ko" >> /disablemodules - done - for n in ${i}; do - if /bin/ugrep "^$n.ko" /disablemodules 2>&1 >/dev/null; then - exit 1 - fi - done -fi -/bin/modprobe $1 - -# vim: set et ts=4: diff --git a/config/mkinitcpio/start_udev b/config/mkinitcpio/start_udev deleted file mode 100644 index 44e3272e88..0000000000 --- a/config/mkinitcpio/start_udev +++ /dev/null @@ -1,115 +0,0 @@ -#! /bin/sh -# -# start_udev -# script to initialize /dev by using udev. -# -# Modified for Archlinux by Tobias Powalowski -# -# Inspired by: -# -# Copyright (C) 2004 Greg Kroah-Hartman -# -# Released under the GPL v2 only. -# -# This needs to be run at the earliest possible point in the boot -# process. -# -# Based on the udev init.d script -# -# Thanks go out to the Gentoo developers for proving -# that this is possible to do. -# -# Yes, it's very verbose, feel free to turn off all of the echo calls, -# they were there to make me feel better that everything was working -# properly during development... - -prog=udev -sysfs_dir=/sys -bin=/sbin/udev -udevd=/sbin/udevd -udev_root="/dev" - -trigger_device_events () -{ - /sbin/udevtrigger -} - -wait_for_queue () -{ - # disabled because it hangs network boot - #loop=20 - #while ! [ "$loop" -gt 0 -a -d /dev/.udev/queue ]; do - # sleep 0.1; - # loop=$(($loop - 1)) - #done - /sbin/udevsettle -} - -make_extra_nodes () -{ - # there are a few things that sysfs does not export for us. - # these things go here (and remember to remove them in - # remove_extra_nodes() - # - # Thanks to Gentoo for the initial list of these. - ln -sf /proc/self/fd $udev_root/fd - ln -sf /proc/self/fd/0 $udev_root/stdin - ln -sf /proc/self/fd/1 $udev_root/stdout - ln -sf /proc/self/fd/2 $udev_root/stderr - ln -sf /proc/kcore $udev_root/core -} - -udev_init () -{ -# don't use udev if sysfs is not mounted. -if [ ! -d $sysfs_dir/block ]; then - exit 1 -fi - -#echo "mounting... ramfs at $udev_root" -mount -t ramfs none $udev_root - -# propogate /udev from /sys -#echo "Creating initial udev device nodes:" - -#echo "making extra nodes" -make_extra_nodes - -# check if udevd is already running -#echo "start udev daemon" -/sbin/udevd --daemon - -case "$(uname -r)" in - 2.6.[0-9]|2.6.[0-9][!0-9]*) ;; - *) if [ -f "/sys/class/tty/console/uevent" ]; then - #echo "Kernel >= 2.6.15 and supports uevents" - # trigger the sorted events - echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug - # catch events that are real fast - mkdir -p /dev/.udev/queue - else - # for older kernels without uevents will be removed when udevstart dies in udev - echo "Kernel does not support uevents, you need a kernel >= 2.6.15!" - exit 1 - fi - ;; -esac -} - -udev_uevents () -{ -# configure all devices -trigger_device_events -# until we know how to do better, just wait for _all_ events to finish -wait_for_queue -} - -if [ $# -eq 0 ]; then -udev_init -udev_uevents -fi - -[ "$1" = "init" ] && udev_init -[ "$1" = "uevents" ] && udev_uevents - -exit 0 diff --git a/config/mkinitcpio/udev.rules b/config/mkinitcpio/udev.rules deleted file mode 100644 index 939a94631a..0000000000 --- a/config/mkinitcpio/udev.rules +++ /dev/null @@ -1,71 +0,0 @@ -# Udev rules for Archlinux by Tobias Powalowski -# -# This ruleset should provide a DevFS-compatible device tree. -# -# There are a number of modifiers that are allowed to be used in some -# of the different fields. They provide the following subsitutions: -# -# %n the "kernel number" of the device. -# For example, 'sda3' has a "kernel number" of '3' -# %k the kernel name for the device. -# %M the kernel major number for the device -# %m the kernel minor number for the device -# %b the bus id for the device -# %c the string returned by the PROGRAM -# %s{filename} the content of a sysfs attribute. -# %% the '%' char itself. -# -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# global stuff -# - -##################################### -# Early rules - begin -##################################### -# wait for sysfs -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" - -##################################### -# Early rules -end -##################################### - -##################################### -###### Hotplug rules - begin -##################################### -# check if the device has already been claimed by a driver -ENV{PHYSDEVDRIVER}=="?*", GOTO="hotplug_driver_loaded" - -# Modaliases to load -ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/lib/udev/load-modules.sh $env{MODALIAS}" -# SCSI addon modules -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[07]", RUN+="/lib/udev/load-modules.sh sd_mod" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="14", RUN+="/lib/udev/load-modules.sh sd_mod" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[45]", RUN+="/lib/udev/load-modules.sh sr_mod" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}=="Onstream", SYSFS{model}!="ADR*", RUN+="/lib/udev/load-modules.sh osst" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}=="Onstream", SYSFS{model}=="ADR*", RUN+="/lib/udev/load-modules.sh st" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}!="Onstream", RUN+="/lib/udev/load-modules.sh st" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[23689]", RUN+="/lib/udev/load-modules.sh sg" - -LABEL="hotplug_driver_loaded" - -# FIRMWARE -ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="?*", RUN+="/lib/udev/firmware.sh" -##################################### -##### Hotplug rules - end -##################################### - -##################################### -###### CD/DVD symlinks - begin -##################################### -ACTION=="add", BUS=="ide", KERNEL=="hd[a-z]", IMPORT="/lib/udev/cdrom_id --export $tempnode" -ACTION=="add", BUS=="scsi", KERNEL=="sr[0-9]*", IMPORT="/lib/udev/cdrom_id --export $tempnode" -ACTION=="add", BUS=="scsi", KERNEL=="scd[a-z]", IMPORT="/lib/udev/cdrom_id --export $tempnode" -ENV{ID_CDROM}=="?*", SYMLINK+="cd/cdrom-%b" -ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cd/cdrw-%b" -ENV{ID_CDROM_DVD}=="?*", SYMLINK+="cd/dvd-%b" -ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="cd/dvd-%b" -##################################### -###### CD/DVD symlinks - end -##################################### diff --git a/config/mkinitcpio/udev_hook b/config/mkinitcpio/udev_hook deleted file mode 100644 index fc4c8144a5..0000000000 --- a/config/mkinitcpio/udev_hook +++ /dev/null @@ -1,7 +0,0 @@ -# vim: set ft=sh: -run_hook () -{ - msg -n ":: Loading udev..." - /etc/start_udev - msg "done." -} diff --git a/config/mkinitcpio/udev_install b/config/mkinitcpio/udev_install deleted file mode 100644 index 473956ab8c..0000000000 --- a/config/mkinitcpio/udev_install +++ /dev/null @@ -1,26 +0,0 @@ -# vim:set ft=sh: - -install () -{ - MODULES="" - BINARIES="" - FILES=" /etc/udev/udev.conf" - SCRIPT="udev" - add_file /lib/initcpio/udev/udevd /sbin/udevd - add_file /lib/initcpio/udev/udevtrigger /sbin/udevtrigger - add_file /lib/initcpio/udev/udevsettle /sbin/udevsettle - add_file /lib/initcpio/udev/udev.rules /etc/udev/rules.d/udev.rules - add_file /lib/initcpio/udev/start_udev /etc/start_udev - add_file /lib/initcpio/udev/firmware.sh /lib/udev/firmware.sh - add_file /lib/initcpio/udev/cdrom_id /lib/udev/cdrom_id - add_file /lib/initcpio/udev/load-modules.sh /lib/udev/load-modules.sh -} - -help () -{ -cat < md5sum.txt; \ cd /install/cdrom && mkisofs -J -r -V "$(NAME)_$(VERSION)" \ diff --git a/lfs/mkinitcpio b/lfs/dracut similarity index 79% rename from lfs/mkinitcpio rename to lfs/dracut index da0de4dfcb..60652e16be 100644 --- a/lfs/mkinitcpio +++ b/lfs/dracut @@ -24,12 +24,12 @@ include Config -VER = 0.5.9 +VER = 006 -THISAPP = mkinitcpio-$(VER) -DL_FILE = $(THISAPP).tar.gz +THISAPP = dracut-$(VER) +DL_FILE = $(THISAPP).tar.bz2 DL_FROM = $(URL_IPFIRE) -DIR_APP = $(DIR_SRC)/mkinitcpio +DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) ############################################################################### @@ -40,7 +40,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_MD5 = a80ca2af36962eaf85a7861ddfd4eea7 +$(DL_FILE)_MD5 = 016052b57001789ec2acf89d382a82f5 install : $(TARGET) @@ -69,13 +69,18 @@ $(subst %,%_MD5,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) - @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) - cd $(DIR_APP) && ./install.sh "" - cp $(DIR_SRC)/config/mkinitcpio/virtio /lib/initcpio/install/ - sed -i 's|^FILELIST=.*|FILELIST="$$(mktemp)"|g' /sbin/mkinitcpio - sed -i 's|^HOOKS=.*|HOOKS="base udev autodetect ide usb scsi pata sata virtio"|g' /etc/mkinitcpio.conf - sed -i 's|^MODULES=.*|MODULES="reiser4 reiserfs ext3 ext2 ehci_hcd sd_mod"|g' /etc/mkinitcpio.conf - sed -i 's|ide-cd|ide-cd ide-generic|g' /lib/initcpio/install/ide - sed -i 's| gzip -9 | lzma |g' /sbin/mkinitcpio + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) + + cd $(DIR_APP) && cp -vf $(DIR_SRC)/src/dracut/switch_root.c . + + cd $(DIR_APP) && make $(MAKETUNING) WITH_SWITCH_ROOT=1 + cd $(DIR_APP) && make install WITH_SWITCH_ROOT=1 \ + sbindir=/sbin sysconfdir=/etc + + rm -rf /usr/share/dracut/modules.d/*{dash,fips,redhat-i18n,rpmversion,network,ifcfg,plymouth,btrfs,crypt,dm,dmraid,dmsquash-live,lvm,mdraid,multipath,dasd,dasd_mod,fcoe,iscsi,nbd,nfs,resume,uswsusp,zfcp,znet,selinux} + + sed -e "s/--resolve-names=never//g" -i \ + /usr/share/dracut/modules.d/99base/init + @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/lfs/klibc b/lfs/klibc deleted file mode 100644 index 1ab1215f7f..0000000000 --- a/lfs/klibc +++ /dev/null @@ -1,89 +0,0 @@ -############################################################################### -# # -# IPFire.org - A linux based firewall # -# Copyright (C) 2007 Michael Tremer & Christian Schmidt # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -############################################################################### - -############################################################################### -# Definitions -############################################################################### - -include Config - -VER = 1.5.14 - -THISAPP = klibc-$(VER) -DL_FILE = $(THISAPP).tar.bz2 -DL_FROM = $(URL_IPFIRE) -DIR_APP = $(DIR_SRC)/$(THISAPP) -TARGET = $(DIR_INFO)/$(THISAPP) - -############################################################################### -# Top-level Rules -############################################################################### - -objects = $(DL_FILE) \ - klibc-extras-2.2.tar.gz \ - klibc-1.5.14-linux2.6.27-includes.tar.bz2 - -$(DL_FILE) = $(DL_FROM)/$(DL_FILE) -klibc-extras-2.2.tar.gz = $(DL_FROM)/klibc-extras-2.2.tar.gz -klibc-1.5.14-linux2.6.27-includes.tar.bz2 = $(DL_FROM)/klibc-1.5.14-linux2.6.27-includes.tar.bz2 - -$(DL_FILE)_MD5 = 030d978a7f16800e8ccae12d6fb5e7ba -klibc-extras-2.2.tar.gz_MD5 = 7e5042978531048c369f59ca1a13055b -klibc-1.5.14-linux2.6.27-includes.tar.bz2_MD5 = 1f875129d35193e35d27ed2b61a80bb6 - -install : $(TARGET) - -check : $(patsubst %,$(DIR_CHK)/%,$(objects)) - -download :$(patsubst %,$(DIR_DL)/%,$(objects)) - -md5 : $(subst %,%_MD5,$(objects)) - -############################################################################### -# Downloading, checking, md5sum -############################################################################### - -$(patsubst %,$(DIR_CHK)/%,$(objects)) : - @$(CHECK) - -$(patsubst %,$(DIR_DL)/%,$(objects)) : - @$(LOAD) - -$(subst %,%_MD5,$(objects)) : - @$(MD5) - -############################################################################### -# Installation Details -############################################################################### - -$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) - @$(PREBUILD) - @rm -rf $(DIR_APP) $(DIR_SRC)/klibc* && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) && \ - tar zxf $(DIR_DL)/klibc-extras-2.2.tar.gz - cd $(DIR_SRC) && tar jxf $(DIR_DL)/klibc-1.5.14-linux2.6.27-includes.tar.bz2 - - cd $(DIR_SRC)/klibc-extras && sed -i "s|^INSTALL = .*|INSTALL = /usr/bin/install -c -m 755|g" Makefile - cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) - cd $(DIR_APP) && make install - cd $(DIR_SRC)/klibc-extras && make $(MAKETUNING) $(EXTRA_MAKE) - cd $(DIR_SRC)/klibc-extras && make install - ln -sf sh.shared /usr/lib/klibc/bin/sh - @rm -rf $(DIR_APP) $(DIR_SRC)/klibc* - @$(POSTBUILD) diff --git a/lfs/syslinux b/lfs/syslinux index b521988811..cae55947ac 100644 --- a/lfs/syslinux +++ b/lfs/syslinux @@ -24,7 +24,7 @@ include Config -VER = 3.62 +VER = 3.86 THISAPP = syslinux-$(VER) DL_FILE = $(THISAPP).tar.bz2 @@ -40,7 +40,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_MD5 = dd87b380ce0bb67411ce8f21de69b221 +$(DL_FILE)_MD5 = d6fb0231e82190b4932b2aa20274911a install : $(TARGET) diff --git a/lfs/udev b/lfs/udev index 4667ff4a68..77d7ae546b 100644 --- a/lfs/udev +++ b/lfs/udev @@ -24,21 +24,17 @@ include Config -VER = 096 +VER = 125 THISAPP = udev-$(VER) -DL_FILE = $(THISAPP).tar.bz2 +DL_FILE = $(THISAPP).tar.gz DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) ifeq "$(LFS_PASS)" "install" TARGET = $(DIR_INFO)/$(THISAPP)-install -else -ifeq "$(KLIBC)" "1" - TARGET = $(DIR_INFO)/$(THISAPP)-klibc else TARGET = $(DIR_INFO)/$(THISAPP) endif -endif ############################################################################### # Top-level Rules @@ -49,7 +45,7 @@ objects = $(DL_FILE) udev-config-6.2.tar.bz2 $(DL_FILE) = $(DL_FROM)/$(DL_FILE) udev-config-6.2.tar.bz2 = $(DL_FROM)/udev-config-6.2.tar.bz2 -$(DL_FILE)_MD5 = f4effef7807ce1dc91ab581686ef197b +$(DL_FILE)_MD5 = be98e04cefdd9ca76b8fe7e92735ce29 udev-config-6.2.tar.bz2_MD5 = 9ff2667ab0f7bfe8182966ef690078a0 install : $(TARGET) @@ -79,13 +75,13 @@ $(subst %,%_MD5,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) - @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/udev-096-netif_rename.patch + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/udev-125-netif_rename.patch ifeq "$(LFS_PASS)" "install" cd $(DIR_APP) && make DESTDIR=/install/initrd sbindir=/sbin udevdir=/dev cd $(DIR_APP) && make DESTDIR=/install/initrd sbindir=/sbin udevdir=/dev install rm -f /install/initrd/sbin/udev* /install/initrd/usr/sbin/udev* /install/initrd/usr/bin/udev* - cd $(DIR_APP) && install udevstart udevinfo udevd udevsettle udevtrigger /install/initrd/sbin + cd $(DIR_APP) && install udevadm udevd /install/initrd/sbin cd $(DIR_APP) && make $(MAKETUNING) EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \ extras/firmware extras/floppy extras/path_id \ extras/scsi_id extras/usb_id extras/volume_id" @@ -93,6 +89,7 @@ ifeq "$(LFS_PASS)" "install" extras/firmware extras/floppy extras/path_id \ extras/scsi_id extras/usb_id extras/volume_id" install cd /install/initrd/usr/share && rm -rf man + -mkdir -pv /install/initrd/dev cd /install/initrd/dev && rm -f console cd /install/initrd/dev && mknod -m 0600 console c 5 1 cd /install/initrd/dev && rm -f null @@ -106,28 +103,6 @@ ifeq "$(LFS_PASS)" "install" cd /install/initrd/dev && mknod -m 0600 tty6 c 4 6 cp -f /etc/udev/rules.d/55-scsi-cdrom.rules /install/initrd/etc/udev/rules.d/55-scsi-cdrom.rules -else -ifeq "$(KLIBC)" "1" - cd $(DIR_APP) && sed -i "s|USE_LOG = .*|USE_LOG = false|g" Makefile - cd $(DIR_APP) && sed -i "s|USE_KLIBC = .*|USE_KLIBC = true|g" Makefile - - cd $(DIR_APP) && make PROGRAMS="udevd udevsettle udevtrigger" EXTRAS="extras/firmware extras/cdrom_id" - - -mkdir -p /lib/initcpio/udev - -mkdir -p /lib/initcpio/install - -mkdir -p /lib/initcpio/hooks - cd $(DIR_APP) && install -m755 udevd /lib/initcpio/udev - cd $(DIR_APP) && install -m755 udevtrigger /lib/initcpio/udev - cd $(DIR_APP) && install -m755 udevsettle /lib/initcpio/udev - cd $(DIR_APP) && install -m755 extras/firmware/firmware.sh /lib/initcpio/udev - cd $(DIR_APP) && install -m755 extras/cdrom_id/cdrom_id /lib/initcpio/udev - - install -m755 $(DIR_SRC)/config/mkinitcpio/start_udev /lib/initcpio/udev - install -m644 $(DIR_SRC)/config/mkinitcpio/udev.rules /lib/initcpio/udev - install -m755 $(DIR_SRC)/config/mkinitcpio/load-modules.sh /lib/initcpio/udev - install -m644 $(DIR_SRC)/config/mkinitcpio/udev_install /lib/initcpio/install/udev - install -m644 $(DIR_SRC)/config/mkinitcpio/udev_hook /lib/initcpio/hooks/udev - else rm -rf /lib/udev/devices cd $(DIR_APP) && tar jxf $(DIR_DL)/udev-config-6.2.tar.bz2 @@ -154,7 +129,6 @@ else chmod 755 /etc/udev/dvb.sh touch /etc/udev/rules.d/30-persistent-network.rules cp -vf $(DIR_SRC)/config/udev/blacklist /etc/modprobe.d/blacklist -endif endif @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/make.sh b/make.sh index 15b049eed6..a00832c278 100755 --- a/make.sh +++ b/make.sh @@ -373,9 +373,7 @@ buildipfire() { ipfiremake pkg-config ipfiremake linux-atm ipfiremake cpio - ipfiremake klibc - ipfiremake mkinitcpio - ipfiremake udev KLIBC=1 + ipfiremake dracut ipfiremake expat ipfiremake gdbm ipfiremake gmp diff --git a/src/dracut/dracut.conf b/src/dracut/dracut.conf new file mode 100644 index 0000000000..a6c3cb018a --- /dev/null +++ b/src/dracut/dracut.conf @@ -0,0 +1,26 @@ +# dracut config file + +# Specific list of dracut modules to use +#dracutmodules+="" + +# Dracut modules to omit +#omit_dracutmodules+="" + +# Dracut modules to add to the default +#add_dracutmodules+="" + +# additional kernel modules to the default +#add_drivers+="" + +# list of kernel filesystem modules to be included in the generic initramfs +filesystems+="reiser4" + +# build initrd only to boot current hardware +#hostonly="yes" +# + +# install local /etc/mdadm.conf +mdadmconf="no" + +# install local /etc/lvm/lvm.conf +lvmconf="no" diff --git a/src/dracut/switch_root.c b/src/dracut/switch_root.c new file mode 100644 index 0000000000..1520387239 --- /dev/null +++ b/src/dracut/switch_root.c @@ -0,0 +1,188 @@ +/* + * switchroot.c - switch to new root directory and start init. + * + * Copyright 2002-2008 Red Hat, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: + * Peter Jones + * Jeremy Katz + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef MS_MOVE +#define MS_MOVE 8192 +#endif + +enum { + ok, + err_no_directory, + err_usage, +}; + +/* remove all files/directories below dirName -- don't cross mountpoints */ +static int +recursiveRemove(char * dirName) +{ + struct stat sb,rb; + DIR * dir; + struct dirent * d; + char * strBuf = alloca(strlen(dirName) + 1024); + + if (!(dir = opendir(dirName))) { + printf("error opening %s: %m\n", dirName); + return 0; + } + + if (fstat(dirfd(dir),&rb)) { + printf("unable to stat %s: %m\n", dirName); + closedir(dir); + return 0; + } + + errno = 0; + + while ((d = readdir(dir))) { + errno = 0; + + if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) { + errno = 0; + continue; + } + + strcpy(strBuf, dirName); + strcat(strBuf, "/"); + strcat(strBuf, d->d_name); + + if (lstat(strBuf, &sb)) { + printf("failed to stat %s: %m\n", strBuf); + errno = 0; + continue; + } + + /* only descend into subdirectories if device is same as dir */ + if (S_ISDIR(sb.st_mode)) { + if (sb.st_dev == rb.st_dev) { + recursiveRemove(strBuf); + if (rmdir(strBuf)) + printf("failed to rmdir %s: %m\n", strBuf); + } + errno = 0; + continue; + } + if (unlink(strBuf)) { + printf("failed to remove %s: %m\n", strBuf); + errno = 0; + continue; + } + } + + if (errno) { + closedir(dir); + printf("error reading from %s: %m\n", dirName); + return 1; + } + + closedir(dir); + return 0; +} + +static int switchroot(const char *newroot) +{ + /* Don't try to unmount the old "/", there's no way to do it. */ + const char *umounts[] = { "/dev", "/proc", "/sys", NULL }; + int errnum; + int i; + + for (i = 0; umounts[i] != NULL; i++) { + char newmount[PATH_MAX]; + strcpy(newmount, newroot); + strcat(newmount, umounts[i]); + if (mount(umounts[i], newmount, NULL, MS_MOVE, NULL) < 0) { + fprintf(stderr, "Error mount moving old %s %s %m\n", + umounts[i], newmount); + fprintf(stderr, "Forcing unmount of %s\n", umounts[i]); + umount2(umounts[i], MNT_FORCE); + } + } + + if (chdir(newroot) < 0) { + errnum=errno; + fprintf(stderr, "switchroot: chdir failed: %m\n"); + errno=errnum; + return -1; + } + recursiveRemove("/"); + if (mount(newroot, "/", NULL, MS_MOVE, NULL) < 0) { + errnum = errno; + fprintf(stderr, "switchroot: mount failed: %m\n"); + errno = errnum; + return -1; + } + + if (chroot(".")) { + errnum = errno; + fprintf(stderr, "switchroot: chroot failed: %m\n"); + errno = errnum; + return -2; + } + return 1; +} + +static void usage(FILE *output) +{ + fprintf(output, "usage: switchroot \n"); + if (output == stderr) + exit(err_usage); + exit(ok); +} + +int main(int argc, char *argv[]) +{ + char *newroot = argv[1]; + char *init = argv[2]; + char **initargs = &argv[2]; + + if (newroot == NULL || newroot[0] == '\0' || + init == NULL || init[0] == '\0' ) { + usage(stderr); + } + + if (switchroot(newroot) < 0) { + fprintf(stderr, "switchroot has failed. Sorry.\n"); + return 1; + } + if (access(initargs[0], X_OK)) + fprintf(stderr, "WARNING: can't access %s\n", initargs[0]); + + /* get session leader */ + setsid(); + /* set controlling terminal */ + ioctl (0, TIOCSCTTY, 1); + + execv(initargs[0], initargs); +} + diff --git a/src/initscripts/init.d/udev b/src/initscripts/init.d/udev index 0cb97cd0a6..03846e6f3a 100644 --- a/src/initscripts/init.d/udev +++ b/src/initscripts/init.d/udev @@ -60,10 +60,10 @@ case "${1}" in # Now traverse /sys in order to "coldplug" devices that have # already been discovered - /sbin/udevtrigger + /sbin/udevadm trigger # Now wait for udevd to process the uevents we triggered - /sbin/udevsettle + /sbin/udevadm settle evaluate_retval ;; diff --git a/src/initscripts/init.d/udev_retry b/src/initscripts/init.d/udev_retry index 82f05808f6..78461ce77e 100644 --- a/src/initscripts/init.d/udev_retry +++ b/src/initscripts/init.d/udev_retry @@ -26,7 +26,7 @@ case "${1}" in done 2>/dev/null # Now wait for udevd to process the uevents we triggered - /sbin/udevsettle + /sbin/udevadm settle evaluate_retval ;; diff --git a/src/install+setup/install/main.c b/src/install+setup/install/main.c index 9cf1bd5e37..2de12bd414 100644 --- a/src/install+setup/install/main.c +++ b/src/install+setup/install/main.c @@ -512,31 +512,9 @@ int main(int argc, char *argv[]) replace("/harddisk/boot/grub/grub.conf", "KVER", KERNEL_VERSION); - /* Build the emergency ramdisk with all drivers */ - mysystem("cp -f /harddisk/etc/mkinitcpio.conf /harddisk/etc/mkinitcpio.conf.org"); - - replace("/harddisk/etc/mkinitcpio.conf", " autodetect ", " "); - snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -g /boot/ipfirerd-%s-emergency.img -k %s-ipfire", KERNEL_VERSION, KERNEL_VERSION); - runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]); - - mysystem("cp -f /harddisk/etc/mkinitcpio.conf.org /harddisk/etc/mkinitcpio.conf"); - - /* mkinitcpio has a problem if ide and pata are included */ - if ( scsi_disk==1 ) { - /* Remove the ide hook if we install sda */ - replace("/harddisk/etc/mkinitcpio.conf", " ide ", " "); - } else { - /* Remove the pata & sata hook if we install hda */ - replace("/harddisk/etc/mkinitcpio.conf", " pata ", " "); - replace("/harddisk/etc/mkinitcpio.conf", " sata ", " "); - } /* Going to make our initrd... */ - snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -g /boot/ipfirerd-%s.img -k %s-ipfire", KERNEL_VERSION, KERNEL_VERSION); - runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]); -/* snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -g /boot/ipfirerd-%s-smp.img -k %s-ipfire-smp", KERNEL_VERSION, KERNEL_VERSION ); + snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /usr/local/bin/rebuild-initrd"); runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]); -*/ - sprintf(string, "root=%s3", hdparams.devnode_part_run); replace( "/harddisk/boot/grub/grub.conf", "root=ROOT", string); diff --git a/src/patches/udev-096-netif_rename.patch b/src/patches/udev-096-netif_rename.patch deleted file mode 100644 index 1249c05836..0000000000 --- a/src/patches/udev-096-netif_rename.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff -Naur udev-096.org/udev_device.c udev-096/udev_device.c ---- udev-096.org/udev_device.c 2006-07-09 21:48:19.000000000 +0200 -+++ udev-096/udev_device.c 2009-04-28 22:04:56.000000000 +0200 -@@ -102,40 +102,8 @@ - strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval != 0) { -- int loop; -- -- /* see if the destination interface name already exists */ -- if (errno != EEXIST) { -- err("error changing netif name: %s", strerror(errno)); -- goto exit; -- } -- -- /* free our own name, another process may wait for us */ -- strlcpy(ifr.ifr_newname, udev->dev->kernel_name, IFNAMSIZ); -- strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); -- retval = ioctl(sk, SIOCSIFNAME, &ifr); -- if (retval != 0) { -- err("error changing netif name: %s", strerror(errno)); -- goto exit; -- } -- -- /* wait 30 seconds for our target to become available */ -- strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); -- strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); -- loop = 30 * 20; -- while (loop--) { -- retval = ioctl(sk, SIOCSIFNAME, &ifr); -- if (retval != 0) { -- if (errno != EEXIST) { -- err("error changing net interface name: %s", strerror(errno)); -- break; -- } -- dbg("wait for netif '%s' to become free, loop=%i", udev->name, (30 * 20) - loop); -- usleep(1000 * 1000 / 20); -- } -- } -+ err("error changing netif name: %s", strerror(errno)); - } -- - exit: - close(sk); - return retval; diff --git a/src/patches/udev-125-netif_rename.patch b/src/patches/udev-125-netif_rename.patch new file mode 100644 index 0000000000..c80b05afc3 --- /dev/null +++ b/src/patches/udev-125-netif_rename.patch @@ -0,0 +1,47 @@ +diff -Nur udev-125.vanilla/udev_device.c udev-125/udev_device.c +--- udev-125.vanilla/udev_device.c 2008-07-18 16:26:55.000000000 +0200 ++++ udev-125/udev_device.c 2010-07-25 18:15:12.289242450 +0200 +@@ -123,42 +123,7 @@ + if (retval == 0) + kernel_log(ifr); + else { +- int loop; +- +- /* see if the destination interface name already exists */ +- if (errno != EEXIST) { +- err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); +- goto exit; +- } +- +- /* free our own name, another process may wait for us */ +- strlcpy(ifr.ifr_newname, udev->dev->kernel, IFNAMSIZ); +- strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); +- retval = ioctl(sk, SIOCSIFNAME, &ifr); +- if (retval != 0) { +- err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); +- goto exit; +- } +- +- /* wait 30 seconds for our target to become available */ +- strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); +- strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); +- loop = 30 * 20; +- while (loop--) { +- retval = ioctl(sk, SIOCSIFNAME, &ifr); +- if (retval == 0) { +- kernel_log(ifr); +- break; +- } +- +- if (errno != EEXIST) { +- err("error changing net interface name %s to %s: %s\n", +- ifr.ifr_name, ifr.ifr_newname, strerror(errno)); +- break; +- } +- dbg("wait for netif '%s' to become free, loop=%i\n", udev->name, (30 * 20) - loop); +- usleep(1000 * 1000 / 20); +- } ++ err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + } + + exit: diff --git a/src/scripts/rebuild-initrd b/src/scripts/rebuild-initrd index 79ec1c36d7..06f30bbf05 100644 --- a/src/scripts/rebuild-initrd +++ b/src/scripts/rebuild-initrd @@ -23,21 +23,5 @@ # # KVER=`uname -r | cut -d"-" -f1` -ROOT=`grep "root=" /boot/grub/grub.conf | cut -d"=" -f2 | cut -d" " -f1 | tail -n 1` -echo -echo Rebuild the Initramdisk ... -cp -f /etc/mkinitcpio.conf.org /etc/mkinitcpio.conf -# -# Made initramdisk -# -if [ "${ROOT:0:7}" == "/dev/sd" ]; then - # Remove ide hook if root is on sda - sed -i "s| ide | |g" /etc/mkinitcpio.conf -else -if [ "${ROOT:0:7}" == "/dev/hd" ]; then - # Remove pata & sata hook if root is on hda - sed -i "s| pata | |g" /etc/mkinitcpio.conf - sed -i "s| sata | |g" /etc/mkinitcpio.conf -fi -fi -mkinitcpio -k $KVER-ipfire -g /boot/ipfirerd-$KVER.img + +dracut --force --verbose /boot/ipfirerd-$KVER.img $KVER-ipfire