Quilt not functioning properly

Greetings!

I'm trying to make some modifications to mt76 eeprom.c file using quilt patches subsystem and experience some difficulties.
I follow the instructions here: https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem#iteratively_modify_patches_without_cleaning_the_source_tree

Cleaning and preparation target/linux tree for usage with Quilt seems to go as expected:

Alex@192 openwrt % make target/linux/ clean 
Alex@192 openwrt % make target/linux/ prepare V=s QUILT=1

But further actions with Quilt produce no result:

Alex@192 linux-5.4.91 % quilt new platform/1020-mt76-eeprom-from-rootfs.patch                         
Usage: quilt new [-p n|-p ab] {patchname}
Alex@192 linux-5.4.91 % 

Every action with Quilt does nothing but displays a usage message:

Alex@192 linux-5.4.91 % quilt series
Usage: quilt series [--color[=always|auto|never]] [-v]
Alex@192 linux-5.4.91 % quilt push -a
Usage: quilt push [-afqvm] [--fuzz=N] [--merge[=merge|diff3]] [--leave-rejects] [--color[=always|auto|never]] [--refresh] [num|patch]

If I try to edit eeprom.c a blank file is opened and its contents are added to the last existing patch in stack:

Alex@192 linux-5.4.91 % quilt edit drivers/net/wireless/mediatek/mt76/eeprom.c                        
File P:h added to patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch
Usage: /opt/local/share/quilt/scripts/backup-files -B prefix {-b|-r|-c|-L} [-s] [-k] [-t] [-L] {-f {file|-}|-|file ...}

	Create or restore backup copies of a list of files.

	Mandatory parameters:
	-B	Path name prefix for backup files

	Action parameters:
	-b	Create backup (preserve links)
	-r	Restore the backup
	-c	Create simple copy
	-L	Ensure that source files have a link count of 1

	Common options:
	-s	Silent operation; only print error messages

	Restore options:
	-k	Keep backup files
	-t	Touch original files after restore (update their mtimes)

	Backup options:
	-L	Ensure that source files have a link count of 1

	File list parameters:
	-f	Read the filenames to process from file (- = standard input)
	-	Read the filenames to process from backup

File -- added to patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch
File h added to patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch
Usage: /opt/local/share/quilt/scripts/backup-files -B prefix {-b|-r|-c|-L} [-s] [-k] [-t] [-L] {-f {file|-}|-|file ...}

	Create or restore backup copies of a list of files.

	Mandatory parameters:
	-B	Path name prefix for backup files

	Action parameters:
	-b	Create backup (preserve links)
	-r	Restore the backup
	-c	Create simple copy
	-L	Ensure that source files have a link count of 1

	Common options:
	-s	Silent operation; only print error messages

	Restore options:
	-k	Keep backup files
	-t	Touch original files after restore (update their mtimes)

	Backup options:
	-L	Ensure that source files have a link count of 1

	File list parameters:
	-f	Read the filenames to process from file (- = standard input)
	-	Read the filenames to process from backup

File -- added to patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch
File drivers/net/wireless/mediatek/mt76/eeprom.c added to patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch
2021-01-25 16:56:57.485 BBEdit[92219:1952935] .sdef warning for type 'text' attribute 'name' of class 'application' in suite 'BBEdit Suite': AppleScript name references may not work for this property because its type is not NSString-derived.
2021-01-25 16:56:57.485 BBEdit[92219:1952935] .sdef warning for type 'text' attribute 'name' of class 'document' in suite 'BBEdit Suite': AppleScript name references may not work for this property because its type is not NSString-derived.
2021-01-25 16:56:57.485 BBEdit[92219:1952935] .sdef warning for type 'text' attribute 'name' of class 'filter' in suite 'BBEdit Suite': AppleScript name references may not work for this property because its type is not NSString-derived.
2021-01-25 16:56:57.485 BBEdit[92219:1952935] .sdef warning for type 'text' attribute 'name' of class 'project item' in suite 'BBEdit Suite': AppleScript name references may not work for this property because its type is not NSString-derived.
2021-01-25 16:56:57.486 BBEdit[92219:1952935] .sdef warning for type 'text' attribute 'name' of class 'window' in suite 'BBEdit Suite': AppleScript name references may not work for this property because its type is not NSString-derived.
2021-01-25 16:56:57.487 BBEdit[92219:1952935] .sdef warning for type 'text' attribute 'name' of class 'tag info' in suite 'HTML Scripting': AppleScript name references may not work for this property because its type is not NSString-derived.
File P:h removed from patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch
File -- is not in patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch
File h removed from patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch
File P:h is not in patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch
File -- is not in patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch
File -- is not in patch platform/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch

What am I doing wrong?

I'd first confirm that your ~/.quiltrc is valid (probably re-create it, don't underestimate the effect of (DOS-) line-endings), afterwards I'd test the most basic quilt functionality outside of the openwrt source tree, e.g.:

$ mkdir -p /tmp/foo/patches
$ cd /tmp/foo

$ echo foo >foo.txt

$ quilt new a.patch
Patch a.patch is now on top

$ quilt edit foo.txt 
File foo.txt added to patch a.patch

$ quilt diff
--- a/foo.txt
+++ b/foo.txt
@@ -1 +1 @@
-foo
+foobar

$ quilt series 
a.patch

$ quilt pop -a
Removing patch a.patch
Restoring foo.txt

No patches applied

$ while quilt push; do quilt refresh -p ab; done
Applying patch a.patch
patching file foo.txt

Now at patch a.patch
Patch a.patch is unchanged
File series fully applied, ends at patch a.patch

quilt is a host side tool/ dependency, depending on your build environment there might be issues outside of OpenWrt's realm with that, so if the basics above don't work, you need to fix that first.

2 Likes

Thank you for the advice.

Indeed something went wrong with Quilt on macOS Catalina.

To fix that I had to explicitly export MacPorts binaries dirs to the beginning of $PATH variable:

export PATH=/opt/local/libexec/gnubin:/opt/local/bin:/opt/local/sbin:$PATH 

After this everything went smooth.
Blank file opens due to some BBEdit issues. Changed $EDITOR to vi and it worked ok.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.