2010年8月16日 星期一

移植 bash 到 ARM 開發板

http://www.gnu.org/software/bash/ 下載 bash-4.1.tar.gz。

解開下載的 bash-4.1.tar.gz,然後選擇一個適當的 cross compiler,並執行 configure。

CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-linux \
--target=arm-none-linux-gnueabi --enable-static-link \
--enable-history --without-bash-malloc

原則上執行完 configure 就可以執行 make 編譯了。若想得到靜態編譯的 bash 可執行檔,則再對 Makefile 稍作修改即可。

diff -Naur old/Makefile new/Makefile 
--- old/Makefile 2010-08-15 15:34:58.489728811 +0000
+++ new/Makefile 2010-08-15 15:35:34.877136059 +0000
@@ -120,7 +120,7 @@
# with gprof, or nothing (the default).
PROFILE_FLAGS=

-CFLAGS = -g -O2
+CFLAGS = -g -O2 -static
CFLAGS_FOR_BUILD = -g -DCROSS_COMPILING
CPPFLAGS =
CPPFLAGS_FOR_BUILD =

沒有留言: