VirtualBox

source: vbox/trunk/tools/linux.x86/kmodbuild/build-modules.sh@ 90802

Last change on this file since 90802 was 78140, checked in by vboxsync, 6 years ago

tools/linux.x86/kmodbuild: Some scripts bird uses to test build kmods. bugref:9172

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1#!/bin/bash -x
2# $Id: build-modules.sh 78140 2019-04-16 02:20:36Z vboxsync $
3## @file
4# Script for test building the VirtualBox kernel modules against a kernel.
5#
6# This script assumes the kernel directory it is pointed to was prepared using
7# build-kernel.sh, as that script plants a couple of files and symlinks needed
8# by this script.
9#
10
11#
12# Copyright (C) 2019 Oracle Corporation
13#
14# This file is part of VirtualBox Open Source Edition (OSE), as
15# available from http://www.virtualbox.org. This file is free software;
16# you can redistribute it and/or modify it under the terms of the GNU
17# General Public License (GPL) as published by the Free Software
18# Foundation, in version 2 as it comes in the "COPYING" file of the
19# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
20# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
21#
22
23if [ $# -lt 2 ]; then
24 echo "usage: modules.sh <PATH_STAGE> <kernel-dir>"
25 exit 2
26fi
27PATH_STAGE=$1
28PATH_STAGE_GUEST_SRC="${PATH_STAGE}/bin/additions/src"
29PATH_STAGE_HOST_SRC="${PATH_STAGE}/bin/src"
30KERN_DIR=$2
31KERN_NAME=`basename "${KERN_DIR}"`
32KERN_VER=`echo ${KERN_NAME} | sed -e 's/^.*linux-//'`
33KERN_BASE_DIR=`dirname "${KERN_DIR}"`
34BLDDIR_BASE="/tmp/modbld"
35BLDDIR="${BLDDIR_BASE}/`echo ${PATH_STAGE} ${KERN_BASE_DIR} | sha1sum | cut -b1-16`-${KERN_NAME}/"
36JOBS=36
37shift
38shift
39
40
41# Process other options
42OPT_CLOBBER=
43while [ $# -gt 0 ];
44do
45 case "$1" in
46 clobber) OPT_CLOBBER=1;;
47 --version) KERN_VER="$2"; shift;;
48 *) echo "syntax error: $1" 1>&2
49 exit 2;;
50 esac
51 shift;
52done
53
54#
55# Prepare the sources we're to build.
56#
57set -e
58test -n "${BLDDIR}"
59if [ -d "${BLDDIR}" -a -n "${OPT_CLOBBER}" ]; then
60 rm -R "${BLDDIR}/"
61fi
62
63mkdir -p "${BLDDIR}/" "${BLDDIR}/guest/" "${BLDDIR}/host/"
64rsync -crlDp --exclude="*.tmp_versions/" --include="*/" --include="*.h" --include="*.c" --include="*.cpp" --include="Makefile*" --include="build_in_tmp" --exclude="*" "${PATH_STAGE_HOST_SRC}/" "${BLDDIR}/host/"
65rsync -crlDp --exclude="*.tmp_versions/" --include="*/" --include="*.h" --include="*.c" --include="*.cpp" --include="Makefile*" --include="build_in_tmp" --exclude="*" "${PATH_STAGE_GUEST_SRC}/" "${BLDDIR}/guest/"
66
67#
68# Do the building.
69#
70if [ -f "${KERN_DIR}/.bird-make" -a ! -f "${KERN_DIR}/.bird-failed" ]; then
71 if "${KERN_DIR}/.bird-make" --help 2>&1 | grep -q output-sync -; then
72 SYNC_OUTPUT="--output-sync=target"
73 else
74 SYNC_OUTPUT=""
75 fi
76 "${KERN_DIR}/.bird-make" -C "${BLDDIR}/guest/" \
77 VBOX_NOJOBS=1 -j${JOBS} `cat "${KERN_DIR}/.bird-overrides"` ${SYNC_OUTPUT} "KERN_DIR=${KERN_DIR}" "KERN_VER=${KERN_VER}"
78 case "${KERN_VER}" in
79 [3-9].*|2.6.3[789]*) ## todo fix this so it works back to 2.6.18 (-fno-pie, -Wno-declaration-after-statement)
80 "${KERN_DIR}/.bird-make" -C "${BLDDIR}/host/" \
81 VBOX_NOJOBS=1 -j${JOBS} `cat "${KERN_DIR}/.bird-overrides"` ${SYNC_OUTPUT} "KERN_DIR=${KERN_DIR}" "KERN_VER=${KERN_VER}"
82 ;;
83 esac
84else
85 echo "${KERN_DIR}: Skipping..."
86fi
87
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette