[opensuse-arm] Build a downstream kernel in OBS
![](https://seccdn.libravatar.org/avatar/850e0a09a0d345f7d19a487d7a355d69.jpg?s=120&d=mm&r=g)
Hi, Is there a guide on how to build a downstream kernel in obs like a upstream genuine kernel? I have a CHIP allwinner R8 with debian but I would like to use opensuse instead. I found a link in the wiki to a script which is supposed to help with this (http://users.suse.com/~dmueller/contrib_kernel.sh) but like is dead to me. Thanks! -- Cheers
![](https://seccdn.libravatar.org/avatar/3faa48f7f462ca17481ecd1e2f45d53f.jpg?s=120&d=mm&r=g)
On 24.07.17 20:49, Oscar C wrote:
Hi,
Is there a guide on how to build a downstream kernel in obs like a upstream genuine kernel?
I have a CHIP allwinner R8 with debian but I would like to use opensuse instead.
I found a link in the wiki to a script which is supposed to help with this (http://users.suse.com/~dmueller/contrib_kernel.sh) but like is dead to me.
Hm, looks like users.suse.com does not want to talk to anyone outside of the SUSE network. Hooray. Either way, here's the script. You may need to adapt it a bit, as it's been a while since I last used it. But overall it should still do what you expect. Alex --- #!/bin/bash # # Script to create an openSUSE Contrib kernel from downstream sources. # # Please use with care. No warranty granted if anything goes wrong. This # file is public domain and free for everyone to use, distribute and modify. # # Author: Alexander Graf <agraf@suse.de> # ######## KERNEL_FLAVOR="$1" KERNEL_ARCH="$2" KERNEL_ARCHIVE="$3" KERNEL_CONFIG="$4" OBS_PRJ="$5" # Sanity check command line if [ ! "$1" -o ! "$2" -o ! "$3" -o ! "$4" -o ! "$5" ]; then echo "Syntax: $0 <kernel flavor> <arch> <kernel tar.xz> <kernel config> <osc repo> Example: $0 midway armv7hl linux-midway-3.16.tar.xz linux-midway.config home:algraf:ARM:Factory:Contrib:Midway Available architectures: armv6hl armv7hl arm64 " exit 1 fi # Sanity check kernel KERNEL_TAR_VERSION=$( tar tf "$KERNEL_ARCHIVE" | head -n1 ) if [ "${KERNEL_TAR_VERSION:0:6}" != "linux-" ]; then echo "ERROR: Invalid tar archive Please provide a tar archive that contains the Linux tree inside of a directory named as linux-version such as linux-3.16-rc1" exit 1 fi # Derive kernel version from tarball KERNEL_VERSION="${KERNEL_TAR_VERSION:6}" KERNEL_VERSION="$(basename $KERNEL_VERSION)" # Sanity check arch case $KERNEL_ARCH in armv6hl|armv7hl|arm64) ;; *) echo "ERROR! Invalid architecture. Available architectures: armv6hl armv7hl arm64 " exit 1 ;; esac ### if [ ! "$KERNEL_SOURCE_GIT" ]; then KERNEL_SOURCE_GIT=git://kernel.opensuse.org/kernel-source.git DEFAULT_KERNEL_SOURCE_GIT=1 fi echo "Welcome to the openSUSE Contrib kernel creator. We will now create a kernel-source package and a kernel-$KERNEL_FLAVOR package. We will also add these two packages to your $OBS_PRJ repository. The first thing I will do is to fetch the openSUSE kernel-source.git from $KERNEL_SOURCE_GIT " if [ "$DEFAULT_KERNEL_SOURCE_GIT" ]; then echo "If this takes too long for your taste, please keep a local copy of the *most recent* kernel-source.git around and put its location into the KERNEL_SOURCE_GIT environemnt variable. " fi SRC=/dev/shm/kernel-source.$$ git clone $KERNEL_SOURCE_GIT $SRC cp "$KERNEL_ARCHIVE" "$SRC/linux-${KERNEL_VERSION}.tar.xz" cp "$KERNEL_CONFIG" "$SRC/config/armv6hl/$KERNEL_FLAVOR" cp "$KERNEL_CONFIG" "$SRC/config/armv7hl/$KERNEL_FLAVOR" cp "$KERNEL_CONFIG" "$SRC/config/arm64/$KERNEL_FLAVOR" ( cd $SRC echo patches.rpmify/firmware-path > series.conf echo " +armv6hl armv6hl/$KERNEL_FLAVOR +armv7hl armv7hl/$KERNEL_FLAVOR +arm64 arm64/$KERNEL_FLAVOR " > config.conf sed -i "s/^SRCVERSION=.*$/SRCVERSION=$KERNEL_VERSION/" rpm/config.sh ./scripts/sequence-patch.sh ( cd tmp/linux-$KERNEL_VERSION-master/ ./run_oldconfig.sh --flavor $KERNEL_FLAVOR -a $KERNEL_ARCH ) ./scripts/tar-up.sh ) echo "We finished assembling a kernel-source package. You can find it at $SRC/kernel-source. The next step is to upload this to OBS. " osc rdelete -m x $OBS_PRJ kernel-source osc rdelete -m x $OBS_PRJ kernel-$KERNEL_FLAVOR osc meta pkg $OBS_PRJ kernel-source -F - << EOF <package project="$OBS_PRJ" name="kernel-source"> <title>kernel-source</title> <description> </description> </package> EOF OSCDIR=/dev/shm/$$ mkdir $OSCDIR ( cd $OSCDIR osc co $OBS_PRJ kernel-source cd $OBS_PRJ/kernel-source cp $SRC/kernel-source/* . osc addremove osc ci -m "Add kernel sources" ) osc linkpac -C copy $OBS_PRJ kernel-source $OBS_PRJ kernel-$KERNEL_FLAVOR # Cleaning up rm -rf $OSCDIR rm -rf $SRC echo " Congratulations. You have now a working contrib kernel in $OBS_PRJ/kernel-$KERNEL_FLAVOR! Have a lot of fun." -- To unsubscribe, e-mail: opensuse-arm+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-arm+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/1cd903ce739b05e07b73c4db146530d7.jpg?s=120&d=mm&r=g)
Hi Oscar, Am 24.07.2017 um 20:49 schrieb Oscar C:
Is there a guide on how to build a downstream kernel in obs like a upstream genuine kernel?
I have a CHIP allwinner R8 with debian but I would like to use opensuse instead.
Why do you want a downstream kernel for that? Even the 4.11 kernel contains a sun5i-r8-chip.dts. Also note that you can use Kernel:HEAD (v4.13-rc2) or Kernel:linux-next repositories if necessary. Regards, Andreas -- SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- To unsubscribe, e-mail: opensuse-arm+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-arm+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/850e0a09a0d345f7d19a487d7a355d69.jpg?s=120&d=mm&r=g)
El 2017-07-27 18:27, Andreas Färber escribió:
Hi Oscar,
Hi!
Am 24.07.2017 um 20:49 schrieb Oscar C:
Is there a guide on how to build a downstream kernel in obs like a upstream genuine kernel?
I have a CHIP allwinner R8 with debian but I would like to use opensuse instead.
Why do you want a downstream kernel for that? Even the 4.11 kernel contains a sun5i-r8-chip.dts. Also note that you can use Kernel:HEAD (v4.13-rc2) or Kernel:linux-next repositories if necessary.
Mmmm, that's interesting. I didn't find any documentation regarding the support in mainline kernel and I supposed that support for it was lacking some bits. In fact I try to avoid downstream kernels like the plague because eveything else is much harder to get working. I will try with 4.11 and see what happens. Thanks! -- Cheers
participants (3)
-
Alexander Graf
-
Andreas Färber
-
Oscar C