Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

crosstool-ng cant fetch linux tarball

I'm trying to build a tool chain using crosstool-ng, I've set it all up, selected my cpu as described on http://crosstool-ng.org/#download_and_usage and I'm at the step where I can build my toolchain. When I enter ct-ng build however, it cancels with the following error:

$ ct-ng build
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20170126.135517
[INFO ]  Building environment variables
[EXTRA]  Preparing working directories
[EXTRA]  Installing user-supplied crosstool-NG configuration
[EXTRA]  =================================================================
[EXTRA]  Dumping internal crosstool-NG configuration
[EXTRA]    Building a toolchain for:
[EXTRA]      build  = x86_64-pc-linux-gnu
[EXTRA]      host   = x86_64-pc-linux-gnu
[EXTRA]      target = powerpc-e500v2-linux-gnuspe
[EXTRA]  Dumping internal crosstool-NG configuration: done in 0.09s (at 00:02)
[INFO ]  =================================================================
[INFO ]  Retrieving needed toolchain components' tarballs
[EXTRA]    Retrieving 'linux-4.3'
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Retrieving needed toolchain components' tarballs'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: do_kernel_get[scripts/build/kernel/linux.sh@741]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@590]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      '/usr/local/share/doc/crosstool-ng/crosstool-ng-1.22.0/B - Known issues.txt'
[ERROR]
[ERROR]  (elapsed: 0:31.10)
[00:31] / make: *** [build] Error 1

In build.log I get the following:

[EXTRA]    Retrieving 'linux-4.3'
...
...
...
[DEBUG]    Not at this location: "http://www.kernel.org/pub/linux/kernel/v4.x/longterm/v4.3/linux-4.3.zip"
[DEBUG]    Trying 'http://www.kernel.org/pub/linux/kernel/v4.x/longterm/linux-4.3.zip'
[DEBUG]    ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--...
[DEBUG]    Not at this location: "http://www.kernel.org/pub/linux/kernel/v4.x/longterm/linux-4.3"
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Retrieving needed toolchain components' tarballs'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: do_kernel_get[scripts/build/kernel/linux.sh@741]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@590]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      '/usr/local/share/doc/crosstool-ng/crosstool-ng-1.22.0/B - Known issues.txt'
[ERROR]
[ERROR]  (elapsed: 0:31.10)

I understand that it's not able to retrieve the kernel, is there a way I can download it manually and tell the script where the tarball is located?

Okay, I realized that wget http://www.kernel.org/pub/linux/kernel/v4.x/linux-4.3.tar.gz will fail but wget --no-check-certificate http://www.kernel.org/pub/linux/kernel/v4.x/linux-4.3.tar.gz will work to download the tarball just fine through the proxy. So I copied /usr/bin/wget to /usr/binwget~origand wrote a wrapper/usr/bin/wget` that looks like:

#!/bin/bash

/usr/bin/wget~orig --no-check-certificate $1

but that doesn't seem to work either, I now get the following in build.log:

[DEBUG]    ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--progress=dot:binary' '-T' '10' '-O' '/home/ron/src/toolchain/work/.build/tarballs/linux-4.3.tar.xz.tmp-dl' 'http://www.kernel.org/pub/linux/kernel/v4.x/linux-4.3.tar.xz'
[ALL  ]    wget~orig: missing URL
[ALL  ]    Usage: wget~orig [OPTION]... [URL]...
[ALL  ]
[ALL  ]    Try `wget~orig --help' for more options.
[DEBUG]    Not at this location: "http://www.kernel.org/pub/linux/kernel/v4.x/linux-4.3.tar.xz"
[DEBUG]    Trying 'http://www.kernel.org/pub/linux/kernel/v4.x/longterm/v4.3/linux-4.3.tar.xz'
[DEBUG]    ==> Executing: 'wget' '--passive-ftp' '--tries=3' '-nc' '--progress=dot:binary' '-T' '10' '-O' '/home/ron/src/toolchain/work/.build/tarballs/linux-4.3.tar.xz.tmp-dl' 'http://www.kernel.org/pub/linux/kernel/v4.x/longterm/v4.3/linux-4.3.tar.xz'
[ALL  ]    wget~orig: missing URL
[ALL  ]    Usage: wget~orig [OPTION]... [URL]...

How does it automagically know that my original wget binary is now called wget~orig??? Andit tries to use that insteadof my wrapper that's now located at /usr/bin/wget (yes, I've added the x permissions and tried it out too, a wget http://www.kernel.org/pub/linux/kernel/v4.x/linux-4.3.tar.gz from the shell (utilizing my wrapper script) works just fine now...

like image 926
stdcerr Avatar asked Jan 26 '17 22:01

stdcerr


2 Answers

You can configure ct-ng to prevent it from downloading sources:

ct-ng menuconfig
  • Go to Path and misc options
  • In *** Downloading ***, select [*] Forbid downloads
  • Exit...

When you try to build your toolchain (ct-ng build) the build process will expect you to put manually downloaded tarballs in ~/src.

Just inspect build.log to know what tarballs are wanted.

like image 93
Mathieu Avatar answered Sep 28 '22 22:09

Mathieu


Okay,

Since wget gets called with muliple (9) arguments, I fixed my wrapper script (at /usr/bin/wget)to look like:

#!/bin/bash

/usr/bin/wget~orig --no-check-certificate $1 $2 $3 $4 $5 $6 $7 $8 $9

That seems to be working succesfully to download the source tarballs required by ct-ng

like image 33
stdcerr Avatar answered Sep 28 '22 21:09

stdcerr