Commit 27674e29 authored by Anton Midyukov's avatar Anton Midyukov Committed by Michael Shigorin

build-vm, kernel, tar2fs: make-initrd happens now in build-vm

NB: 07-kernel change breaks multi-kernel setup! Breaks: 650e92bf
parent 18951479
...@@ -27,10 +27,11 @@ BOOT_SIZE_FACTOR=2 # multiply /boot size by this value additionally ...@@ -27,10 +27,11 @@ BOOT_SIZE_FACTOR=2 # multiply /boot size by this value additionally
CUR_BOUNDARY=0 # align first partition at 1MB for performance (+1) CUR_BOUNDARY=0 # align first partition at 1MB for performance (+1)
INITRD_MODULES=
BOOTFSTYPE= BOOTFSTYPE=
BOOTPART= BOOTPART=
BOOTLOADER="$5"
ARCH="$(arch)" # NB: sudo => no GLOBAL_ will do either; mind qemu-* ARCH="$(arch)" # NB: sudo => no GLOBAL_ will do either; mind qemu-*
case "$ARCH" in case "$ARCH" in
...@@ -209,24 +210,6 @@ fi ...@@ -209,24 +210,6 @@ fi
# Query ARCH in chroot and redefine arch-dependent variable # Query ARCH in chroot and redefine arch-dependent variable
ARCH="$(chroot "$ROOTFS" rpm --eval '%_host_cpu')" ARCH="$(chroot "$ROOTFS" rpm --eval '%_host_cpu')"
if [[ $ARCH = *86* ]]
then # NB: different storage modules might be needed for non-kvm
INITRD_MODULES="sd_mod ata_piix ahci virtio-scsi virtio-blk"
else
INITRD_MODULES=
fi
echo "MODULES_PRELOAD += $INITRD_MODULES $ROOTFSTYPE" >> "$ROOTFS/etc/initrd.mk"
case "$ARCH" in
*86*)
echo "FEATURES += qemu" >> "$ROOTFS/etc/initrd.mk"
;;
e2k)
echo "FEATURES += usb" >> "$ROOTFS/etc/initrd.mk"
;;
esac
# NB: don't stick BOOTFS here, it has slightly different semantics # NB: don't stick BOOTFS here, it has slightly different semantics
pushd $ROOTFS/boot pushd $ROOTFS/boot
...@@ -236,7 +219,6 @@ get_label() { echo "${1# *}" | sed -r 's,.*elbrus-([0-9a-z]+)-.*$,\1,'; } ...@@ -236,7 +219,6 @@ get_label() { echo "${1# *}" | sed -r 's,.*elbrus-([0-9a-z]+)-.*$,\1,'; }
KVERSIONS= KVERSIONS=
if [ -s .origver ]; then if [ -s .origver ]; then
while read kver; do while read kver; do
chroot "$ROOTFS" make-initrd -k "$kver"
KVERSIONS="$KVERSIONS $kver" KVERSIONS="$KVERSIONS $kver"
done < .origver done < .origver
fi fi
......
# hooked from lib/sugar.mk # hooked from lib/sugar.mk
use/build-vm: sub/rootfs@/ use/kernel use/build-vm: sub/rootfs@/ use/kernel/initrd-setup
@$(call add_feature) @$(call add_feature)
...@@ -13,6 +13,10 @@ kver="$(rpm -qa 'kernel-image*' \ ...@@ -13,6 +13,10 @@ kver="$(rpm -qa 'kernel-image*' \
cd /boot cd /boot
echo "$kver" > .origver # for tar2fs echo "$kver" > .origver # for tar2fs
make-initrd -N -k "$kver" AUTODETECT= \
FEATURES+="$GLOBAL_VM_INITRDFEATURES" \
MODULES_ADD+="$GLOBAL_VM_INITRDMODULES"
# NB: e2k kernel builds "image" instead of "vmlinuz" # NB: e2k kernel builds "image" instead of "vmlinuz"
[ -f vmlinuz-$kver ] && ln -s vmlinuz-$kver vmlinuz ||: [ -f vmlinuz-$kver ] && ln -s vmlinuz-$kver vmlinuz ||:
ln -s initrd-$kver.img initrd.img # missing at this stage ln -s initrd-$kver.img initrd.img # missing at this stage
......
...@@ -10,6 +10,12 @@ IMAGE_PACKAGES = $(DOT_BASE) \ ...@@ -10,6 +10,12 @@ IMAGE_PACKAGES = $(DOT_BASE) \
IMAGE_PACKAGES_REGEXP = $(THE_PACKAGES_REGEXP) \ IMAGE_PACKAGES_REGEXP = $(THE_PACKAGES_REGEXP) \
$(BASE_PACKAGES_REGEXP) $(BASE_PACKAGES_REGEXP)
ifdef EFI_BOOTLOADER
VM_BOOTLOADER=$(EFI_BOOTLOADER)
else
VM_BOOTLOADER=$(BASE_BOOTLOADER)
endif
# intermediate chroot archive # intermediate chroot archive
VM_TARBALL := $(IMAGE_OUTDIR)/$(IMAGE_NAME).tar VM_TARBALL := $(IMAGE_OUTDIR)/$(IMAGE_NAME).tar
VM_RAWDISK := $(IMAGE_OUTDIR)/$(IMAGE_NAME).raw VM_RAWDISK := $(IMAGE_OUTDIR)/$(IMAGE_NAME).raw
...@@ -31,7 +37,8 @@ prepare-image: check-sudo ...@@ -31,7 +37,8 @@ prepare-image: check-sudo
TOPDIR=/usr/share/mkimage-profiles; \ TOPDIR=/usr/share/mkimage-profiles; \
fi; \ fi; \
if ! sudo $$TOPDIR/bin/tar2fs \ if ! sudo $$TOPDIR/bin/tar2fs \
"$(VM_TARBALL)" "$(VM_RAWDISK)" $(VM_SIZE) $(VM_FSTYPE); then \ "$(VM_TARBALL)" "$(VM_RAWDISK)" "$(VM_SIZE)" "$(VM_FSTYPE)" \
"$(VM_BOOTLOADER)"; then \
echo "** error: sudo tar2fs failed, see build log" >&2; \ echo "** error: sudo tar2fs failed, see build log" >&2; \
exit 1; \ exit 1; \
fi fi
......
...@@ -37,3 +37,35 @@ use/kernel/desktop: ...@@ -37,3 +37,35 @@ use/kernel/desktop:
use/kernel/server: use/kernel/server:
@$(call add,THE_KMODULES,ipset kvm) @$(call add,THE_KMODULES,ipset kvm)
# for vm targets
use/kernel/initrd-setup: use/kernel
@$(call add,VM_INITRDFEATURES,add-modules compress cleanup)
@$(call try,VM_FSTYPE,ext4)
@$(call add,VM_INITRDMODULES,$$(VM_FSTYPE))
ifeq (,$(filter-out i586 x86_64,$(ARCH)))
@$(call add,VM_INITRDFEATURES,qemu)
@$(call add,VM_INITRDMODULES,ata_piix)
endif
ifeq (,$(filter-out e2k%,$(ARCH)))
@$(call add,VM_INITRDFEATURES,usb)
endif
ifeq (,$(filter-out i586 x86_64 aarch64 armh,$(ARCH)))
@$(call add,VM_INITRDMODULES,ahci sd_mod)
@$(call add,VM_INITRDMODULES,nvme nvme-core)
@$(call add,VM_INITRDMODULES,virtio-scsi virtio-blk virtio-rng)
endif
ifeq (,$(filter-out aarch64 armh,$(ARCH)))
@$(call add,VM_INITRDMODULES,bcm2835 sunxi-mmc)
@$(call add,VM_INITRDMODULES,nvmem_rockchip_efuse)
@$(call add,VM_INITRDMODULES,virtio-mmio)
endif
ifeq (,$(filter-out aarch64,$(ARCH)))
@$(call add,VM_INITRDMODULES,meson-gx-mmc)
@$(call add,VM_INITRDMODULES,nvmem_meson_efuse)
endif
ifeq (,$(filter-out armh,$(ARCH)))
@$(call add,VM_INITRDMODULES,sdhci_dove sdhci_esdhc_imx)
endif
@$(call xport,VM_INITRDMODULES)
@$(call xport,VM_INITRDFEATURES)
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