From 48079d08437c1d3e2377feccd72c3a5b3f3514d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Mon, 27 May 2019 00:00:02 +0000 Subject: [PATCH] crosstool-ng: update to crosstool-ng-1.24.0 Fix https://github.com/cirosantilli/linux-kernel-module-cheat/issues/68 Copy source tree into build dir since ./ctng started failing out of tree. I give up. --- build-crosstool-ng | 21 ++++++++++++++------- common.py | 8 ++++---- shell_helpers.py | 14 ++++++++++++-- submodules/crosstool-ng | 2 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/build-crosstool-ng b/build-crosstool-ng index 627a1a9..72e42df 100755 --- a/build-crosstool-ng +++ b/build-crosstool-ng @@ -16,20 +16,27 @@ Build crosstool-NG with Newlib for bare metal compilation def build(self): build_dir = self.get_build_dir() - defconfig_dest = os.path.join(self.env['crosstool_ng_util_dir'], 'defconfig') - os.makedirs(self.env['crosstool_ng_util_dir'], exist_ok=True) + defconfig_dest = os.path.join(self.env['crosstool_ng_source_copy_dir'], 'defconfig') os.makedirs(self.env['crosstool_ng_download_dir'], exist_ok=True) # Bootstrap out-ot-tree WONTFIX. I've tried. # https://github.com/crosstool-ng/crosstool-ng/issues/1021 - os.chdir(self.env['crosstool_ng_source_dir']) - self.sh.run_cmd( - [os.path.join(self.env['crosstool_ng_source_dir'], 'bootstrap'), LF], + # + # Then out-of-tree ./ctng usage also started to fail in 1.24.0. + # + # So instead of fighting upstream, I'll just take the Buildroot approach + # to life and rsync the entire source tree into the build tree. Fun times. + self.sh.copy_dir_if_update( + self.env['crosstool_ng_source_dir'], + self.env['crosstool_ng_source_copy_dir'], + ) + os.chdir(self.env['crosstool_ng_source_copy_dir']) + self.sh.run_cmd( + [os.path.join(self.env['crosstool_ng_source_copy_dir'], 'bootstrap'), LF], ) - os.chdir(self.env['crosstool_ng_util_dir']) self.sh.run_cmd( [ - os.path.join(self.env['crosstool_ng_source_dir'], 'configure'), LF, + os.path.join(self.env['crosstool_ng_source_copy_dir'], 'configure'), LF, '--enable-local', LF, ], ) diff --git a/common.py b/common.py index 059f26c..730ff16 100644 --- a/common.py +++ b/common.py @@ -779,10 +779,10 @@ Incompatible archs are skipped. env['crosstool_ng_buildid_dir'] = join(env['crosstool_ng_out_dir'], 'build', env['crosstool_ng_build_id']) env['crosstool_ng_install_dir'] = join(env['crosstool_ng_buildid_dir'], 'install', env['arch']) env['crosstool_ng_bin_dir'] = join(env['crosstool_ng_install_dir'], 'bin') - env['crosstool_ng_util_dir'] = join(env['crosstool_ng_buildid_dir'], 'util') - env['crosstool_ng_config'] = join(env['crosstool_ng_util_dir'], '.config') - env['crosstool_ng_defconfig'] = join(env['crosstool_ng_util_dir'], 'defconfig') - env['crosstool_ng_executable'] = join(env['crosstool_ng_util_dir'], 'ct-ng') + env['crosstool_ng_source_copy_dir'] = join(env['crosstool_ng_buildid_dir'], 'source') + env['crosstool_ng_config'] = join(env['crosstool_ng_source_copy_dir'], '.config') + env['crosstool_ng_defconfig'] = join(env['crosstool_ng_source_copy_dir'], 'defconfig') + env['crosstool_ng_executable'] = join(env['crosstool_ng_source_copy_dir'], 'ct-ng') env['crosstool_ng_build_dir'] = join(env['crosstool_ng_buildid_dir'], 'build') env['crosstool_ng_download_dir'] = join(env['crosstool_ng_out_dir'], 'download') diff --git a/shell_helpers.py b/shell_helpers.py index 9b6580b..c64a514 100644 --- a/shell_helpers.py +++ b/shell_helpers.py @@ -139,7 +139,12 @@ class ShellHelpers: ending = last_newline + ';' return newline_separator.join(out) + ending - def copy_dir_if_update_non_recursive(self, srcdir, destdir, filter_ext=None): + def copy_dir_if_update_non_recursive( + self, + srcdir, + destdir, + filter_ext=None + ): # TODO print rsync equivalent. os.makedirs(destdir, exist_ok=True) for basename in sorted(os.listdir(srcdir)): @@ -153,7 +158,12 @@ class ShellHelpers: ): self.cp(src, dest) - def copy_dir_if_update(self, srcdir, destdir, filter_ext=None): + def copy_dir_if_update( + self, + srcdir, + destdir, + filter_ext=None + ): self.copy_dir_if_update_non_recursive(srcdir, destdir, filter_ext) srcdir_abs = os.path.abspath(srcdir) srcdir_abs_len = len(srcdir_abs) diff --git a/submodules/crosstool-ng b/submodules/crosstool-ng index d5900de..b2151f1 160000 --- a/submodules/crosstool-ng +++ b/submodules/crosstool-ng @@ -1 +1 @@ -Subproject commit d5900debd397b8909d9cafeb9a1093fb7a5dc6e6 +Subproject commit b2151f1dba2b20c310adfe7198e461ec4469172b