Project 1 Setup The purpose of this document is to help you to prepare your development machine for the project by: 1. Installing any missing tools 2. Setting up required environment variables and paths If any step stops prematurely and shows an error message, do not proceed forward. Log your error message and read the error message. Some common errors can be figured out with a quick web search. If you need assistance, be sure to include your error message and the following details, when posting on the class discussion board or when emailing the TA. More specifically, when you raise a question on piazza, please upload the packages.txt along with the output of the following commands. This way we can debug your problem much faster. Some relevant details are the output of: 1. uname -a 2. cat /etc/*release 3. whereis java 4. java -version 5. echo $PATH Also, run this command $ dpkg --get-selections > packages.txt Giving the model number of your laptop would also be good. If you are new to working in a linux environment, please be sure to take the time to learn some basics on your own. This class assumes that all students are comfortable with C development on Linux. Host hardware and software requirements 1. Intel ISA, 64 bit machine (x86_64) is required. If you do not own a Intel based 64 bit m/c, you can use one in the CSE department s embedded systems lab. 2. This guide was tested on a machine running Ubuntu 64-bit 10.04. It may not work correctly for other versions of Ubuntu. Please note, the iso for this ubuntu version is referred as 64-bit PC (AMD64) desktop CD.
3. We recommend sun s java, i.e. Java(TM) SE Runtime Environment and not openjdk, i.e. OpenJDK Runtime Environment. 4. For certain commands root access through sudo command is required. 5. The repository alone (source code and binaries) will need at least 40 GB. Depending on the restrictions of the ubuntu installer you are using, it may be a wise move to allocate space for work_folder in a different partition (a disk space of at least 40 GB for this partition). So overall, 40GB for work_folder and an additional 15 GB for the root partition of Linux (ubuntu). Ubuntu 10.04 versus Ubuntu 12.04 vs Embedded Systems Lab - What should I do? 1. As specified earlier, queries with regard to cross-compiling on 10.04 ubuntu (not 12.04) is what we are going to support. 2. Please use embedded systems lab if your are not able to install 10.04 on your system. 3. You can continue to use embedded systems lab for other assignments too. 4. The cross-compiler you will build as part of first assignment may be needed throughout the quarter. In other words, cross-compiler setup is a must. Either you should have it on your personal laptops or in the embedded systems lab. 5. The requirements for being able to connect your mobile to your laptop are different, and more on that will follow in the next assignment. Requirements for future assignments TBA Ubuntu installation Refer http://www.ubuntu.com/download/help/create-a-usb-stick-on-windows. Preferably use this installer for installing on systems with windows is pre-installed - http://www.pendrivelinux.com/ For the iso file refer - http://releases.ubuntu.com/lucid/ You will have to use - 64-bit PC (AMD64) desktop CD (which is nothing but ubuntu for 64 bit Intel ISA - x86_64)
Once you have a working Ubuntu ready, carry out the following. Install necessary packages $ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" $ sudo apt-get update $ sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \ x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \ libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \ libxml2-utils xsltproc Setting up java We recommend sun s java and not openjdk. Following are the steps to install sun s java and set it as your default java. $ mkdir myjava Go to oracle website and register for account - http://www.oracle.com/index.html Once registered go to this page http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archivedownloads-javase6-419409.html and download the latest of Java SDK 6 (from the oracle website) to myjava directory. Note: Change the following steps based on the name of the downloaded java bin file and the name of the generated folder. Now, here are the actual steps for installation of java /myjava $ chmod +x jdk-6u33-linux-x64.bin $ sudo./jdk-6u33-linux-x64.bin $ sudo mv jdk1.6.0_33 /usr/lib/jvm/ Now, make sun s java (or oracle s java) as your default java $sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_33/bin/java 1 $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_33/bin/javac 1 $ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_33/bin/javaws 1
$ sudo update-alternatives --config java $ sudo update-alternatives --config javac $ sudo update-alternatives --config javaws To check the java setup run $java -version Note: Among other things the output should say Java(TM) SE Runtime Environment and not OpenJDK Runtime Environment. Note: The number 1 in the end was chosen so that the priority of sun s java is higher than openjdk. The number has to be changed depending on the priority of openjdk, in case you also have open jdk on your system. Download the repository To download the source code (about 1GB, so plan accordingly), do the following: $ sudo apt-get -y install git-core $ mkdir mybin $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/mybin/repo $ cd mybin $ chmod a+x repo $ export PATH=~/mybin:$PATH Note: The repository may need up to 40GB disk space. Depending on the restrictions of the installer, it may be a wise move to allocate space for work_folder in a different partition (space of at least 40 GB). $ mkdir work_folder $ cd work_folder $ repo init -u git://codeaurora.org/platform/manifest.git -b ics_chocolate -m M8260AAABQNLZA30135.xml --repo-url=git://codeaurora.org/tools/repo.git (At this point a.repo directory should be present in the work_folder) Next,
$ repo sync -j4 ( or j8 depending on the number of cores on your Linux machine) If this download is interrupted, you may continue where you left off by running the last command again. FAQ for repo download: 1. Error of the type xyz does not exist. Stop Disk space issue 2. Downloaded the repository to a wrong location? Can continue by substituting work_folder name in subsequent steps with the name of the download location/directory. However, please no not try to move the repository from one directory to another. That will most likely not work. 3. Plan to start from scratch? If you plan to start the download from scratch, just delete the work_folder. Any other repo related folders or files can be deleted (including.repo ), other than the actual repo utility. Additionally, please check the make clean related note I have put, in the compilation section of this document. 4. Errors saying xyz killed Turn off the 'idle sleep' OR allocate more memory space in VM. Wrt. a real machine if your RAM size is small then hard luck. 5. Repo utility update Sometimes the repo init command may suggest for an update to repo. Follow the instructions as suggested, to replace the older repo version with the new one. Apply a patch and place a required library file $ mkdir patches $ cd patches Download the patch file 0001-patch-for-CAF-and-device-build.patch from the class website. Download libtime_genoff.so file from TED (for cse237a). /work_folder/device/qcom/msm8660_surf $ patch -p1 < ~/patches/0001-patch-for-caf-and-device-build.patch $ cd work_folder
$ mkdir out/ $ mkdir out/target/ $ mkdir out/target/product/ $ mkdir out/target/product/msm8660_surf/ $ mkdir out/target/product/msm8660_surf/obj/ $ mkdir out/target/product/msm8660_surf/obj/lib $ cp ~/patches/libtime_genoff.so out/target/product/msm8660_surf/obj/lib/ Compile the tool chain To configure and compile the source code, do the following: /work_folder $ source build/envsetup.sh $ choosecombo 1 msm8660_surf eng $ make -j4 ( or j8 depending on the number of cores on your Linux machine) (This command takes multiple hours to finish, so make sure your host machine is ready to do this before executing.) It is important that you should not get any errors in this step. Note: If you perform a make clean make sure you recreate the out/* directories and place the.so file again, as specified before. FAQ for compilation IMPORTANT NOTICE: Following commands are not essential. In fact they can complicate the setup. So fire them only if you face issues during compilation (i.e. in the make step), and do not see any other way to proceed further. 1. For errors of the type - unknown architecture `armv7-a' $ sudo apt-get upgrade 2. For errors of the type - /bin/bash: jar: command not found $ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_33/bin/jar 1 3. For errors wrt. javadoc, $ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_33/ bin/javadoc 1 Cross compile the test C file $ mkdir cross_compile
$ cd cross_compile copy test.c and agcc.v2 from the class website into this directory $ chmod a+x agcc.v2 $ export PATH=~/work_folder/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin:$PATH $./agcc.v2 -o test.out test.c To check whether cross-compiling has worked: $file test.out Output should be something like test.out: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped About submission Submit test.out through TED. &&&&&&&& Please follow piazza for more details. &&&&&&&&&&&&