kernel: configure: Pass arch as an extra argument
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Dec 2018 14:20:51 +0000 (14:20 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Dec 2018 14:20:51 +0000 (14:20 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
kernel/README.md
kernel/scripts/configure

index 26a3f79..90083aa 100644 (file)
@@ -17,7 +17,8 @@ the kernel directory:
   # pakfire-builder shell kernel.nm
   (pakfire-shell)> cd /usr/src/packages/kernel-x.y.z...
 
-The following commands are available:
+The following commands are available. Appending the <arch> argument allows you
+to edit a specific architecture. Default is x86_64.
 
 #### oldconfig
 
@@ -25,7 +26,7 @@ You can run this when updating the kernel to a new release or after changing any
 options manually. All unset or updated options will be prompted for and all
 configuration files for all architectures will be updated.
 
-  (pakfire-shell)> scripts/configure oldconfig
+  (pakfire-shell)> scripts/configure oldconfig <arch>
 
 #### olddefconfig
 
@@ -39,13 +40,10 @@ If you want to edit the configuration using the kernel's config editor. All
 configuration files will be updated afterwards and potentially prompted for options
 that diverge for different architectures.
 
-  (pakfire-shell)> scripts/configure menuconfig
-
-Appending the --arch= argument allows you to edit a specific architecture.
-Default is x86_64.
+  (pakfire-shell)> scripts/configure menuconfig <arch>
 
 #### listnewconfig
 
 This will list all unset options.
 
-  (pakfire-shell)> scripts/configure listnewconfig
+  (pakfire-shell)> scripts/configure listnewconfig <arch>
index 2d45dd1..b2c1fa3 100755 (executable)
@@ -164,8 +164,13 @@ function merge_config() {
 
 # This function runs an interactive "make oldconfig".
 function make_config() {
-       local arch="${1}"
-       shift
+       local action="${1}"
+       local arch="${2}"
+
+       # Default to x86_64 when no arch is given
+       if [ -z "${arch}" ]; then
+               arch="x86_64"
+       fi
 
        # Detect kernel arch
        local kernel_arch="$(get_kernel_arch "${arch}")"
@@ -182,7 +187,7 @@ function make_config() {
                cat ${config_in} > .config
 
                echo "You may now edit the configuration..."
-               make ARCH=${kernel_arch} "$@"
+               make ARCH=${kernel_arch} "${action}"
 
                cat .config > ${config_out}
                popd
@@ -296,7 +301,6 @@ function diff_configs() {
        rm -rf ${tmpdir}
 }
 
-ARCH="x86_64"
 KERNEL_DIR="$(search_kernel_dir)"
 
 # Parse commandline.
@@ -313,16 +317,7 @@ while [ $# -gt 0 ]; do
                        ;;
                listnewconfig|menuconfig|merge|oldconfig|olddefconfig)
                        action=${arg}
-                       ;;
-
-               # Parse switches
-               --arch=*)
-                       ARCH="${arg#*=}"
-
-                       if ! get_platform "${ARCH}" &>/dev/null; then
-                               echo "Unknown architecture: ${ARCH}" >&2
-                               exit 2
-                       fi
+                       break
                        ;;
        esac
 done
@@ -343,7 +338,7 @@ case "${action}" in
                exit $?
                ;;
        listnewconfig|menuconfig|oldconfig|olddefconfig)
-               make_config "${ARCH}" "${action}"
+               make_config "${action}" "$@"
                exit $?
                ;;
 esac