/usr/src/kernel-patches/arm/apply/xenomai is in linux-patch-xenomai 2.5.5.2-1ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | #! /bin/bash
set -e
if ! [ -d kernel -a -d Documentation ]
then
echo >&2 "Not in kernel top level directory. Exiting"
exit 1
fi
TOPPATCHDIR=/usr/src/kernel-patches
ARCHITECTURE=`dpkg --print-installation-architecture`
DECOMPRESSOR="zcat -f"
PATCH_OPTIONS="--ignore-whitespace --silent"
# This is informational only, used by lskpatches
DHPKPATCHES_VERSION=0.99.36
DEPENDS=("" "" "")
KVERSIONS=(2.6.33 2.6.31 2.6.30)
PATCHFILES=("/usr/src/kernel-patches/diffs/xenomai/adeos-ipipe-2.6.33-arm-1.18-00.patch.gz" "/usr/src/kernel-patches/diffs/xenomai/adeos-ipipe-2.6.31-arm-1.16-02.patch.gz" "/usr/src/kernel-patches/diffs/xenomai/adeos-ipipe-2.6.30-arm-1.15-03.patch.gz")
DEBPATCHFILES=("" "" "")
STRIPLEVELS=(1 1 1)
[ -f debian/APPLIED_${ARCHITECTURE}_xenomai -o \
-f debian/APPLIED_all_xenomai ] && exit 0
VERSION=$(grep ^VERSION Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
PATCHLEVEL=$( grep ^PATCHLEVEL Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
SUBLEVEL=$(grep ^SUBLEVEL Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
EXTRAVERSION=$(grep ^EXTRAVERSION Makefile | head -1 2>/dev/null | \
sed -e 's/EXTRAVERSION =[ ]*\([^ ]*\)$/\1/')
KERNELBRANCHLET=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}
KERNELRELEASE=${KERNELBRANCHLET}${EXTRAVERSION}
IDX=
declare -i i=${#PATCHFILES[*]}-1
while [ $i -ge 0 ]
do
v=${KVERSIONS[$i]}
if [ -n "$KPATCH_xenomai" -a "$v" = "$KPATCH_xenomai" \
-o "$v" = "$KERNELRELEASE" \
-o "$v" = "$KERNELBRANCHLET" \
-o "$v" = all ]
then
IDX=$i
fi
i=i-1
done
if [ -n "$KPATCH_xenomai" -a ${KVERSIONS[$IDX]} != "$KPATCH_xenomai" ]
then
echo >&2 "Requested kernel version \`$KPATCH_xenomai' not found for patch xenomai"
exit 1
elif [ -z "$IDX" ]
then
echo >&2 "No \"Xenomai realtime kernel patches\" patch found for kernel version $KERNELRELEASE"
exit 1
fi
KVERSION=${KVERSIONS[$IDX]}
STRIPLEVEL=${STRIPLEVELS[$IDX]}
if [ "${DEBPATCHFILES[$IDX]}" != '' -a \
\( -r version.Debian -o -r README.Debian \) ]
then
PATCHFILE=${DEBPATCHFILES[$IDX]}
else
PATCHFILE=${PATCHFILES[$IDX]}
fi
echo >&2 "START applying xenomai patch (Xenomai realtime kernel patches)"
NEEDED_DEPS=
for dep in ${DEPENDS[$IDX]}
do
if [ -x ${TOPPATCHDIR}/${ARCHITECTURE}/${KERNELBRANCHLET}/apply/$dep ]
then
NEEDED_DEPS="${ARCHITECTURE}/${KERNELBRANCHLET}/apply/$dep $NEEDED_DEPS"
elif [ -x ${TOPPATCHDIR}/all/${KERNELBRANCHLET}/apply/$dep ]
then
NEEDED_DEPS="all/${KERNELBRANCHLET}/apply/$dep $NEEDED_DEPS"
elif [ -x ${TOPPATCHDIR}/${ARCHITECTURE}/apply/$dep ]
then
NEEDED_DEPS="${ARCHITECTURE}/apply/$dep $NEEDED_DEPS"
elif [ -x ${TOPPATCHDIR}/all/apply/$dep ]
then
NEEDED_DEPS="all/apply/$dep $NEEDED_DEPS"
else
echo >&2 "ERROR: Patch dependency \`$dep' not found - aborting"
echo >&2 "END applying xenomai patch"
exit 1
fi
done
if [ "$NEEDED_DEPS" ]
then
echo >&2 "Ensuring the following patches are applied first: $NEEDED_DEPS"
for apply in ${NEEDED_DEPS}
do
dep=$(basename $apply)
${TOPPATCHDIR}/$apply
# check something was applied
if [ ! -f debian/APPLIED_${ARCHITECTURE}_$dep -a \
! -f debian/APPLIED_all_$dep ]
then
echo >&2 "ERROR: patch dependency did not left a patch stamp (version mismatch ?) - aborting"
echo >&2 "END applying xenomai patch"
exit 1
fi
done
UNPATCHDEPS=$(echo ${NEEDED_DEPS} | sed s,/apply/,/unpatch/,g)
fi
echo >&2 "Testing whether \"Xenomai realtime kernel patches\" patch for $KVERSION applies (dry run):"
if ! [ -r $PATCHFILE ]
then
echo >&2 "\"Xenomai realtime kernel patches\" patch for $KVERSION not found"
exit 1
elif ! $DECOMPRESSOR $PATCHFILE |
patch --force --dry-run $PATCH_OPTIONS -p$STRIPLEVEL
then
echo >&2 "\"Xenomai realtime kernel patches\" patch for $KVERSION does not apply cleanly"
exit 1
fi
if ! $DECOMPRESSOR $PATCHFILE |
patch $PATCH_OPTIONS -p$STRIPLEVEL
then
# This should never happen, thanks to the dry-run
echo >&2 "ASSERTION FAILED - \"Xenomai realtime kernel patches\" patch for $KVERSION failed"
echo >&2 "END applying xenomai patch"
exit 1
fi
echo >&2 "\"Xenomai realtime kernel patches\" patch for $KVERSION succeeded"
echo >&2 "Removing empty files:"
# make an exception for ./debian, or else the stamp files will go too.
find . -path ./debian -prune -o \
-type f -size 0 ! -name 'APPLIED*' -exec rm {} \; -print
echo >&2 "Done."
mkdir -p debian
cat > 'debian/APPLIED_arm_xenomai' <<EOF
PATCHFILE='$PATCHFILE'
STRIPLEVEL='$STRIPLEVEL'
DEPENDS='$UNPATCHDEPS'
EOF
mkdir -p debian/image.d
PKGNAME=`dpkg -S $PATCHFILE | cut -d: -f1`
PKGVERS=`grep-dctrl -n -P $PKGNAME -s Version -X /var/lib/dpkg/status`
cat > 'debian/image.d/register-xenomai' <<EOF
#!/bin/sh
# This scripts documents the "Xenomai realtime kernel patches" kernel patch into the
# kernel-image package, as being applied to the kernel.
docdir=\${IMAGE_TOP}/usr/share/doc/kernel-image-\${version}
mkdir -p \${docdir}
(
printf 'Xenomai realtime kernel patches (xenomai)${KPATCH_xenomai:+ for kernel ${KPATCH_xenomai}},'
echo ' from package $PKGNAME, version $PKGVERS'
) >> \${docdir}/applied-patches
EOF
chmod +x 'debian/image.d/register-xenomai'
echo >&2 "END applying xenomai patch"
|