Changeset f3a7b0d in mainline
- Timestamp:
- 2021-04-20T18:21:55Z (4 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- de227aba
- Parents:
- 6186f9f
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
README.md
r6186f9f rf3a7b0d 35 35 36 36 In order to build HelenOS, one must first build the cross-compiler toolchain 37 ( either as a root or by specifying the `CROSS_PREFIX` environment variable)38 by running (example for the amd64 architecture, further list of targets can be 39 found in the `default` directory):37 (the default installation location can be overridden by specifying the 38 `CROSS_PREFIX` environment variable) by running (example for the amd64 39 architecture, further list of targets can be found in the `default` directory): 40 40 41 41 ``` … … 61 61 ``` 62 62 # sudo dnf group install 'Development Tools' 63 # sudo dnf install wget texinfo libmpc-devel mpfr-devel gmp-develPyYAML genisoimage flex bison63 # sudo dnf install wget texinfo PyYAML genisoimage flex bison 64 64 ``` 65 65 66 In case the toolchain script won't work no matter how hard you try, let us know. 66 67 Please supply as many relevant information (your OS and distribution, list of -
configure.sh
r6186f9f rf3a7b0d 39 39 CONFIG_RULES="${SOURCE_DIR}/HelenOS.config" 40 40 CONFIG_DEFAULTS="${SOURCE_DIR}/defaults" 41 42 41 43 42 test "$#" -eq 1 && { test "$1" = "-h" || test "$1" = "--help"; } … … 85 84 fi 86 85 87 if ! which meson ; then86 if ! which meson >/dev/null 2>/dev/null; then 88 87 echo "Your system does not have Meson installed." 89 88 echo 'Please use `pip3 install meson`' … … 91 90 fi 92 91 93 if ! which ninja ; then92 if ! which ninja >/dev/null 2>/dev/null; then 94 93 echo "Your system does not have ninja installed." 95 94 echo 'Please use `pip3 install ninja`' … … 98 97 99 98 # Link tools directory for convenience. 100 ln -s "${SOURCE_DIR}/tools" tools 99 if [ ! -e tools ]; then 100 ln -s "${SOURCE_DIR}/tools" tools 101 fi 101 102 102 103 # Run HelenOS config tool. … … 122 123 123 124 compname="$cc_arch-helenos-gcc" 125 unset compprefix 124 126 125 if which "$compname" ; then127 if which "$compname" >/dev/null 2>/dev/null; then 126 128 # Compiler is in PATH 127 129 compprefix="$cc_arch-helenos-" 128 130 129 131 elif [ -n "$CROSS_PREFIX" ]; then 130 if ! which "$CROSS_PREFIX/bin/$compname"; then 132 if which "$CROSS_PREFIX/bin/$compname" >/dev/null 2>/dev/null; then 133 compprefix="$CROSS_PREFIX/bin/$cc_arch-helenos-" 134 fi 135 136 if [ -z "$compprefix" ]; then 131 137 echo "ERROR: \$CROSS_PREFIX defined but $compname is not present in $CROSS_PREFIX/bin." 132 138 echo "Run tools/toolchain.sh to build cross-compiling toolchain." 133 139 exit 1 134 140 fi 141 else 142 if [ -z "$XDG_DATA_HOME" ]; then 143 XDG_DATA_HOME="$HOME/.local/share" 144 fi 135 145 136 compprefix="$CROSS_PREFIX/bin/$cc_arch-helenos-" 137 else 138 if ! which "/usr/local/cross/bin/$compname"; then 139 echo "ERROR: \$CROSS_PREFIX is not defined and $compname is not present in /usr/local/cross/bin." 146 if which "$XDG_DATA_HOME/HelenOS/cross/bin/$compname" >/dev/null 2>/dev/null; then 147 compprefix="$XDG_DATA_HOME/HelenOS/cross/bin/$cc_arch-helenos-" 148 elif which "/opt/HelenOS/cross/bin/$compname" >/dev/null 2>/dev/null; then 149 compprefix="/opt/HelenOS/cross/bin/$cc_arch-helenos-" 150 elif which "/usr/local/cross/bin/$compname" >/dev/null 2>/dev/null; then 151 compprefix="/usr/local/cross/bin/$cc_arch-helenos-" 152 fi 153 154 if [ -z "$compprefix" ]; then 155 echo "ERROR: \$CROSS_PREFIX is not defined and $compname is not present in any of the following standard locations." 156 echo " * $XDG_DATA_HOME/HelenOS/cross/bin" 157 echo " * /opt/HelenOS/cross/bin" 158 echo " * /usr/local/cross/bin" 140 159 echo "Run tools/toolchain.sh to build cross-compiling toolchain." 141 160 exit 1 142 161 fi 143 144 compprefix="/usr/local/cross/bin/$cc_arch-helenos-"145 162 fi 146 163 -
tools/toolchain.sh
r6186f9f rf3a7b0d 41 41 GCC_VERSION="8.2.0" 42 42 43 BASEDIR=" `pwd`"43 BASEDIR="$PWD" 44 44 SRCDIR="$(readlink -f $(dirname "$0"))" 45 45 46 SYSTEM_INSTALL=false 46 47 REAL_INSTALL=true 47 48 USE_HELENOS_TARGET=true … … 57 58 58 59 show_usage() { 59 echo " Cross-compiler toolchain build script"60 echo "HelenOS cross-compiler toolchain build script" 60 61 echo 61 62 echo "Syntax:" 62 echo " $0 [-- no-install] [--non-helenos-target] <platform>"63 echo " $0 --test-version [<platform>]"63 echo " $0 [--system-wide] [--no-install] [--non-helenos-target] <platform>" 64 echo " $0 [--system-wide] --test-version [<platform>]" 64 65 echo 65 66 echo "Possible target platforms are:" … … 79 80 echo " 2-way same as 'all', but 2-way parallel" 80 81 echo 81 echo "The toolchain is installed into directory specified by the" 82 echo "CROSS_PREFIX environment variable. If the variable is not" 83 echo "defined, /usr/local/cross/ is used as default." 84 echo 85 echo "If --no-install is present, the toolchain still uses the" 86 echo "CROSS_PREFIX as the target directory but the installation" 87 echo "copies the files into PKG/ subdirectory without affecting" 88 echo "the actual root file system. That is only useful if you do" 89 echo "not want to run the script under the super user." 90 echo 91 echo "The --non-helenos-target will build non-HelenOS-specific toolchain" 92 echo "(i.e. it will use *-linux-* triplet instead of *-helenos)." 82 echo "The toolchain target installation directory is determined by matching" 83 echo "the first of the following conditions:" 84 echo 85 echo " (1) If the \$CROSS_PREFIX environment variable is set, then it is" 86 echo " used as the target installation directory." 87 echo " (2) If the --system-wide option is used, then /opt/HelenOS/cross" 88 echo " is used as the target installation directory. This usually" 89 echo " requires running this script with super user privileges." 90 echo " (3) In other cases, \$XDG_DATA_HOME/HelenOS/cross is used as the" 91 echo " target installation directory. If the \$XDG_DATA_HOME environment" 92 echo " variable is not set, then the default value of \$HOME/.local/share" 93 echo " is assumed." 94 echo 95 echo "If the --no-install option is used, the toolchain still uses the" 96 echo "target installation directory as determined above, but the files" 97 echo "are actually copied into the PKG/ subdirectory during the installation" 98 echo "without affecting the actual target file system. This might be useful" 99 echo "when preparing a system-wide installation, but avoiding running this" 100 echo "script under the super user." 101 echo 102 echo "The --non-helenos-target option will build non-HelenOS-specific" 103 echo "toolchain (i.e. it will use *-linux-* triplet instead of *-helenos)." 93 104 echo "Using this toolchain for building HelenOS is not supported." 94 105 echo 106 echo "The --test-version mode tests the currently installed version of the" 107 echo "toolchain." 95 108 96 109 exit 3 97 110 } 98 111 112 set_cross_prefix() { 113 if [ -z "$CROSS_PREFIX" ] ; then 114 if $SYSTEM_INSTALL ; then 115 CROSS_PREFIX="/opt/HelenOS/cross" 116 else 117 if [ -z "$XDG_DATA_HOME" ] ; then 118 XDG_DATA_HOME="$HOME/.local/share" 119 fi 120 CROSS_PREFIX="$XDG_DATA_HOME/HelenOS/cross" 121 fi 122 fi 123 } 124 99 125 test_version() { 100 echo "Cross-compiler toolchain build script" 101 echo 102 echo "Start testing the version of the installed software" 103 echo 104 126 set_cross_prefix 127 128 echo "HelenOS cross-compiler toolchain build script" 129 echo 130 echo "Testing the version of the installed software in $CROSS_PREFIX" 131 echo 132 105 133 if [ -z "$1" ] || [ "$1" = "all" ] ; then 106 134 PLATFORMS='amd64 arm32 arm64 ia32 ia64 mips32 mips32eb ppc32 riscv64 sparc64' … … 108 136 PLATFORMS="$1" 109 137 fi 110 111 112 if [ -z "${CROSS_PREFIX}" ] ; then 113 CROSS_PREFIX="/usr/local/cross" 114 fi 115 116 for i in $PLATFORMS 117 do 118 PLATFORM="$i" 138 139 for PLATFORM in $PLATFORMS ; do 119 140 set_target_from_platform "$PLATFORM" 120 141 PREFIX="${CROSS_PREFIX}/bin/${HELENOS_TARGET}" … … 125 146 test_app_version "GDB" "gdb" "GNU gdb (.*)[[:space:]]\+\([.0-9]*\)" "$GDB_VERSION" 126 147 done 127 128 exit129 148 } 130 149 … … 135 154 INS_VERSION="$4" 136 155 137 138 156 APP="${PREFIX}-${APPNAME}" 139 157 if [ ! -e $APP ]; then … … 148 166 149 167 if [ "$INS_VERSION" = "$VERSION" ]; then 150 echo "+ $PKGNAME is up todate ($INS_VERSION)"168 echo "+ $PKGNAME is up-to-date ($INS_VERSION)" 151 169 else 152 170 echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)" … … 155 173 } 156 174 157 158 159 175 change_title() { 160 176 printf "\e]0;$1\a" … … 178 194 179 195 show_dependencies() { 196 set_cross_prefix 197 198 echo "HelenOS cross-compiler toolchain build script" 199 echo 200 echo "Installing software to $CROSS_PREFIX" 201 echo 202 echo 180 203 echo "IMPORTANT NOTICE:" 181 204 echo … … 255 278 check_error $? "Change directory failed." 256 279 280 change_title "Downloading sources" 257 281 echo ">>> Downloading sources" 258 282 git clone --depth 1 -b "$BINUTILS_BRANCH" "$BINUTILS_GDB_GIT" "binutils-$BINUTILS_VERSION" … … 265 289 git -C "gcc-$GCC_VERSION" pull 266 290 291 change_title "Downloading GCC prerequisites" 267 292 echo ">>> Downloading GCC prerequisites" 268 293 cd "gcc-${GCC_VERSION}" … … 325 350 GDBDIR="${WORKDIR}/gdb-${GDB_VERSION}" 326 351 327 if [ -z "${CROSS_PREFIX}" ] ; then 328 CROSS_PREFIX="/usr/local/cross" 329 fi 352 # This sets the CROSS_PREFIX variable 353 set_cross_prefix 330 354 331 355 if [ -z "$JOBS" ] ; then 332 JOBS= `nproc`356 JOBS="`nproc`" 333 357 fi 334 358 … … 341 365 342 366 if $USE_HELENOS_TARGET ; then 367 change_title "Creating build sysroot" 343 368 echo ">>> Creating build sysroot" 344 369 mkdir -p "${WORKDIR}/sysroot/include" … … 355 380 check_error $? "Failed to create build sysroot." 356 381 fi 382 357 383 358 384 echo ">>> Processing binutils (${PLATFORM})" … … 416 442 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libgcc -j$JOBS 417 443 check_error $? "Error compiling libgcc." 418 # TODO: needssome extra care419 # PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libatomic -j$JOBS420 # check_error $? "Error compiling libatomic."421 # PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libstdc++-v3 -j$JOBS422 # check_error $? "Error compiling libstdc++."444 # TODO: libatomic and libstdc++ need some extra care 445 # PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libatomic -j$JOBS 446 # check_error $? "Error compiling libatomic." 447 # PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libstdc++-v3 -j$JOBS 448 # check_error $? "Error compiling libstdc++." 423 449 fi 424 450 … … 427 453 if $USE_HELENOS_TARGET ; then 428 454 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libgcc "DESTDIR=${INSTALL_DIR}" 429 # PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libatomic "DESTDIR=${INSTALL_DIR}"430 # PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libstdc++-v3 "DESTDIR=${INSTALL_DIR}"455 # PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libatomic "DESTDIR=${INSTALL_DIR}" 456 # PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libstdc++-v3 "DESTDIR=${INSTALL_DIR}" 431 457 fi 432 458 check_error $? "Error installing GCC." … … 463 489 if $REAL_INSTALL ; then 464 490 echo ">>> Moving to the destination directory." 465 echo cp -r -t "${PREFIX}" "${INSTALL_DIR}/${PREFIX}/"*466 491 cp -r -t "${PREFIX}" "${INSTALL_DIR}/${PREFIX}/"* 467 492 fi … … 479 504 while [ "$#" -gt 1 ] ; do 480 505 case "$1" in 506 --system-wide) 507 SYSTEM_INSTALL=true 508 shift 509 ;; 481 510 --test-version) 482 511 test_version "$2" … … 504 533 --test-version) 505 534 test_version 535 exit 506 536 ;; 507 537 amd64|arm32|arm64|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
Note:
See TracChangeset
for help on using the changeset viewer.