aboutsummaryrefslogtreecommitdiff
path: root/contrib/kiss-chroot
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/kiss-chroot')
-rwxr-xr-xcontrib/kiss-chroot12
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/kiss-chroot b/contrib/kiss-chroot
index 9caa4cf..47a2636 100755
--- a/contrib/kiss-chroot
+++ b/contrib/kiss-chroot
@@ -29,6 +29,14 @@ main() {
[ -d "$1" ] || die Given path does not exist
[ "$(id -u)" = 0 ] || die Script needs to be run as root
+ [ "$2" ] || {
+ march=$(uname -m 2>/dev/null) ||:
+ case "$march" in
+ '') march=native ;;
+ i*86) march=i686 ;;
+ esac
+ }
+
trap 'clean "$1"' EXIT INT
log Mounting /dev, /proc and /sys from host; {
@@ -49,8 +57,8 @@ main() {
SHELL=/bin/sh \
USER=root \
KISS_ASROOT=1 \
- CFLAGS="${2:--march=x86-64 -mtune=generic -pipe -Os}" \
- CXXFLAGS="${2:--march=x86-64 -mtune=generic -pipe -Os}" \
+ CFLAGS="${2:--march=$march -mtune=generic -pipe -Os}" \
+ CXXFLAGS="${2:--march=$march -mtune=generic -pipe -Os}" \
MAKEFLAGS="-j$(nproc 2>/dev/null || echo 1)" \
/bin/sh -l
}