cp -a -t /root /source/*
echo "Creating squashfs"
mksquashfs /source /root/testdir/rootfs.img -quiet
+
+# Copy rootfs.img to the NTFS drive if exists
+if [ -e "/dev/disk/by-id/ata-disk_root_ntfs" ]; then
+ mkfs.ntfs -F -L dracut_ntfs /dev/disk/by-id/ata-disk_root_ntfs
+ mkdir -p /root_ntfs
+ mount -t ntfs3 /dev/disk/by-id/ata-disk_root_ntfs /root_ntfs
+ mkdir -p /root_ntfs/run /root_ntfs/testdir
+ cp /root/testdir/rootfs.img /root_ntfs/testdir/rootfs.img
+fi
+
umount /root
echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
poweroff -f
qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root
+ # NTFS drive
+ if modprobe --dry-run ntfs3 &> /dev/null && command -v mkfs.ntfs &> /dev/null; then
+ qemu_add_drive_args disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs
+ fi
+
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
test_marker_check || return 1
+ # Run the NTFS test only if mkfs.ntfs is available
+ if modprobe --dry-run ntfs3 &> /dev/null && command -v mkfs.ntfs &> /dev/null; then
+ dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
+ "$testdir"/run-qemu \
+ "${disk_args[@]}" \
+ -boot order=d \
+ -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut_ntfs console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \
+ -initrd "$TESTDIR"/initramfs.testing
+
+ test_marker_check || return 1
+ fi
+
test_marker_reset
rootPartitions=$(sfdisk -d "$TESTDIR"/root.img | grep -c 'root\.img[0-9]')
[ "$rootPartitions" -eq 1 ] || return 1
# devices, volume groups, encrypted partitions, etc.
"$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
--modules "test-makeroot" \
- --install "sfdisk mkfs.ext4 mksquashfs" \
+ --install "sfdisk mkfs.ext4 mkfs.ntfs mksquashfs" \
+ --drivers "ntfs3" \
--include ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
--no-hostonly --no-hostonly-cmdline --no-early-microcode --nofscks --nomdadmconf --nohardlink --nostrip \
--force "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1
qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root 160
+ # NTFS drive
+ if modprobe --dry-run ntfs3 &> /dev/null && command -v mkfs.ntfs &> /dev/null; then
+ dd if=/dev/zero of="$TESTDIR"/root_ntfs.img bs=1MiB count=160
+ qemu_add_drive_args disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs
+ fi
+
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
"${disk_args[@]}" \
return 1
fi
+ # mount NTFS with ntfs3 driver inside the generated initramfs
+ cat > /tmp/ntfs3.rules << 'EOF'
+SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs3"
+EOF
+
"$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
--modules "test dash dmsquash-live qemu" \
--omit "rngd" \
- --drivers "ext4 sd_mod" \
+ --drivers "ext4 ntfs3 sd_mod" \
--install "mkfs.ext4" \
+ --include /tmp/ntfs3.rules /lib/udev/rules.d/ntfs3.rules \
--no-hostonly --no-hostonly-cmdline \
--force "$TESTDIR"/initramfs.testing "$KVERSION" || return 1