forked from Mirror/pmbootstrap
Add envkernel.sh argument to use gcc6 cross compiler
This commit is contained in:
parent
e27f11a705
commit
a2484f2492
1 changed files with 30 additions and 4 deletions
|
@ -89,12 +89,18 @@ check_device() {
|
||||||
|
|
||||||
|
|
||||||
initialize_chroot() {
|
initialize_chroot() {
|
||||||
|
gcc_pkgname="gcc"
|
||||||
|
if [ "$gcc6_arg" = "1" ]; then
|
||||||
|
gcc_pkgname="gcc6"
|
||||||
|
fi
|
||||||
|
|
||||||
# Don't initialize twice
|
# Don't initialize twice
|
||||||
flag="$chroot/tmp/envkernel/setup_done"
|
flag="$chroot/tmp/envkernel/${gcc_pkgname}_setup_done"
|
||||||
[ -e "$flag" ] && return
|
[ -e "$flag" ] && return
|
||||||
|
|
||||||
# Install needed packages
|
# Install needed packages
|
||||||
echo "Initializing Alpine chroot (details: 'pmbootstrap log')"
|
echo "Initializing Alpine chroot (details: 'pmbootstrap log')"
|
||||||
|
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
$pmbootstrap -q chroot -- apk -q add \
|
$pmbootstrap -q chroot -- apk -q add \
|
||||||
abuild \
|
abuild \
|
||||||
|
@ -103,8 +109,8 @@ initialize_chroot() {
|
||||||
binutils \
|
binutils \
|
||||||
bison \
|
bison \
|
||||||
flex \
|
flex \
|
||||||
gcc-"$deviceinfo_arch" \
|
"$gcc_pkgname"-"$deviceinfo_arch" \
|
||||||
gcc \
|
"$gcc_pkgname" \
|
||||||
linux-headers \
|
linux-headers \
|
||||||
libressl-dev \
|
libressl-dev \
|
||||||
make \
|
make \
|
||||||
|
@ -146,11 +152,17 @@ set_alias_make() {
|
||||||
arm*) arch="arm" ;;
|
arm*) arch="arm" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ "$gcc6_arg" = "1" ]; then
|
||||||
|
cross_compiler="/usr/bin/gcc6-$prefix-"
|
||||||
|
else
|
||||||
|
cross_compiler="/usr/bin/$prefix-"
|
||||||
|
fi
|
||||||
|
|
||||||
# Build make command
|
# Build make command
|
||||||
cmd="echo '*** pmbootstrap envkernel.sh active for $PWD! ***';"
|
cmd="echo '*** pmbootstrap envkernel.sh active for $PWD! ***';"
|
||||||
cmd="$cmd pmbootstrap -q chroot --"
|
cmd="$cmd pmbootstrap -q chroot --"
|
||||||
cmd="$cmd ARCH=$arch"
|
cmd="$cmd ARCH=$arch"
|
||||||
cmd="$cmd CROSS_COMPILE=/usr/bin/$prefix-"
|
cmd="$cmd CROSS_COMPILE=$cross_compiler"
|
||||||
cmd="$cmd make -C /mnt/linux O=/mnt/linux/.output"
|
cmd="$cmd make -C /mnt/linux O=/mnt/linux/.output"
|
||||||
# shellcheck disable=SC2139
|
# shellcheck disable=SC2139
|
||||||
alias make="$cmd"
|
alias make="$cmd"
|
||||||
|
@ -165,6 +177,13 @@ set_alias_pmbroot_kernelroot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cross_compiler_version() {
|
||||||
|
pmbootstrap chroot --user -- "${cross_compiler}gcc" --version \
|
||||||
|
2> /dev/null | grep "^.*gcc " | \
|
||||||
|
awk -F'[()]' '{ print $1 "("$2")" }'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
# shellcheck disable=SC2039
|
# shellcheck disable=SC2039
|
||||||
if [ -n "${BASH_SOURCE[0]}" ]; then
|
if [ -n "${BASH_SOURCE[0]}" ]; then
|
||||||
|
@ -174,12 +193,14 @@ print_usage() {
|
||||||
fi
|
fi
|
||||||
echo "optional arguments:"
|
echo "optional arguments:"
|
||||||
echo " --fish Print fish alias syntax"
|
echo " --fish Print fish alias syntax"
|
||||||
|
echo " --gcc6 Use GCC6 cross compiler"
|
||||||
echo " --help Show this help message"
|
echo " --help Show this help message"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
parse_args() {
|
parse_args() {
|
||||||
unset fish_arg
|
unset fish_arg
|
||||||
|
unset gcc6_arg
|
||||||
|
|
||||||
while [ "${1:-}" != "" ]; do
|
while [ "${1:-}" != "" ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
@ -187,6 +208,10 @@ parse_args() {
|
||||||
fish_arg="$1"
|
fish_arg="$1"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--gcc6)
|
||||||
|
gcc6_arg=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--help)
|
--help)
|
||||||
shift
|
shift
|
||||||
return 0
|
return 0
|
||||||
|
@ -224,6 +249,7 @@ main() {
|
||||||
echo " * kernel source: $PWD"
|
echo " * kernel source: $PWD"
|
||||||
echo " * output folder: $PWD/.output"
|
echo " * output folder: $PWD/.output"
|
||||||
echo " * architecture: $arch ($device is $deviceinfo_arch)"
|
echo " * architecture: $arch ($device is $deviceinfo_arch)"
|
||||||
|
echo " * cross compile: $(cross_compiler_version)"
|
||||||
echo " * aliases: make, kernelroot, pmbootstrap, pmbroot" \
|
echo " * aliases: make, kernelroot, pmbootstrap, pmbroot" \
|
||||||
"(see 'type make' etc.)"
|
"(see 'type make' etc.)"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue