mirror of
https://github.com/mayfrost/guides.git
synced 2024-11-01 07:26:04 +00:00
Update CROSS-COMPILING.md
This commit is contained in:
parent
dd0df3f214
commit
65dca52118
@ -1,5 +1,5 @@
|
|||||||
# CROSS-COMPILING
|
# 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
|
## TOC
|
||||||
@ -15,10 +15,10 @@ Installing a distro for ARM. The distro is CRUX, the target is an Odroid C2. The
|
|||||||
## CROSS COMPILATION TOOLS
|
## CROSS COMPILATION TOOLS
|
||||||
Installing GCC cross compilation tools (for the X86 machine, not target ARM). Includes binutils.
|
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`
|
`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
|
wget http://odroid.in/guides/ubuntu-lfs/arm-unknown-linux-gnueabi.tar.xz
|
||||||
tar -Jxf 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
|
## PARTITIONING
|
||||||
* clear the section for the bootloader
|
* Clear the section for the bootloader
|
||||||
`dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=8`
|
`dd if=/dev/zero of=/dev/sdX bs=1M count=8`
|
||||||
* enter fdisk
|
* Enter fdisk
|
||||||
`fdisk /dev/mmcblk0`
|
`fdisk /dev/sdX`
|
||||||
* help
|
* Help
|
||||||
`m`
|
`m`
|
||||||
* create new MBR partition table
|
* Create new MBR partition table
|
||||||
`o`
|
`o`
|
||||||
* create boot partition
|
* Create boot partition
|
||||||
`n`
|
`n`
|
||||||
* make primary partition
|
* Make primary partition
|
||||||
`p`
|
`p`
|
||||||
* choose partition number
|
* Choose partition number
|
||||||
`1`
|
`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`
|
`3073`
|
||||||
* assign end of boot partition
|
* Assign end of boot partition
|
||||||
`+128M`
|
`+128M`
|
||||||
* change display units to cylinders
|
* Change display units to cylinders
|
||||||
`u`
|
`u`
|
||||||
* create root partition
|
* Create root partition
|
||||||
`n`
|
`n`
|
||||||
* make primary partition
|
* Make primary partition
|
||||||
`p`
|
`p`
|
||||||
* choose partition number
|
* Choose partition number
|
||||||
`2`
|
`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`
|
`131`
|
||||||
* assign end of boot partition (default) by pressing ENTER
|
* Assign end of boot partition (default) by pressing ENTER
|
||||||
* change display units back to sectors
|
* Change display units back to sectors
|
||||||
`u`
|
`u`
|
||||||
* show the partitions
|
* Show the partitions
|
||||||
`p`
|
`p`
|
||||||
* if you agree save and exit
|
* If you agree save and exit
|
||||||
`w`
|
`w`
|
||||||
* if you disagree delete a partition and start from that partition
|
* If you disagree delete a partition and start from that partition
|
||||||
`d`
|
`d`
|
||||||
* or exit without saving
|
* or exit without saving
|
||||||
`q`
|
`q`
|
||||||
* Make root filesystem
|
* Make root filesystem
|
||||||
`mkfs.<ROOT_FILESYSTEM> /dev/mmcblk0p2`
|
`mkfs.<ROOT_FILESYSTEM> /dev/sdX2`
|
||||||
* Make boot filesystem according to supported bootloader (only "_mkfs.vfat_")
|
* Make boot filesystem according to supported bootloader (only "_mkfs.vfat_")
|
||||||
`mkfs.<BOOTLOADER_FILESYSTEM> /dev/mmcblk0p1`
|
`mkfs.<BOOTLOADER_FILESYSTEM> /dev/sdX1`
|
||||||
|
|
||||||
|
|
||||||
## BOOTLOADER
|
## BOOTLOADER
|
||||||
Minimum 3072 bytes free at the start of the drive and before the boot partition.
|
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
|
git clone https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01
|
||||||
cd u-boot
|
cd u-boot
|
||||||
@ -85,44 +85,44 @@ make -j4
|
|||||||
cd boot
|
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
|
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
|
tar -zxvf boot.tar.xz
|
||||||
cd boot
|
cd boot
|
||||||
```
|
```
|
||||||
|
|
||||||
* flash bootloader
|
* Flash bootloader
|
||||||
```
|
```
|
||||||
chmod +x sd_fusing.sh
|
chmod +x sd_fusing.sh
|
||||||
./sd_fusing.sh /dev/sdX
|
./sd_fusing.sh /dev/sdX
|
||||||
```
|
```
|
||||||
* notice the target is the device NOT any partition
|
* Notice the target is the device NOT any partition
|
||||||
* set resolution by editing file root/boot/boot.ini
|
* Set resolution by editing file root/boot/boot.ini
|
||||||
* might want to comment-out the display-autodetect option
|
* Might want to comment-out the display-autodetect option
|
||||||
|
|
||||||
|
|
||||||
## MOUNTING
|
## MOUNTING
|
||||||
* mount root filesystem
|
* Mount root filesystem
|
||||||
`mount /dev/mmcblk0p2 /mnt`
|
`mount /dev/sdX2 /mnt`
|
||||||
* create boot directory
|
* Create boot directory
|
||||||
`mkdir /mnt/boot`
|
`mkdir /mnt/boot`
|
||||||
* mount boot filesystem
|
* Mount boot filesystem
|
||||||
`mount /dev/mmcblk0p1 /mnt/boot`
|
`mount /dev/sdX1 /mnt/boot`
|
||||||
|
|
||||||
|
|
||||||
## BOOT PARTITION
|
## BOOT PARTITION
|
||||||
Must be FAT32 and 64 MB minimum.
|
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`
|
`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`
|
`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`
|
`make ARCH=arm64 CROSS_COMPILE=arm-none-eabi- odroidc2_defconfig`
|
||||||
|
|
||||||
* OPTION 2: making kernel config
|
* OPTION 2: Make kernel config
|
||||||
```
|
```
|
||||||
export ARCH=arm64
|
export ARCH=arm64
|
||||||
export CROSS_COMPILE=arm-none-eabi-
|
export CROSS_COMPILE=arm-none-eabi-
|
||||||
@ -151,3 +151,5 @@ Can be the rest of the disk.
|
|||||||
|
|
||||||
* Download CRUX image
|
* 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`
|
||||||
|
Loading…
Reference in New Issue
Block a user