From 65dca52118cb18a475b4395b366b7350fbaea9a9 Mon Sep 17 00:00:00 2001 From: mayfrost Date: Thu, 6 Sep 2018 00:35:26 +0000 Subject: [PATCH] Update CROSS-COMPILING.md --- CROSS-COMPILING.md | 86 ++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/CROSS-COMPILING.md b/CROSS-COMPILING.md index 3fb669f..26ae072 100644 --- a/CROSS-COMPILING.md +++ b/CROSS-COMPILING.md @@ -1,5 +1,5 @@ # CROSS-COMPILING -Installing a distro for ARM. The distro is CRUX, the target is an Odroid C2. The device is appears as "_/dev/mmcblk0_" (with "_/dev/mmcblk0p1_" and "_/dev/mmcblk0p2_" as the partitions) in the target machine, but it can be seen as "_/dev/sdX_" in your x86 computer. +Installing a distro for ARM. The distro is CRUX, the target is an Odroid C2. The device will appears as "_/dev/mmcblk0_" (with "_/dev/mmcblk0p1_" and "_/dev/mmcblk0p2_" as the partitions) in the target machine, but it can be seen as "_/dev/sdX_" in your x86 computer. ## TOC @@ -15,10 +15,10 @@ Installing a distro for ARM. The distro is CRUX, the target is an Odroid C2. The ## CROSS COMPILATION TOOLS Installing GCC cross compilation tools (for the X86 machine, not target ARM). Includes binutils. -* OPTION 1: from repository (Devuan example) +* OPTION 1: From repository (Devuan example) `sudo apt-get install gcc-arm-none-eabi` -* OPTION 2: proportioned by odroid +* OPTION 2: Proportioned by odroid ``` wget http://odroid.in/guides/ubuntu-lfs/arm-unknown-linux-gnueabi.tar.xz tar -Jxf arm-unknown-linux-gnueabi.tar.xz @@ -28,55 +28,55 @@ Name of "_CROSS_COMPILE_" variable will change depending on the choosen option. ## PARTITIONING -* clear the section for the bootloader -`dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=8` -* enter fdisk -`fdisk /dev/mmcblk0` -* help +* Clear the section for the bootloader +`dd if=/dev/zero of=/dev/sdX bs=1M count=8` +* Enter fdisk +`fdisk /dev/sdX` +* Help `m` -* create new MBR partition table +* Create new MBR partition table `o` -* create boot partition +* Create boot partition `n` -* make primary partition +* Make primary partition `p` -* choose partition number +* Choose partition number `1` -* assign start of boot partition at the end of the bootloader space +* Assign start of boot partition at the end of the bootloader space `3073` -* assign end of boot partition +* Assign end of boot partition `+128M` -* change display units to cylinders +* Change display units to cylinders `u` -* create root partition +* Create root partition `n` -* make primary partition +* Make primary partition `p` -* choose partition number +* Choose partition number `2` -* assign start of boot partition at the end of the bootloader space (default cylinder) +* Assign start of boot partition at the end of the bootloader space (default cylinder) `131` -* assign end of boot partition (default) by pressing ENTER -* change display units back to sectors +* Assign end of boot partition (default) by pressing ENTER +* Change display units back to sectors `u` -* show the partitions +* Show the partitions `p` -* if you agree save and exit +* If you agree save and exit `w` -* if you disagree delete a partition and start from that partition +* If you disagree delete a partition and start from that partition `d` * or exit without saving `q` * Make root filesystem -`mkfs. /dev/mmcblk0p2` +`mkfs. /dev/sdX2` * Make boot filesystem according to supported bootloader (only "_mkfs.vfat_") -`mkfs. /dev/mmcblk0p1` +`mkfs. /dev/sdX1` ## BOOTLOADER Minimum 3072 bytes free at the start of the drive and before the boot partition. -* VERSION 1: compile +* VERSION 1: Compile bootloader yourself ``` git clone https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 cd u-boot @@ -85,44 +85,44 @@ make -j4 cd boot ``` -* VERSION 2: download and extract the binary +* VERSION 2: Download and extract the binary ``` wget http://odroid.in/guides/ubuntu-lfs/boot.tar.gz # http://dn.odroid.com/S905/BootLoader/ODROID-C2/c2_boot_release_ubuntu.tar.gz tar -zxvf boot.tar.xz cd boot ``` -* flash bootloader +* Flash bootloader ``` chmod +x sd_fusing.sh ./sd_fusing.sh /dev/sdX ``` -* notice the target is the device NOT any partition -* set resolution by editing file root/boot/boot.ini -* might want to comment-out the display-autodetect option +* Notice the target is the device NOT any partition +* Set resolution by editing file root/boot/boot.ini +* Might want to comment-out the display-autodetect option ## MOUNTING -* mount root filesystem -`mount /dev/mmcblk0p2 /mnt` -* create boot directory +* Mount root filesystem +`mount /dev/sdX2 /mnt` +* Create boot directory `mkdir /mnt/boot` -* mount boot filesystem -`mount /dev/mmcblk0p1 /mnt/boot` +* Mount boot filesystem +`mount /dev/sdX1 /mnt/boot` ## BOOT PARTITION Must be FAT32 and 64 MB minimum. -* cloning kernel repo to destination "odroidc2-kernel-folder" +* Clone kernel repo to destination "odroidc2-kernel-folder" `git clone --depth 1 --single-branch https://github.com/hardkernel/linux.git --branch odroidc2-v3.16.y odroidc2-kernel-folder` -* enter destination folder +* Enter destination folder `cd odroidc2-kernel-folder` -* OPTION 1: making kernel config +* OPTION 1: Make kernel config (oneliner) `make ARCH=arm64 CROSS_COMPILE=arm-none-eabi- odroidc2_defconfig` -* OPTION 2: making kernel config +* OPTION 2: Make kernel config ``` export ARCH=arm64 export CROSS_COMPILE=arm-none-eabi- @@ -150,4 +150,6 @@ make odroidc2_defconfig Can be the rest of the disk. * Download CRUX image -`wget -c http://resources.crux-arm.nu/files/devel-test/3.3/crux-arm-rootfs-3.3-64b-RC2.tar.xz` +`wget -c http://resources.crux-arm.nu/files/devel-test/3.3/crux-arm-rootfs-3.3-64b-RC2.tar.xz` +* Extract CRUX image +`aunpack crux-arm-rootfs-3.3-64b-RC2.tar.xz`