安装 IBM Full-System Simulator:PowerPC 970 system (1)

2011年8月3日 

在经理的指导下,找到了这个东东, 说是可以跑AIX,但从我找到的资料来看,貌似只能跑Power PC 的LInux,呵呵,先不管那么多,就算是那至少也可以模式PPC的环境,跟上海移动的环境就更接近了一步。

###1、相关介绍和下载:

http://www.alphaworks.ibm.com/tech/systemsim970

其安装步骤可以参考: SystemSim_Installation.pdf,在下载页面可以找到这个文件。

我下载的是SystemSim_x86_rh8_2.0.tar.bz2,可以抛在RedHat8和9。

###2、注意要新建一个用户来安装这个东东,否则会提示:

+ abort 'Don'''t run all.sh or crosstool.sh as root, it'''s dangerous'
+ echo 'Don'''t' run all.sh or crosstool.sh as root, 'it'''s' dangerous

具体新建用户并且对文件进行授权就不说了。

###3、根据pdf文档的步骤来,但这个过程应该没那么顺利,许多问题要排解,比如少了哪个包啦,什么东东冲突啦,等等。这里说下我遇到的吧。

      3.1 需要安装bison、flex

        3.2 在make kernel_all的时候,出现了让我搞了一天多的问题:

在get kernel这个模块里,git clone 这个命令总是Connection timed out(git clone git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/systemsim.git)

试过设置防火墙规则,关闭防火墙都没用,改Makefile里的git://为http://说不支持http协议,搞了大半天没搞好。

2011年8月4日 

今天继续....

这个东东自己带的git是1.2.3的版本,决定自己编译一个,用的是1.7的版本。可能需要python-devel.

让git支持http协议,安装curl,和expat

具体参考:

http://git.661346.n2.nabble.com/fatal-Unable-to-find-remote-helper-for-http-td5041606.html

然后修改toolchain目录下的Makefile:

##############

SDK_PROJECT=gpul
SDK_VERSION=2.0
SDK_ROOT=$(shell cd .. && pwd)


DATE=$(shell date +%G%m%d)




# Userful locations
COMPILERS_DIR=$(SDK_ROOT)/compilers
TOOLCHAIN_DIR = $(SDK_ROOT)/toolchain
PACKAGES_DIR = $(TOOLCHAIN_DIR)/src/packages
IMAGES_DIR = $(SDK_ROOT)/images
BIN_DIR = $(SDK_ROOT)/bin


# Crosstool stuff
CROSSTOOL_SRC = crosstool-0.42
CROSSTOOL_NAME = gcc-4.1.0-glibc-2.3.6
CROSSTOOL_TOOLS = $(CROSSTOOL_NAME).dat
CROSSTOOL_PREFIX = powerpc64-unknown-linux-gnu


CROSSTOOL_DEST_DIR = $(COMPILERS_DIR)/gnu/$(CROSSTOOL_PREFIX)
CROSSTOOL_32BIT = powerpc-750.dat
CROSSTOOL_64BIT = powerpc-970.dat
CROSSTOOL_LANG = "c"




# Set the host to a 32-bit platform
CROSSTOOL_HOST=""


HOST_MACHINE=$(shell uname -m)


# check for any x86 system
ifeq (86,$(findstring 86,$(HOST_MACHINE)))
CROSSTOOL_HOST=i386-unknown-linux-gnu
endif
                                                                                                          
# check for generic PowerPC
ifeq (ppc,$(findstring ppc,$(HOST_MACHINE)))
CROSSTOOL_HOST=powerpc-unknown-linux-gnu
endif




# Git stuff
#GIT_SRC = git-1.2.3
GIT_SRC=/home/linshutao/git-1.7.0.5
#GIT_DIR=$(TOOLCHAIN_DIR)/git
GIT_DIR=/home/linshutao/git-1.7.0.5


# zisofs tools stuff
ZTOOLS_SRC = zisofs-tools-1.0.6
ZTOOLS_DIR=$(TOOLCHAIN_DIR)/ztools


# Kernel stuff
ARCH=powerpc


CANONICAL_PATH = $(CROSSTOOL_DEST_DIR)/bin:/bin:/usr/bin
CROSS_COMPILE  = $(CROSSTOOL_DEST_DIR)/bin/$(CROSSTOOL_PREFIX)-
LINUX_CPPFLAGS =-D__KERNEL__ -I$(LINUX_DIR) -I$(LINUX_DIR)/include 


LINUX_VER=2.6.16
LINUX_BRANCH=systemsim-$(LINUX_VER)
LINUX_TAG=GPUL_AlphaWorks_2_0_0
LINUX_SRC=linux-$(LINUX_VER)


LINUX_CONFIG = systemsim_defconfig
LINUX_DIR=$(SDK_ROOT)/toolchain/src/linux


# Rootdisk stuff
ROOTDISK_ISO = install-ppc64-minimal-2006.0.iso
GENTOO_MIRROR = http://gentoo.osuosl.org


default:


################################################
#
# Source downloading. wget required.
#
################################################


$(PACKAGES_DIR)/$(CROSSTOOL_SRC).tar.gz:
cd $(PACKAGES_DIR) && wget http://kegel.com/crosstool/$(CROSSTOOL_SRC).tar.gz


$(PACKAGES_DIR)/$(GIT_SRC).tar.gz:
cd $(PACKAGES_DIR) && wget http://kernel.org/pub/software/scm/git/$(GIT_SRC).tar.gz


get_kernel: $(GIT_DIR)/git
cd src && $(GIT_DIR)/git clone http://git.kernel.org/pub/scm/linux/kernel/git/ericvh/systemsim.git/ $(LINUX_SRC)
cd src && tar cjf $(PACKAGES_DIR)/$(LINUX_SRC).tar.bz2 $(LINUX_SRC)
cd src && rm -rf $(LINUX_SRC)


$(PACKAGES_DIR)/$(LINUX_SRC).tar.bz2: 
$(MAKE) get_kernel

$(PACKAGES_DIR)/$(ZTOOLS_SRC).tar.gz:
cd $(PACKAGES_DIR) && wget http://kernel.org/pub/linux/utils/fs/zisofs/$(ZTOOLS_SRC).tar.gz


$(IMAGES_DIR)/$(ROOTDISK_ISO):
cd $(IMAGES_DIR) && wget $(GENTOO_MIRROR)/releases/ppc64/current/ppc64/installcd/$(ROOTDISK_ISO)


################################################
#
# Toolchain
#
################################################


clean_toolchain: 
-cd src && rm -rf $(CROSSTOOL_SRC)
-cd src && rm crosstool


unpack_toolchain: $(PACKAGES_DIR)/$(CROSSTOOL_SRC).tar.gz
cd src && tar xzf packages/$(CROSSTOOL_SRC).tar.gz
cd src && ln -s $(CROSSTOOL_SRC) crosstool


build_toolchain64:
cd src/crosstool &&
GCC_BUILD=$(CROSSTOOL_HOST)
TARBALLS_DIR=$(PACKAGES_DIR)
RESULT_TOP=$(COMPILERS_DIR)
GCC_LANGUAGES=$(CROSSTOOL_LANG)
eval `cat $(CROSSTOOL_64BIT) $(CROSSTOOL_TOOLS)` sh all.sh --notest


build_toolchain32: 
cd src/crosstool &&
GCC_BUILD=$(CROSSTOOL_HOST)
TARBALLS_DIR=$(PACKAGES_DIR)
RESULT_TOP=$(COMPILERS_DIR)
GCC_LANGUAGES=$(CROSSTOOL_LANG)
eval `cat $(CROSSTOOL_32BIT) $(CROSSTOOL_TOOLS)` sh all.sh --notest


build_toolchain: build_toolchain32 build_toolchain64
cd $(COMPILERS_DIR) && ln -s $(CROSSTOOL_NAME) gnu


toolchain_all: clean_toolchain unpack_toolchain build_toolchain




################################################
#
# Kernel build
#
################################################
clean_kernel:
-cd src && rm -rf $(LINUX_SRC)
-cd src && rm linux

unpack_kernel: $(PACKAGES_DIR)/$(LINUX_SRC).tar.bz2 $(GIT_DIR)/git
cd src && tar xjf $(PACKAGES_DIR)/$(LINUX_SRC).tar.bz2
cd src/$(LINUX_SRC) && $(GIT_DIR)/git checkout -f $(LINUX_BRANCH)
cd src/$(LINUX_SRC) && $(GIT_DIR)/git checkout -f $(LINUX_TAG)
cd src && ln -s $(LINUX_SRC) linux


$(LINUX_DIR)/.config:
cp $(LINUX_DIR)/arch/$(ARCH)/configs/$(LINUX_CONFIG) $(LINUX_DIR)/.config


configure_kernel: $(LINUX_DIR)/.config
cd $(LINUX_DIR)
&&
PATH=$(CANONICAL_PATH)
LD_LIBRARY_PATH=
$(MAKE)
ARCH=$(ARCH)
"CROSS_COMPILE=${CROSS_COMPILE}"
"CPPFLAGS=${LINUX_CPPFLAGS}"
oldconfig


menuconfig_kernel: 
cp $(LINUX_DIR)/arch/$(ARCH)/configs/$(LINUX_CONFIG) $(LINUX_DIR)/.config
cd $(LINUX_DIR)
&&
PATH=$(CANONICAL_PATH)
LD_LIBRARY_PATH=
$(MAKE)
ARCH=$(ARCH)
"CROSS_COMPILE=${CROSS_COMPILE}"
"CPPFLAGS=${LINUX_CPPFLAGS}"
menuconfig


build_kernel: 
cd $(LINUX_DIR)
&&
PATH=$(CANONICAL_PATH)
LD_LIBRARY_PATH=
$(MAKE)
ARCH=$(ARCH)
"CROSS_COMPILE=${CROSS_COMPILE}"
"CPPFLAGS=${LINUX_CPPFLAGS}"
vmlinux


build_kernel_modules: 
cd $(LINUX_DIR)
&&
PATH=$(CANONICAL_PATH)
LD_LIBRARY_PATH=
$(MAKE)
ARCH=$(ARCH)
"CROSS_COMPILE=${CROSS_COMPILE}"
"CPPFLAGS=${LINUX_CPPFLAGS}"
modules


install_kernel: 
cp -f $(LINUX_DIR)/vmlinux $(SDK_ROOT)/images/vmlinux_$(LINUX_VER)_$(DATE)
ln -sf $(SDK_ROOT)/images/vmlinux_$(LINUX_VER)_$(DATE) $(SDK_ROOT)/images/vmlinux.img


install_kernel_modules:
cd $(LINUX_DIR)
&&
PATH=$(CANONICAL_PATH)
LD_LIBRARY_PATH=
INSTALL_MOD_PATH=$(SDK_ROOT)/toolchain/modules
$(MAKE) modules_install
## ------ FURTHER INSTRUCTIONS ------
## 1. Put the modules in $(SDK_ROOT)/toolchain/modules on the rootdisk in mount_point/lib/modules
## 2. Run "chroot mount_point depmod" to setup the modules dependency files.


kernel_all: clean_kernel unpack_kernel configure_kernel build_kernel install_kernel


################################################
#
# rootdisk build
#
# This must be run as root.
#
################################################


#
# Clean the working directories.
#
clean_rootdisk:
cd $(IMAGES_DIR) && rmdir ppc64_disk_image
cd $(IMAGES_DIR) && rmdir ppc64_iso_image
cd $(IMAGES_DIR) && rm -rf root_unpacked


#
# Add the Systemsim Bogus disk devices to the rootdisk
#
patch_dev:
cd $(IMAGES_DIR)/ppc64_disk_image/dev && mknod mambobd0 b 42 0
cd $(IMAGES_DIR)/ppc64_disk_image/dev && mknod mambobd1 b 42 1
cd $(IMAGES_DIR)/ppc64_disk_image/dev && mknod mambobd2 b 42 2
cd $(IMAGES_DIR)/ppc64_disk_image/dev && mknod mambobd3 b 42 3
cd $(IMAGES_DIR)/ppc64_disk_image/dev && mknod mambobd4 b 42 4
cd $(IMAGES_DIR)/ppc64_disk_image/dev && mknod mambobd5 b 42 5
cd $(IMAGES_DIR)/ppc64_disk_image/dev && mknod mambobd6 b 42 6
cd $(IMAGES_DIR)/ppc64_disk_image/dev && mknod mambobd7 b 42 7
cd $(IMAGES_DIR)/ppc64_disk_image/dev && mknod mambobd8 b 42 8
cd $(IMAGES_DIR)/ppc64_disk_image/dev && mknod mambobd9 b 42 9
#
# Patch inittab to run at runlevel 3, remove any tty calls, remove boot calls
#
patch_inittab:
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && chmod u+w inittab
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && sed "s/id:.:initdefault:/id:3:initdefault:/" inittab >inittab.1
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && sed "s/^.*tty.*//g" inittab.1 > inittab.2
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && echo "mam1:1:respawn:/bin/bash" >> inittab.2
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && echo "mam2:2:respawn:/bin/bash" >> inittab.2
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && echo "mam3:3:respawn:/bin/bash" >> inittab.2
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && echo "mam5:5:respawn:/bin/bash" >> inittab.2
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && sed "s/si::sysinit.*//" inittab.2 > inittab.3
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && sed "s/rc::bootwait.*//" inittab.3 > inittab.4
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && sed "s/l3:3.*//" inittab.4 > inittab.5
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && mv inittab.5 inittab
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && rm inittab.1 inittab.2 inittab.3 inittab.4
#
# Change the root passwod to be empty
#
patch_passwd:
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && chmod u+w passwd
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && sed "s/^root.*/root::0:0:root:/root:/bin/bash/" passwd > passwd.1  
cd $(IMAGES_DIR)/ppc64_disk_image/etc/ && mv passwd.1 passwd


#
# Copy the callthru command to the rootdisk
#
patch_callthru:
cd $(IMAGES_DIR)/ppc64_disk_image/bin && cp $(BIN_DIR)/callthru .


#
# Modify the base rootdisk to work cleanly with SystemSim
#
patch_rootdisk: 
cd $(IMAGES_DIR) && mount ppc64_rootdisk.img ppc64_disk_image -o loop
$(MAKE) patch_dev
$(MAKE) patch_inittab
$(MAKE) patch_passwd
$(MAKE) patch_callthru
cd $(IMAGES_DIR) && umount -d ppc64_disk_image
-cd $(IMAGES_DIR) && /sbin/e2fsck -f -c ppc64_rootdisk.img


#
# Retrieve the rootdisk and transfer it to a newly created disk image
#
build_base_rootdisk: $(IMAGES_DIR)/$(ROOTDISK_ISO) $(ZTOOLS_DIR)/bin/mkzftree
cd $(IMAGES_DIR) && mkdir ppc64_iso_image
cd $(IMAGES_DIR) && mount $(ROOTDISK_ISO) ppc64_iso_image -o loop
cd $(IMAGES_DIR) && $(ZTOOLS_DIR)/bin/mkzftree --uncompress ppc64_iso_image/zisofs root_unpacked
cd $(IMAGES_DIR) && dd if=/dev/zero of=ppc64_rootdisk.img bs=1k count=512k
cd $(IMAGES_DIR) && /sbin/mke2fs -i 1024 -b 1024 -m 5 -F -v ppc64_rootdisk.img
cd $(IMAGES_DIR) && /sbin/tune2fs -c 0 ppc64_rootdisk.img
cd $(IMAGES_DIR) && mkdir ppc64_disk_image
cd $(IMAGES_DIR) && mount ppc64_rootdisk.img ppc64_disk_image -o loop
cd $(IMAGES_DIR)/root_unpacked && find . -depth -print0 | cpio --null -pd ../ppc64_disk_image
cd $(IMAGES_DIR) && umount -d ppc64_iso_image
cd $(IMAGES_DIR) && umount -d ppc64_disk_image
#
# Build the rootdisk and set it up to work with SystemSim default setting
#
build_rootdisk:  
$(MAKE) build_base_rootdisk
$(MAKE) patch_rootdisk
cd $(IMAGES_DIR) && chmod a+r ppc64_rootdisk.img
cd $(IMAGES_DIR) && ln -sf ppc64_rootdisk.img rootdisk.img
$(MAKE) clean_rootdisk

################################################
#
# Git build
#
################################################
#clean_git:
# -cd src && rm -rf $(GIT_SRC)
# -cd src && rm git


#unpack_git: $(PACKAGES_DIR)/$(GIT_SRC).tar.gz
# cd src && tar xzf packages/$(GIT_SRC).tar.gz
# cd src && ln -s $(GIT_SRC) git


#build_git:
# cd src/git &&
# HOME=$(GIT_DIR)
# NO_OPENSSL=1
# NO_CURL=1
# make 
#
# cd src/git &&
# HOME=$(GIT_DIR)
# NO_OPENSSL=1
# NO_CURL=1
# make install
#
#git_all: clean_git unpack_git build_git
#
#$(GIT_DIR)/git: 
#$(MAKE) git_all


################################################
#
# zisofs_tools build
#
################################################
clean_ztools:
-cd src && rm -rf $(ZTOOLS_SRC)
-cd src && rm ztools

unpack_ztools: $(PACKAGES_DIR)/$(ZTOOLS_SRC).tar.gz
cd src && tar xzf packages/$(ZTOOLS_SRC).tar.gz
cd src && ln -s $(ZTOOLS_SRC) ztools


configure_ztools:
cd src/ztools && ./configure --prefix=$(ZTOOLS_DIR)


build_ztools:
cd src/ztools && make


install_ztools:
cd src/ztools && make install


ztools_all: clean_ztools unpack_ztools configure_ztools build_ztools install_ztools


$(ZTOOLS_DIR)/bin/mkzftree:
$(MAKE) ztools_all

###############

然后再make kernel_all



相关内容推荐