diff --git a/bin/tar2fs b/bin/tar2fs index 80690c5c..90607562 100755 --- a/bin/tar2fs +++ b/bin/tar2fs @@ -218,6 +218,16 @@ if [ -n "$BOOTPART" ]; then echo "$BOOTDEV /boot $BOOTFSTYPE defaults 1 2" >> "$ROOTFS/etc/fstab" fi +# Query ARCH in chroot and redefine arch-dependent variable +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 @@ -315,3 +325,6 @@ fi if [ -n "$SUDO_USER" ]; then chown "$SUDO_USER:$(id -g "$SUDO_USER")" "$IMG" "$ROOTFS" "$WORKDIR" ||: fi +# maybe qemu interpreter was copied to chroot; +# this is no longer necessary, remove +rm -rf "$ROOTFS"/.host ||: diff --git a/features.in/build-vm/lib/90-build-vm.mk b/features.in/build-vm/lib/90-build-vm.mk index ef28d70f..9b9396b7 100644 --- a/features.in/build-vm/lib/90-build-vm.mk +++ b/features.in/build-vm/lib/90-build-vm.mk @@ -23,7 +23,11 @@ check-sudo: fi prepare-image: check-sudo - @if [ -x /usr/share/mkimage-profiles/bin/tar2fs ]; then \ + @# need to copy $(BUILDDIR)/.work/chroot/.host/qemu* into chroot + @#if qemu is used + @(cd "$(BUILDDIR)/.work/chroot/"; \ + tar -rf "$(VM_TARBALL)" ./.host/qemu*) ||:; \ + if [ -x /usr/share/mkimage-profiles/bin/tar2fs ]; then \ TOPDIR=/usr/share/mkimage-profiles; \ fi; \ if ! sudo $$TOPDIR/bin/tar2fs \