Hi I got a question about the Linux Kernel and refreshing the patches.
Is it possible to refresh the patches for all the targets in once or does that need to be done per target?
When I use the following command it applies only on the selected target:
make target/linux/refresh V=s
Thank in advance
This script will refresh the patches for all targets. I'm not sure if this is the most recent version though; but it should work.
There was a more recent @KanjiMonster script named update_kernel.sh, which I can no longer find?
I have it locally, I'll paste it here. Seems better than pastebinning it (if someone has a better suggestion, let me know).
#!/bin/sh
#
# update_kernel.sh: (c) 2017 Jonas Gorski <jonas.gorski@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
BUILD=0
BUILD_ARGS=
VERBOSE=w
TEST=0
UPDATE=0
KERNEL=
PATCHVER=
while [ $# > 0 ]; do
case $1 in
-b|--build)
BUILD=1
shift
BUILD_ARGS=$1
;;
-q|--quiet)
VERBOSE=
;;
-t|--test)
TEST=1
;;
-u|--update)
UPDATE=1
;;
-v|--verbose)
VERBOSE=ws
;;
[1-9]*)
if [ -z "$KERNEL" ]; then
KERNEL=$1
elif [ -z "$PATCHVER" ]; then
PATCHVER=$1
else
exit 1
fi
;;
*)
break
;;
esac
shift
done
if [ -z "$KERNEL" ]; then
echo "usage: $0 [<options>...] <patchver> [<version>]"
echo "example: $0 3.18 3.18.30"
echo "If <version> is not given, it will try to find out the latest from kernel.org"
echo ""
echo "valid options:"
echo "-b|--build <args> also do a test build with <args> as extra arguments (e.g. -j 3)"
echo "-q|--quiet less output"
echo "-t|--test don't do anything, just print what it would do"
echo "-u|--update update include/kernel-version.mk after a successful run"
echo "-v|--verbose more output (pass V=ws to all commands)"
exit 1
fi
if [ -z "$PATCHVER" ]; then
if [ -n "$(which curl)" ]; then
DL_CMD="curl -s "
fi
if [ -n "$(which wget)" ]; then
DL_CMD="wget -O - -q "
fi
if [ -z "$DL_CMD" ]; then
echo "Failed to find a suitable download program. Please install either curl or wget." >&2
exit 1
fi
# https://www.kernel.org/feeds/kdist.xml
# $(curl -s https://www.kernel.org/feeds/kdist.xml | sed -ne 's|^.*"html_url": "\(.*/commit/.*\)",|\1.patch|p')
# curl -s "https://www.kernel.org/feeds/kdist.xml"
CURR_VERS=$($DL_CMD "https://www.kernel.org/feeds/kdist.xml" | sed -ne 's|^.*title>\([1-9][^\w]*\): .*|\1|p')
for ver in $CURR_VERS; do
case $ver in
"$KERNEL"*)
PATCHVER=$ver
;;
esac
if [ -n "$PATCHVER" ]; then
break
fi
done
if [ -z "$PATCHVER" ]; then
echo "Failed to find the latest release on kernel.org, please specify the release manually" >&2
exit 1
fi
fi
echo "Refreshing Kernel $KERNEL to release $PATCHVER ..."
targets=$(ls -b target/linux)
if [ "$TEST" -eq 1 ]; then
CMD="echo"
fi
for target in $targets; do
if [ "$target" = "generic" -o -f "$target" ]; then
continue
fi
grep -q "broken" target/linux/$target/Makefile && { \
echo "Skipping $target (broken)"
continue
}
if [ -e tmp/${target}_${PATCHVER}_done ]; then
continue
fi
grep -q "${PATCHVER}" target/linux/$target/Makefile || \
[ -f target/linux/$target/config-${KERNEL} ] || \
[ -d target/linux/$target/patches-${KERNEL} ] && {
echo "refreshing $target ..."
$CMD echo "CONFIG_TARGET_$target=y" > .config || exit 1
$CMD echo "CONFIG_ALL_KMODS=y" >> .config || exit 1
$CMD make defconfig KERNEL_PATCHVER=${KERNEL} || exit 1
if [ ! -f tmp/${target}_${PATCHVER}_refreshed ]; then
$CMD make target/linux/refresh V=$VERBOSE KERNEL_PATCHVER=${KERNEL} LINUX_VERSION=${PATCHVER} || exit 1
$CMD make target/linux/prepare V=$VERBOSE KERNEL_PATCHVER=${KERNEL} LINUX_VERSION=${PATCHVER} || exit 1
$CMD touch tmp/${target}_${PATCHVER}_refreshed
fi
if [ "$BUILD" = "1" ]; then
echo "building $target ... "
$CMD make V=$VERBOSE KERNEL_PATCHVER=${KERNEL} LINUX_VERSION=${PATCHVER} $BUILD_ARGS || exit 1
fi
$CMD make target/linux/clean
$CMD touch tmp/${target}_${PATCHVER}_done
} || {
echo "skipping $target (no support for $KERNEL)"
}
done
if [ "$UPDATE" -eq 1 ]; then
NEWVER=${PATCHVER#$KERNEL}
if [ "$TEST" -eq 1 ]; then
echo ./staging_dir/host/bin/mkhash sha256 dl/linux-$PATCHVER.tar.xz
fi
if [ -f dl/linux-$PATCHVER.tar.xz ]; then
CHECKSUM=$(./staging_dir/host/bin/mkhash sha256 dl/linux-$PATCHVER.tar.xz)
fi
$CMD sed -i include/kernel-version.mk \
-e "s|LINUX_VERSION-${KERNEL} =.*|LINUX_VERSION-${KERNEL} = ${NEWVER}|" \
-e "s|LINUX_KERNEL_HASH-${KERNEL}.*|LINUX_KERNEL_HASH-${PATCHVER} = ${CHECKSUM}|"
fi
Thank you for the quick response I will give it a try.
Just in case what you are after is 4.9.64
@anomeome I'm not on the Trunk build but on the latest 17.01 source build, I want to update the kernel to 4.4.100.
That might take some work, I just bump the architectures I need for myself (up to .99). I don't think any kernel updates will be pushed to 17.01 anymore unless they contain vulnerabiliy fixes, and the kernel changelogs don't identify them as such unfortunately.
I think you are right, in the Trunk the devs are also already busy to migrate all that is possible to kernel v4.9.
But I will try to finish this update and make it available when finished, if it's merged it's merged otherwise there are always people that are building their custom image and can use it to patch their environment.
@bladeoner You can find my bump to .99 (for ar71xx, ramips and x86) here, if it helps (if you're not on any of those targets then obviouly not).
Good luck!
Thank you, I use ar71xx so I'm lucky (^_^)
If you could share your patch to bump to .100, that would be great
As soon as I finish I will share it with you, just bump to .100 and refreshed all patches for all targets.
1 Like
@Borromini you can find the patch on the following location to bump to .102 here
Thanks man! Dat was snel ;).
1 Like
I just updated the link to the patch to bump to .102.
I experienced some difficulties updating to .102 in my PR for .100 because the source was updated so I created a new PR for .102.
1 Like
I did a PR for kernel bump 4.4.103, the patch can be downloaded here
You're getting quite busy
My (limited) experience is LEDE won't commit every kernel bump for 17.01 but save up a few (unless there's a severe vulnerability that needs fixing).
@bladeoner If you happen to bump to .104 I'd gladly send in a tested-by like with .102, but I'm having stability/power issues with my DIR-860L on .103, I suppose .103 has been stable for you?