Commit 36d25f43 authored by Anton Midyukov's avatar Anton Midyukov

tar2fs, e2k: replace creating boot.conf from tar2fs to feature e2k

parent a37b3d80
...@@ -340,54 +340,11 @@ if [ -n "$EFIPART" ]; then ...@@ -340,54 +340,11 @@ if [ -n "$EFIPART" ]; then
echo "$EFIDEV /boot/efi vfat umask=0,quiet,showexec,iocharset=utf8,codepage=866 1 2" >> "$ROOTFS/etc/fstab" echo "$EFIDEV /boot/efi vfat umask=0,quiet,showexec,iocharset=utf8,codepage=866 1 2" >> "$ROOTFS/etc/fstab"
fi fi
# Query ARCH in chroot and redefine arch-dependent variable
ARCH="$(chroot "$ROOTFS" rpm --eval '%_host_cpu')"
# NB: don't stick BOOTFS here, it has slightly different semantics
pushd $ROOTFS/boot
# 4.9.76-elbrus-def-alt1.11.1 -> def
get_label() { echo "${1# *}" | sed -r 's,.*elbrus-([0-9a-z]+)-.*$,\1,'; }
KVERSIONS=
KVERSIONS="$(chroot "$ROOTFS" rpm -qa 'kernel-image*' \
--qf '%{installtime} %{version}-%{name}-%{release}\n' \
| sort -n \
| cut -f 2 -d ' ' \
| sed 's/kernel-image-//')"
[ -n "$KVERSIONS" ] || fatal "unable to deduce kernel version"
rm -f .origver
# clean fstab # clean fstab
sed -i "/LABEL=ROOT/d" "$ROOTFS/etc/fstab" sed -i "/LABEL=ROOT/d" "$ROOTFS/etc/fstab"
# ...target device too # ...target device too
sed -i "s,$LOOPROOT,$ROOTDEV," "$ROOTFS/etc/fstab" sed -i "s,$LOOPROOT,$ROOTDEV," "$ROOTFS/etc/fstab"
echo "** KVERSIONS=[$KVERSIONS]" >&2
if [ "`echo $KVERSIONS | wc -w`" = 1 ]; then # 2+ labels
echo -e "default=`get_label $KVERSIONS`\n" >> boot.conf
fi
# FIXME: relies on particular (current) kernel package naming scheme
for v in $KVERSIONS; do
l="`get_label "$v"`"
cat >> boot.conf <<EOF
label=$l
partition=0
image=/image-$v
initrd=/initrd-$v.img
cmdline=console=ttyS0,115200 console=tty0 consoleblank=0 hardreset root=UUID=$ROOTUUID
EOF
done
echo "** start of boot.conf"
cat boot.conf
echo "** end of boot.conf"
popd
# Update cmdline.txt for Raspberry Pi # Update cmdline.txt for Raspberry Pi
[ -f "$ROOTFS/boot/efi/cmdline.txt" ] && [ -f "$ROOTFS/boot/efi/cmdline.txt" ] &&
sed -i "s/LABEL=ROOT/$ROOTDEV/" "$ROOTFS/boot/efi/cmdline.txt" sed -i "s/LABEL=ROOT/$ROOTDEV/" "$ROOTFS/boot/efi/cmdline.txt"
...@@ -411,6 +368,14 @@ if [ -f "$ROOTFS/boot/extlinux/extlinux.conf" ]; then ...@@ -411,6 +368,14 @@ if [ -f "$ROOTFS/boot/extlinux/extlinux.conf" ]; then
fi fi
fi fi
# e2k
if [ -f "$ROOTFS/boot/boot.conf" ]; then
sed -i "s/LABEL=ROOT/$ROOTDEV/g" "$ROOTFS/boot/boot.conf"
fi
# Query ARCH in chroot and redefine arch-dependent variable
ARCH="$(chroot "$ROOTFS" rpm --eval '%_host_cpu')"
# Setup bootloader # Setup bootloader
case "$BOOTLOADER" in case "$BOOTLOADER" in
lilo) lilo)
......
#!/bin/sh -efu
# NB: don't stick BOOTFS here, it has slightly different semantics
# 4.9.76-elbrus-def-alt1.11.1 -> def
get_label() { echo "${1# *}" | sed -r 's,.*elbrus-([0-9a-z]+)-.*$,\1,'; }
KVERSIONS="$(rpm -qa 'kernel-image*' \
--qf '%{installtime} %{version}-%{name}-%{release}\n' \
| sort -n \
| cut -f 2 -d ' ' \
| sed 's/kernel-image-//')"
[ -n "$KVERSIONS" ] ||
{ echo "** unable to deduce kernel version" >&2; exit 1; }
cd /boot
#rm -f .origver
echo "** KVERSIONS=[$KVERSIONS]" >&2
if [ "`echo $KVERSIONS | wc -w`" = 1 ]; then # 2+ labels
echo -e "default=`get_label $KVERSIONS`\n" >> boot.conf
fi
# FIXME: relies on particular (current) kernel package naming scheme
for v in $KVERSIONS; do
l="`get_label "$v"`"
cat >> boot.conf <<EOF
label=$l
partition=0
image=/image-$v
initrd=/initrd-$v.img
cmdline=console=tty0 consoleblank=0 hardreset LABEL=ROOT
EOF
done
echo "** start of boot.conf" >&2
cat boot.conf >&2
echo "** end of boot.conf" >&2
...@@ -10,5 +10,3 @@ CFG="/boot/boot.conf" ...@@ -10,5 +10,3 @@ CFG="/boot/boot.conf"
# tty0 first # tty0 first
sed -i "s/console=tty0 /console=$GLOBAL_TTY_DEV,$GLOBAL_TTY_RATE &/" "$CFG" sed -i "s/console=tty0 /console=$GLOBAL_TTY_DEV,$GLOBAL_TTY_RATE &/" "$CFG"
### NB: there's no boot.conf yet! could only be the sample one
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