make -C ./imagebuilder_local/openwrt-imagebuilder-ath79-generic.Linux-x86_64__Openwrt__temba19 image PROFILE=ubnt_nanostation-ac-loco PACKAGES='bmx6 bmx6-json b
mx6-sms bmx6-uci-config bmx6-table luci luci-app-bmx6 luci-compat tcpdump-mini iperf3 netperf ip netcat mtr xl2tpd wireguard luci-app-wireguard gre' FILES=./files
I also verified that the patch is not being applied checking the file vi /root/temba/Openwrt__temba19/build_dir/target-mips_24kc_musl/openwrt-imagebuilder-ath79-generic.Linux-x86_64/target/linux/ath79/image/generic-ubnt.mk
I also tried compiling just a part:
make -j1 V=s target/linux/ath79/image/clean
make -j1 V=s target/linux/ath79/clean
both failed
I could only make:
make -j1 V=s target/linux/clean
make -j1 V=s target/linux/compile
In the past, I ran a patch in target/linux/generic/files/drivers/net/phy/patches/ and it worked (?)
You'll need to edit the image/generic-ubnt.mk file in your target/linux/ath79/ directly, then you can either create a repo for your custom device up on github. If you do that, you can re-assign it as your origin repo and have the OpenWrt as your upstream, allowing you to merge upstream changes (if any) down the line.
You can patch ANY text file with the patch command. Whether that fits into the make scheme is another matter. But given the issue at hand from the OP, the PR was being applied incorrectly. For me
Correct, but not in the context of the OpenWrt build system, which was the what @guifipedro was asking based on the
They are trying to patch the target/linux/ath79 directory, which is called long before any patches included in it are applied.. The Makefile can't patch itself.
So, he either does it manually each time he updates his source tree (until it's done upstream) or he does it manually and then goes the custom github repo for the device and sets OpenWrt's as the upstream so it can be gracefully merged. Even then, you'll usually ahve to deal with conflicts
Just to clarify, it's why I posted to the thread in which I asked the same question. I didn't want to deal with manually patching each time I did a git pull, so I was trying to use the patches in the same way. I settled on just creating the origin as my own repo and upstream as OpenWrt and merging the changes
thanks all, specially @Grommish for understanding me here (because I recognize I did not explain very well)
@Grommish I don't get how you managed the situation. First you were merging all the time the changes with git pull. Can you explain again what you did after that? You still have to git pull or "merge" in some way, right?
In my case, I would like to deal with the patches in a more simple way (as I am expecting very few patches, that most of them are merged at some point)
so I had to move from a copy_patch way for these makefiles to apply_patch approach that I wrote today (so, the way I implemented it, it is less lines and easier to just copy the patches to patches/ directory when possible
copy_patch() {
local patch_var="${1}"
local target_path="${2}"
local patch_file="${3}"
local patch_path="../patches"
if [ ${patch_var} = 'y' ]; then
mkdir -p "${target_path}"
cp -v "${patch_path}/${patch_file}" "${target_path}"
else
rm -fv "${target_path}/${patch_file}"
fi
}
apply_patch() {
local patch_var="${1}"
local target_path="${2}"
local patch_path="${3}"
local target_file="${4}"
local patch_file="${5}"
if [ "${patch_var}" = 'y' ]; then
if [ -f "${target_path}/${target_file}.orig" ]; then
if [ -f "${target_path}/${target_file}.rej" ]; then
echo "${patch_path}/${patch_file} looks bad, there is a ${target_path}/${target_file}.rej"
else
echo "${patch_path}/${patch_file} already applied"
fi
else
patch -b "${target_path}/${target_file}" "${patch_path}/${patch_file}"
fi
else
if [ -f "${target_path}/${target_file}.orig" ]; then
mv -v "${target_path}/${target_file}.orig" "${target_path}/${target_file}"
rm -v "${target_path}/${target_file}.rej"
else
echo "${patch_path}/${patch_file} not applied"
fi
fi
}
You make your changes to target/linux/ath79/images/Makefile, then git add target/linux/ath79/images/Makefile and a git commit. git push origin <branch> will send it to your repo.
To update, do a git pull upstream <branch>, it'll merge (usually fast-forward) and allow you to do the merge commit, which you then push to your repo git push origin <branch>
If you are doing packages, you setup the repo in feeds/packages/ the same way, and then you can do the git pull upstream <branch> in feeds/packages after you run the .script/feeds update -a
This way, I don't have to try and understand the inside of the Openwrt build system, I just know it works.