File project.diff of Package dracut
--- dracut.spec.orig
+++ dracut.spec
@@ -28,6 +28,10 @@
Source0: dracut-%{version}.tar.xz
Source1: dracut-rpmlintrc
Source2: README.susemaint
+
+#custom patch
+Patch999: patch-uboot-linux.patch
+
BuildRequires: asciidoc
BuildRequires: bash
BuildRequires: cargo
@@ -138,6 +142,9 @@
%prep
%autosetup
+
+#apply custom patch
+%patch999 -p1
%build
%configure\
--- /dev/null
+++ patch-uboot-linux.patch
@@ -0,0 +1,137 @@
+diff -durN a/dracut.sh b/dracut.sh
+--- a/dracut.sh 2020-12-15 22:13:52.914497963 +0100
++++ b/dracut.sh 2020-12-15 22:13:39.698586354 +0100
+@@ -213,6 +213,7 @@
+ --lzo Compress the generated initramfs using lzop.
+ Make sure that your kernel has lzo support compiled
+ in, otherwise you will not be able to boot.
++ --uboot Create an U-boot initrd by running 'mkimage'
+ --lz4 Compress the generated initramfs using lz4.
+ Make sure that your kernel has lz4 support compiled
+ in, otherwise you will not be able to boot.
+@@ -375,6 +376,7 @@
+ --long force \
+ --long kernel-only \
+ --long no-kernel \
++ --long uboot \
+ --long print-cmdline \
+ --long kernel-cmdline: \
+ --long strip \
+@@ -578,6 +580,7 @@
+ --sshkey) sshkey="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
+ --logfile) logfile_l="$2"; shift;;
+ -v|--verbose) ((verbosity_mod_l++));;
++ --uboot) uboot="yes";;
+ -q|--quiet) ((verbosity_mod_l--));;
+ -l|--local)
+ allowlocal="yes"
+@@ -1956,6 +1959,10 @@
+ dinfo "*** Creating image file '$outfile' ***"
+
+ if [[ $uefi = yes ]]; then
++ if [[ $uboot = yes ]]; then
++ dwarn "Can not create a U-boot UEFI initrd, disabeling U-boot"
++ unset uboot
++ fi
+ readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
+ mkdir "$uefi_outdir"
+ fi
+@@ -2061,7 +2068,17 @@
+ exit 1
+ fi
+ else
+- if cp --reflink=auto "${DRACUT_TMPDIR}/initramfs.img" "$outfile"; then
++ initrd_file="${DRACUT_TMPDIR}/initramfs.img"
++ if [[ $uboot = yes ]]; then
++ if mkimage -A arm -O linux -T ramdisk -C none -n "$(basename $outfile)" -d "${initrd_file}" "${DRACUT_TMPDIR}/uInitramfs.img"; then
++ initrd_file="${DRACUT_TMPDIR}/uInitramfs.img"
++ dinfo "*** initramfs converted to U-boot ready initramfs ***"
++ else
++ dfatal "*** Can not make a U-boot initramfs ***"
++ exit 1
++ fi
++ fi
++ if cp --reflink=auto "$initrd_file" "$outfile"; then
+ dinfo "*** Creating initramfs image file '$outfile' done ***"
+ else
+ rm -f -- "$outfile"
+diff -durN a/lsinitrd.sh b/lsinitrd.sh
+--- a/lsinitrd.sh 2020-12-15 22:13:52.914497963 +0100
++++ b/lsinitrd.sh 2020-12-15 22:13:39.698586354 +0100
+@@ -136,7 +136,7 @@
+ for f in "${!filenames[@]}"; do
+ [[ $nofileinfo ]] || echo "initramfs:/$f"
+ [[ $nofileinfo ]] || echo "========================================================================"
+- $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2>/dev/null
++ $CAT "$image" 2>/dev/null | $CAT2 | cpio --extract --verbose --quiet --to-stdout "$f" 2>/dev/null
+ ((ret+=$?))
+ [[ $nofileinfo ]] || echo "========================================================================"
+ [[ $nofileinfo ]] || echo
+@@ -146,7 +146,7 @@
+ list_modules()
+ {
+ echo "dracut modules:"
+- $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
++ $CAT"$image" | $CAT2 | cpio --extract --verbose --quiet --to-stdout -- \
+ $(dracutlibdirs modules.txt) 2>/dev/null
+ ((ret+=$?))
+ }
+@@ -155,9 +155,9 @@
+ {
+ echo "========================================================================"
+ if [ "$sorted" -eq 1 ]; then
+- $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
++ $CAT "$image" 2>/dev/null | $CAT2 | cpio --extract --verbose --quiet --list | sort -n -k5
+ else
+- $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
++ $CAT "$image" 2>/dev/null | $CAT2 | cpio --extract --verbose --quiet --list | sort -k9
+ fi
+ ((ret+=$?))
+ echo "========================================================================"
+@@ -263,10 +263,15 @@
+ fi
+ fi
+ ;;
++ $'\x27\x05\x19\x56'*)
++ PRE_CAT="dd status=none bs=64 skip=1 if="
++ ;;
+ esac
+
+ if [[ $SKIP ]] ; then
+ bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin" ; })"
++elif [[ -n "$PRE_CAT" ]] ; then
++ $PRE_CAT"$image" | read -N 6 bin
+ else
+ read -N 6 bin < "$image"
+ fi
+@@ -320,12 +325,20 @@
+
+ ret=0
+
++CAT2="cat --"
++if [[ -n "$PRE_CAT" ]] ; then
++ CAT2="$CAT"
++ CAT="$PRE_CAT"
++else
++ CAT="$CAT "
++fi
++
+ if [[ -n "$unpack" ]]; then
+ unpack_files
+ elif (( ${#filenames[@]} > 0 )); then
+ extract_files
+ else
+- version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
++ version=$($CAT "$image" | $CAT2 | cpio --extract --verbose --quiet --to-stdout -- \
+ $(dracutlibdirs 'dracut-*') 2>/dev/null)
+ ((ret+=$?))
+ echo "Version: $version"
+@@ -335,7 +348,7 @@
+ echo "========================================================================"
+ else
+ echo -n "Arguments: "
+- $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
++ $CAT "$image" | $CAT2 | cpio --extract --verbose --quiet --to-stdout -- \
+ $(dracutlibdirs build-parameter.txt) 2>/dev/null
+ echo
+ list_modules