Commit a6563bb0 authored by Anton Midyukov's avatar Anton Midyukov

initrd-bootchain: Initial feature

This is an alternative to the initrd-propagator feature. bootchain-* is a make-initrd features. You should look at the documentation for it in the make-initrd-bootchain-* packages: /usr/share/make-initrd/features/bootchain-*/README.md
parent 8a299b4a
Осуществляется сборка initrd.img при помощи make-initrd с включенными фичами
bootchain. Это альтернатива фичи initrd-propagator. Используется тот же список
модулей ядра, что и при сборке с propagator, но в отличие от последнего модули
добавляются в initrd.img самим make-initrd.
Документацию по использованию bootchain следует смотреть в пакетах
make-initrd-bootchain-*:
/usr/share/make-initrd/features/bootchain-*/README.md
use/initrd-bootchain: use/uuid-iso
@$(call add_feature)
@$(call set,STAGE1_INITRD,initrd-pipeline)
@$(call set,STAGE1_PACKAGES,make-initrd-bootchain)
@$(call set,STAGE1_INITRD_TYPEARGS,$(shell echo "root=bootchain bootchain=fg,altboot bc_debug automatic"))
@$(call set,STAGE1_INITRD_BOOTMETHOD,$(shell echo "method:cdrom,uuid:$(UUID_ISO)"))
@$(call set,STAGE1_INITRD_STAGE2_OPTION,stagename)
# set up livecd browser redirection page
ifdef BUILDDIR
include $(BUILDDIR)/distcfg.mk
BOOTCHAIN_CFG := $(BUILDDIR)/stage1/files/bootchain
all: debug
@if [ -n "$(META_VOL_ID)" ]; then \
DISTRO="$(META_VOL_ID)"; \
else \
DISTRO="$(RELNAME)"; \
fi; \
if [ -s "$(BOOTCHAIN_CFG)" ]; then \
sed -i \
-e "s,@distro@,$$DISTRO," \
$(BOOTCHAIN_CFG); \
fi
debug:
@if [ -n "$(DEBUG)" ]; then \
echo "** DISTRO: $(DISTRO)"; \
fi
endif
# /etc/sysconfig/bootchain example
#############################
# Bootchain defaults #
#############################
# Where to create the chain, for example: mntdir=/run/bootchain
# mntdir=/dev/bootchain
# Change VT number to show log on specified TTY, empty value turns off this VT
# BC_LOG_VT=3
# Delay in seconds before auto-activate interactive VT, empty value for switch immediately
# BC_FGVT_ACTIVATE=7
# Full path to the bootchain log or character special device name
# BC_LOGFILE=/var/log/bootchained.log
# Common timeout in seconds for all waitdev steps:
# this make possible using fallback after last waitdev step
#
# WAITDEV_TIMEOUT=
#############################
# Pipeline defaults #
#############################
# Where to create the chain, for example: mntdir=/run/pipeline
# mntdir=/dev/pipeline
# Full path to the bootchain log or character special device name
# BC_LOGFILE=/var/log/pipelined.log
#############################
# ALT Linux specific values #
#############################
# altboot back title
OEM_WELCOME_TEXT="Welcome to ALT!"
# Distribution name, for example
OEM_DISTRIBUTION="@distro@"
# ISO-image mount point (required for ALT)
OEM_CDROOT=/image
# Default stage2 filename for boot from ISO-9660
OEM_DEFAULT_STAGE2=altinst
# Persistent storage device LABEL for Live-RW sessions
OEM_LIVE_STORAGE=alt-live-storage
# Live storage device LABEL for mark non-usable devices
OEM_BAD_STORAGE=alt-slow-storage
# Local storage device LABEL with the OEM drivers update
OEM_SETUP_STORAGE=alt-drivers-update
# Mount point inside stage2 for read additional images
# OEM_IMAGES_BASE=/tmp/images
# Directory inside stage2 for mount images as LiveCD slices
# OEM_OVERLAYS_DIR=/tmp/overlays
# HTTP and FTP base directory
OEM_URL_NETINST=/pub/distributions/ALTLinux/p9/
# NFS path with overlays-live sub-directory, containing slice images
# OEM_NFS_NETINST=/srv/public/netinst
# SAMBA share with overlays-live sub-directory, containing slice images
# OEM_CIFS_NETINST=/netinst
#!/bin/sh -efux
# NB: /etc/initrd.mk carefully prepared by earlier scripts
fatal() { echo "** error: $@" >&1; exit 1; }
kver=
for KFLAVOUR in $GLOBAL_KFLAVOURS; do
kver+=" $(rpm -qa 'kernel-image*' \
--qf '%{version}-%{name}-%{release}\n' \
| grep "$KFLAVOUR" \
| sed 's/kernel-image-//')"
done
[ -n "$kver" ] ||
fatal "no kernel version identified"
[ -s /.in/modules ] ||
fatal "kernel modules set not found"
cat >> /etc/initrd.mk <<EOF
FEATURES += add-modules compress cleanup rdshell
FEATURES += bootchain-localdev
FEATURES += bootchain-liverw
FEATURES += bootchain-waitdev
FEATURES += bootchain-getimage
FEATURES += bootchain-nfs
FEATURES += bootchain-cifs
EOF
echo "MODULES_TRY_ADD += $(grep -v ^# /.in/modules |
grep -v / |
grep .ko |
sort -u | tr -s '\n' ' ')" >> /etc/initrd.mk
echo "MODULES_TRY_ADD += $(grep ^# -v /.in/modules |
grep -v .ko |
sort -u |
sed 's,$,/,g' | tr -s '\n' ' ')" >> /etc/initrd.mk
dialog --create-rc /etc/dialogrc.tmp
cat /etc/dialogrc.tmp |sed -E \
-e 's/^(use_colors).*/\1 = ON/' \
-e 's/^(use_shadow).*/\1 = ON/' \
-e 's/^(screen_color).*/\1 = \(WHITE,RED,ON\)/' \
> /etc/dialogrc.error
rm -f /etc/dialogrc.tmp
# replace generated config bootchain to stage1 chroot
mv /.image/bootchain /etc/sysconfig/
echo "PUT_FILES += /etc/sysconfig/bootchain" >> /etc/initrd.mk
echo "PUT_FILES += /etc/dialogrc.error" >> /etc/initrd.mk
# FIXME: large storage systems can get that tmpfs filled up
# with debug data as of make-initrd 2.2.12
rm -vf /usr/share/make-initrd/data/etc/udev/rules.d/00-debug.rules \
/usr/share/make-initrd/data/lib/uevent/filters/debug
MAKE_INITRD_OPTS="--no-checks AUTODETECT="
MAKE_INITRD_VER="`make-initrd -V \
| sed -rn 's/^make-initrd version ([0-9.]+)/\1/p'`"
[ -z "$GLOBAL_VERBOSE" ] ||
MAKE_INITRD_OPTS="$MAKE_INITRD_OPTS -v"
cd /boot
for KVER in $kver; do
make-initrd $MAKE_INITRD_OPTS -k "$KVER" ||
fatal "make-initrd failed"
done
case `arch` in
e2k)
kname=image;;
*)
kname=vmlinuz;;
esac
rm -f $kname initrd.img
ln -s $kname-$KVER $kname
ln -s initrd-$KVER.img initrd.img
:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment