Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
en:xu3_building_kernel [2015/09/23 22:56] moon.linux [Linux] |
en:xu3_building_kernel [2015/10/22 05:19] mdrjr |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | |||
+ | ====== Linux ====== | ||
+ | This page introduce how you can download and compile the Linux system kernel for **ODROID-XU3/XU4**. Generic Linux system needs **gcc version 4.6** to build the Kernel. | ||
+ | |||
+ | ===== Linux Kernel Toolchain ===== | ||
+ | ===== Checkout ===== | ||
+ | ===== Compile ===== | ||
+ | ===== Installation ===== | ||
+ | ===== Getting the Right Kernel ===== | ||
+ | |||
+ | ===== Step-by-Step guide to building a odroid-xu Kernel ===== | ||
+ | |||
+ | === Download the cross tool chain package === | ||
+ | |||
+ | [ http://dn.odroid.com/ODROID-XU/compiler/arm-eabi-4.6.tar.gz ] | ||
+ | |||
+ | <WRAP left round tip 70%> | ||
+ | Note | ||
+ | * This toolchain only used to build the kernel. | ||
+ | * This toolchain is included in the Android source package. ($ANDROID_ROOT/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6) | ||
+ | </WRAP> | ||
+ | |||
+ | === Copy the cross tool package to /opt/toolchains === | ||
+ | If the '/opt/toolchains' directory does not exist in host pc, then create the directory. | ||
+ | |||
+ | <code> | ||
+ | $ sudo mkdir /opt/toolchains | ||
+ | $ sudo cp arm-eabi-4.6.tar.gz /opt/toolchains | ||
+ | $ cd /opt/toolchains | ||
+ | $ sudo tar zxvf arm-eabi-4.6.tar.gz | ||
+ | </code> | ||
+ | |||
+ | === Uncompress the cross tool with tar command === | ||
+ | <code> | ||
+ | $ cd /opt/toolchains | ||
+ | $ sudo tar xvfz arm-eabi-4.6.tar.gz | ||
+ | </code> | ||
+ | |||
+ | === Add Path in your environment file === | ||
+ | Modify your ~/.bashrc file to add a new path with editor (gedit or vi) | ||
+ | <code> | ||
+ | export ARCH=arm | ||
+ | export PATH=${PATH}:/opt/toolchains/arm-eabi-4.6/bin | ||
+ | export CROSS_COMPILE=arm-eabi- | ||
+ | </code> | ||
+ | |||
+ | To apply this change, login again or restart the .bashrc | ||
+ | <code> | ||
+ | $ source ~/.bashrc | ||
+ | </code> | ||
+ | |||
+ | === Check the tool-chain path to see if it is set up correctly or not. === | ||
+ | <code> | ||
+ | $ arm-eabi-gcc -v | ||
+ | Using built-in specs. | ||
+ | COLLECT_GCC=arm-eabi-gcc | ||
+ | COLLECT_LTO_WRAPPER=/opt/toolchain/arm-eabi-4.6/bin/../libexec/gcc/arm-eabi/4.6.x-google/lto-wrapper | ||
+ | Target: arm-eabi | ||
+ | Configured with: /tmp/android-15472/src/build/../gcc/gcc-4.6/configure --prefix=/usr/local --target=arm-eabi --host=x86_64-linux-gnu | ||
+ | --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/tmp/android-15472/obj/temp-install --with- | ||
+ | mpfr=/tmp/android-15472/obj/temp-install --with-mpc=/tmp/android-15472/obj/temp-install --without-ppl --without-cloog --disable-libs | ||
+ | sp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable- | ||
+ | shared --disable-tls --disable-libitm --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --with-abi=aapcs | ||
+ | --with-gcc-version=4.6 --with-binutils-version=2.21 --with-gmp-version=4.2.4 --with-mpfr-version=2.4.1 --with-gdb-version=7.3.x --w | ||
+ | ith-arch=armv5te --with-sysroot=/tmp/android-15472/install/sysroot --with-prefix=/tmp/android-15472/install --with-gold-version=2.21 | ||
+ | --enable-gold --disable-gold --disable-multilib --program-transform-name='s&^&arm-eabi-&' | ||
+ | Thread model: single | ||
+ | gcc version 4.6.x-google 20120106 (prerelease) (GCC) | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ====== Linux ====== | ||
+ | |||
+ | Linux ODROID-XU3/4 works as follow: | ||
+ | |||
+ | It must have at least two partitions. | ||
+ | |||
+ | First Partition must be a FAT32/EXT4 partition. | ||
+ | |||
+ | Second Partition can be whatever the Filesystem that your kernel supports (must be built in). | ||
+ | |||
+ | Note: It is possible to use the first partition as ext4, however its strongly not recommended due to Windows Users lost the capability of changing boot.ini | ||
+ | |||
+ | === Partition Contents === | ||
+ | |||
+ | Partition 1: | ||
+ | * Kernel Image (zImage) | ||
+ | * boot.scr | ||
+ | * exynos5422-odroidxu3.dtb | ||
+ | * uInitrd (if applicable) | ||
+ | |||
+ | Partition 2: | ||
+ | * rootfs (a.k.a. File System) | ||
+ | |||
+ | === Currently Supported Linux Distributions === | ||
+ | * Ubuntu 14.04 [[http://forum.odroid.com/viewtopic.php?f=95&t=5985|Ubuntu 14.04 Forum Thread]] | ||
+ | Note: More distribution support will come with time. | ||
+ | |||
+ | === HDMI Support On Linux === | ||
+ | |||
+ | HDMI support should work out-of-box for everyone including framebuffer console if you experience any issue please contact us on the [[http://forum.odroid.com|ODROID Forums]] | ||
+ | |||
+ | On the provided Ubuntu image there are several examples on how to configure the HDMI to your specific resolution or even lock to a certain resolution. | ||
+ | You can check the configuration file on /media/boot/boot.ini of the Ubuntu Image | ||
+ | |||
+ | === DisplayPort Support on Linux === | ||
+ | |||
+ | For displayport configuration please follow this guide [[http://forum.odroid.com/viewtopic.php?f=95&t=5976|Displayport Guide on ODROID Forums]] | ||
+ | |||
+ | |||
+ | === Kernel Sources === | ||
+ | Kernel sources for ODROID-XU3/4 is on our [[http://github.com/hardkernel/linux|Github]]. | ||
+ | Branch is **odroidxu3-3.10.y** | ||
+ | defconfig is **odroidxu3_defconfig** | ||
+ | |||
+ | === Kernel Rebuild Guide === | ||
+ | <WRAP center round tip 70%> | ||
+ | Note | ||
+ | |||
+ | You must do this steps in **ODROID-XU3/4 board**. You can compile kernel & dtb images in host PC using the cross compiler. But, you cannot create uInitrd ramdisk image in host PC. | ||
+ | Because the binary files in ramdisk image refer to current root file system during the executing 'update-initramfs' command. | ||
+ | </WRAP> | ||
+ | |||
+ | Please follow the instructions below to rebuild the Linux Kernel for ODROID. Those instructions cover native build of the Kernel. | ||
+ | |||
+ | Install dependencies: | ||
+ | <code> | ||
+ | odroid@odroid:~$ sudo apt-get install build-essential libqt4-dev libncurses5-dev git | ||
+ | </code> | ||
+ | Clone Repo: | ||
+ | <code> | ||
+ | odroid@odroid:~$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidxu3-3.10.y odroidxu3-3.10.y | ||
+ | odroid@odroid:~$ cd odroidxu3-3.10.y | ||
+ | </code> | ||
+ | Configure Kernel: | ||
+ | <code> | ||
+ | odroid@odroid:~$ make odroidxu3_defconfig | ||
+ | </code> | ||
+ | Do changes if you need/want: | ||
+ | <code> | ||
+ | odroid@odroid:~$ make menuconfig | ||
+ | </code> | ||
+ | Build Kernel and Modules: | ||
+ | <code> | ||
+ | odroid@odroid:~$ make -j8 | ||
+ | </code> | ||
+ | <WRAP center round important 100%> | ||
+ | ** This explanation assume that your USB memory CARD reader is assigned at /dev/sdb. Be careful!** | ||
+ | </WRAP> | ||
+ | Install zImage & DTB file: | ||
+ | <code> | ||
+ | odroid@odroid:~$ mkdir -p mount | ||
+ | odroid@odroid:~$ sudo mount /dev/sdb1 ./mount | ||
+ | odroid@odroid:~$ sudo cp arch/arm/boot/zImage arch/arm/boot/dts/exynos5422-odroidxu3.dtb /media/boot && sync && sudo umount ./mount | ||
+ | </code> | ||
+ | Install Modules: | ||
+ | <code> | ||
+ | odroid@odroid:~$ sudo mount /dev/sdb2 ./mount | ||
+ | odroid@odroid:~$ sudo make modules_install ARCH=arm INSTALL_MOD_PATH=./mount && sync && sudo umount ./mount | ||
+ | odroid@odroid:~$ rm -rf mount | ||
+ | </code> | ||
+ | Copy .config to /boot for initramfs creation: | ||
+ | <code> | ||
+ | odroid@odroid:~$ sudo cp .config /boot/config-`make kernelrelease` | ||
+ | </code> | ||
+ | Create initramfs: | ||
+ | <code> | ||
+ | odroid@odroid:~$ sudo update-initramfs -c -k `make kernelrelease` | ||
+ | </code> | ||
+ | Create uInitrd: | ||
+ | <code> | ||
+ | odroid@odroid:~$ sudo mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n uInitrd -d /boot/initrd.img-`make kernelrelease` /boot/uInitrd-`make kernelrelease` | ||
+ | </code> | ||
+ | Install new uInitrd: | ||
+ | <code> | ||
+ | odroid@odroid:~$ sudo cp /boot/uInitrd-`make kernelrelease` /media/boot/uInitrd | ||
+ | </code> | ||
+ | reboot: | ||
+ | <code> | ||
+ | odroid@odroid:~$ sudo sync && reboot | ||
+ | </code> | ||
+ | Your new kernel should be installed. | ||
+ | Note for your own convenience we provide daily builds of Linux kernel that can be easily installed on Supported distros by using a ODROID Utility. | ||
+ | <code> | ||
+ | odroid@odroid:~$ sudo -s | ||
+ | root@odroid:~$ wget -O /usr/local/bin/odroid-utility.sh https://raw.githubusercontent.com/mdrjr/odroid-utility/master/odroid-utility.sh | ||
+ | root@odroid:~$ chmod +x /usr/local/bin/odroid-utility.sh | ||
+ | root@odroid:~$ odroid-utility.sh | ||
+ | </code> |