Changeset 717 for branches


Ignore:
Timestamp:
Dec 7, 2015, 3:21:58 AM (4 years ago)
Author:
ehem
Message:

Update the kernel build.sh to deal with newer setups

Need to handle xz compressed kernels/modules in addition to bzip2. Also
stop adding the partial version onto the package name, while having the
full kernel revision had its moments the filenames were becoming
troublesome.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/contrib/debian/linux-image/build.sh

    r672 r717  
    5757fi
    5858
    59 kernsrc="/usr/src/linux-source-${linuxver}.tar.bz2"
     59kernsrc="/usr/src/linux-source-${linuxver}.tar.*"
    6060
    6161archfull=`dpkg-architecture "-a${arch}" -qDEB_HOST_MULTIARCH`
     
    106106revision=`dpkg -s linux-source-${linuxver} | grep -e^Version\:`
    107107revision=${revision#Version\:\ }
    108 # retrieve the extra version
    109 revextra="${revision#${linuxver}.}"
    110 while [ "${revextra}" != "${revextra#[0-9]}" ]
    111 do revextra="${revextra#[0-9]}"
    112 done
    113108
    114109rm -f "${DEBIAN_BUILD_DIR}/linux-"*"-${linuxver}"*"-${device}_"*"${linuxver}"*"_${arch}.deb"
     
    121116then
    122117        rm -rf "${linuxdir}"
    123         echo tar -C \""${DEBIAN_BUILD_DIR}"\" -jxf \""${kernsrc}"\"
    124         tar -C "${DEBIAN_BUILD_DIR}" -jxf "${kernsrc}"
     118        case "${kernsrc}" in
     119        *.xz)
     120                unpack="unxz -c"
     121        ;;
     122        *.bz2)
     123                unpack="bunzip2 -c"
     124        ;;
     125        *.gz)
     126                unpack="gunzip -c"
     127        ;;
     128        esac
     129        echo ${unpack} \| tar -C \""${DEBIAN_BUILD_DIR}"\" -xf \""${kernsrc}"\"
     130        ${unpack} | tar -C "${DEBIAN_BUILD_DIR}" -xf "${kernsrc}"
    125131fi
    126132
     
    157163cd "${linuxdir}"
    158164
    159 rm -rf modules
    160 
     165# remove modules we're not supposed to build for this kernel
     166for mod in ${linuxdir}/modules/*
     167do
     168        if [ "${modules}" = "${modules#*${mod##*/}}" ]
     169        then    echo rm -rf \""${linuxdir}/modules/${mod}"\"
     170                rm -rf "${linuxdir}/modules/${mod}"
     171        fi
     172done
     173
     174# unpack the modules that weren't already present
    161175for mod in ${modules}
    162176do
    163         echo tar -C \""${linuxdir}"\" -jxf \""/usr/src/${mod}.tar.bz2"\"
    164         tar -C "${linuxdir}" -jxf "/usr/src/${mod}.tar.bz2"
     177        if [ ! -e "${linuxdir}/modules/${mod}" ]
     178        then
     179                case "/usr/src/${mod}.tar.*" in
     180                *.xz)
     181                        unpack="unxz -c"
     182                ;;
     183                *.bz2)
     184                        unpack="bunzip2 -c"
     185                ;;
     186                *.gz)
     187                        unpack="gunzip -c"
     188                ;;
     189                esac
     190                echo ${unpack} \""/usr/src/${mod}.tar.*"\" \| tar -C \""${linuxdir}"\" -xf -
     191                ${unpack} "/usr/src/${mod}.tar.*" | tar -C "${linuxdir}" -xf -
     192        fi
    165193done
    166194
     
    174202
    175203# the key command
    176 echo MODULE_LOC=\""${linuxdir}/modules"\" make-kpkg --config config --arch \""${arch}"\" --initrd --append_to_version \""${revextra}${EXTRAEXTRAVERSION}-${device}"\" --revision \""${revision}"\" --cross-compile \""${archfull}-"\" kernel_image modules_image kernel_headers
    177 if ! yes "" 2>/dev/null | MODULE_LOC="${linuxdir}/modules" make-kpkg --config config --arch "${arch}" --initrd --append_to_version "${revextra}${EXTRAEXTRAVERSION}-${device}" --revision "${revision}" --cross-compile "${archfull}-" kernel_image modules_image kernel_headers
     204echo MODULE_LOC=\""${linuxdir}/modules"\" make-kpkg --config config --arch \""${arch}"\" --initrd --append_to_version \""-${device}${EXTRAEXTRAVERSION}"\" --revision \""${revision}"\" --cross-compile \""${archfull}-"\" kernel_image modules_image kernel_headers
     205if ! yes "" 2>/dev/null | MODULE_LOC="${linuxdir}/modules" make-kpkg --config config --arch "${arch}" --initrd --append_to_version "-${device}${EXTRAEXTRAVERSION}" --revision "${revision}" --cross-compile "${archfull}-" kernel_image modules_image kernel_headers
    178206then
    179207        echo ; echo Kernel build failed\!
     
    186214
    187215if [ -n "${modules}" ]
    188 then    packages="${packages} ""${DEBIAN_BUILD_DIR}/linux-module-"*"-${revision}${EXTRAEXTRAVERSION}-${device}_"*"+${revision}_${arch}.deb"
     216then    packages="${packages} ""${DEBIAN_BUILD_DIR}/linux-module-"*"-${revision}-${device}${EXTRAEXTRAVERSION}_"*"+${revision}_${arch}.deb"
    189217fi
    190218
Note: See TracChangeset for help on using the changeset viewer.