2013-02-01 36 views
0

生成C工具鏈的問題我有一個自定義Linux由硬件供應商根據版本2.6.18修改的內核。我需要爲它使用最新版本的uClibc生成一個新的工具鏈,用於MIPS拱門。爲自定義Linux 2.6.18

我選擇了工具crosstool-ng來簡化過程,但在生成過程中失敗。這裏是錯誤部分的日誌:

[INFO ] ================================================================= 
[INFO ] Installing kernel headers 
[DEBUG] Using kernel's headers_install 
[EXTRA] Installing kernel headers 
[DEBUG] ==> Executing: 'make' '-C' '/home/myuser/sources/custom-linux/toolchain/.build/src/linux-custom' 'O=/home/myuser/sources/custom-linux/toolchain/.build/mipsel-unknown-linux-uclibc/build/build-kernel-headers' 'ARCH=mips' 'INSTALL_HDR_PATH=/home/myuser/x-tools/mipsel-unknown-linux-uclibc/mipsel-unknown-linux-uclibc/sysroot/usr' 'V=0' 'headers_install' 
[ALL ] make[1]: Entering directory `/home/myuser/sources/custom-linux/stblinux-2.6.18' 
[ALL ]  CHK  include/linux/version.h 
[ALL ]  UPD  include/linux/version.h 
[ALL ] *** Error: Headers not exportable for this architecture (mips) 
[ERROR] make[2]: *** [headers_install] Error 1 
[ERROR] make[1]: *** [headers_install] Error 2 
[ALL ] make[1]: Leaving directory `/home/myuser/sources/custom-linux/stblinux-2.6.18' 
[ERROR] 
[ERROR] >> 
[ERROR] >> Build failed in step 'Installing kernel headers' 
[ERROR] >>  called in step '(top-level)' 
[ERROR] >> 
[ERROR] >> Error happened in: CT_DoExecLog[scripts/[email protected]] 
[ERROR] >>  called from: do_kernel_install[scripts/build/kernel/[email protected]] 
[ERROR] >>  called from: do_kernel_headers[scripts/build/kernel/[email protected]] 
[ERROR] >>  called from: main[scripts/[email protected]] 
[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] >>  '/home/myuser/.local/share/doc/crosstool-ng/ct-ng.hg+default-20f2459b97bf/B - Known issues.txt' 
[ERROR] 
[ERROR] (elapsed: 41:41.63) 

這個問題似乎與* headers_install *規則有關。我認爲它是與特定版本的內核一起引入的。有趣的事實是,如果我運行

make ARCH=mips INSTALL_HDR_PATH=... headers_install 

標題將被安裝得很好。該問題似乎在使用O =參數時發生。有誰知道它是幹什麼用的?有沒有解決這個問題的方法?

+0

1.使用第二個make時,headers_install規則是否運行? –

+0

2. * mipsel-unknown-linux-uclibc *似乎值得研究 - 在構建過程中,當構建工具宣稱某些東西被**爲未知**時,我總是感到有趣。 –

+0

@MarkLeightonFisher是的。 – ivarec

回答

0

問題在於此Linux內核版本中不存在headers_install規則。它被列入2.6.19.1

現代Linux內核(基於2.6.19.1及更高版本)的出口內核通過「做出的headers_install」命令 頭。

https://www.kernel.org/doc/index-old.html#3.2.2.3.1

由於的buildroot預計這一規則存在,我猜,它並沒有定製修補工作。

0

構建交叉編譯器/ binutils通常非常困難,而且它不允許您測試程序。
虛擬機速度很慢,創建了一個強大的分離空間,很難在主機和虛擬機之間共享文件。

最簡單的解決方案是Qemu-User-static:系統調用和指令以用戶模式封裝到本地內核。

下載或解壓rootfs。
將其複製到您真實根目錄的子文件夾中。
將qemu-user-(您的mips拱門的名稱) -static複製到目標目錄的根目錄。
將/etc/resolv.conf複製到/your_path_to_target/etc/resolv.conf 通過執行/ bin/bash來實現chroot。
使用rootfs,就好像您使用的是真正的基於mips的。機。

事情變得非常簡單:許多庫不會編譯,因爲硬編碼路徑等問題(您將遇到許多問題,如交叉編譯時遇到的問題)。這裏都發生在你本身生成軟件包的地方。