Orange Pi PC 2: diferenças entre revisões
Ir para a navegação
Ir para a procura
Sem resumo de edição |
Sem resumo de edição |
||
| Linha 1: | Linha 1: | ||
== Requisitos == | |||
=== Gentoo === | |||
<syntaxhighlight lang="shell"> | |||
crossdev -t aarch64-unknown-linux-gnu --g 7.2.0 -v | |||
PYTHON=python2 emerge u-boot-tools | |||
</syntaxhighlight> | |||
=== ArchLinux === | |||
<syntaxhighlight lang="shell"> | |||
pacman -S uboot-tools aarch64-linux-gnu-binutils aarch64-linux-gnu-gcc aarch64-linux-gnu-glibc aarch64-linux-gnu-linux-api-headers | |||
</syntaxhighlight> | |||
== Preparar o cartão == | == Preparar o cartão == | ||
Revisão das 19h54min de 12 de setembro de 2017
Requisitos
Gentoo
crossdev -t aarch64-unknown-linux-gnu --g 7.2.0 -v
PYTHON=python2 emerge u-boot-tools
ArchLinux
pacman -S uboot-tools aarch64-linux-gnu-binutils aarch64-linux-gnu-gcc aarch64-linux-gnu-glibc aarch64-linux-gnu-linux-api-headers
Preparar o cartão
dd if=/dev/zero of=/dev/sdX bs=1M count=8
fdisk /dev/sdX # '''Começar em 4096'''
mkfs.ext4 -O ^metadata_csum /dev/sdX1
Copiar o Userland
mount /dev/sdX1 /mnt/opipc
ArchLinux
wget http://archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz
bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C /mnt/opipc
Gentoo
Sacar o mais recente de http://distfiles.gentoo.org/releases/arm/autobuilds/current-stage3-arm64/
tar xfa stage3-armv7a_hardfp-????????.tar.bz2 -C /mnt/opipc
boot.scr
Criar o ficheiro /mnt/opipc/boot/boot.cmd com o seguinte conteudo:
part uuid ${devtype} ${devnum}:${bootpart} uuid
setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait
setenv fdtfile allwinner/sun50i-h5-orangepi-pc2.dtb
if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/Image; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
booti ${kernel_addr_r} - ${fdt_addr_r};
fi;
fi;
fiE correr o mkimage para criar o boot.scr.
cd /mnt/opipc/boot
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Orange Pi PC 2 boot script" -d boot.cmd boot.scr
Sources
Sacar o source de tudo necessario para bootar, o Armbian é usado para ripar o config do kernel e os patches adicionais.
git clone https://github.com/armbian/build.git armbian
git clone git://git.denx.de/u-boot.git -b v2017.07 u-boot
git clone https://github.com/apritzel/arm-trusted-firmware -b allwinner-stable arm-trusted-firmware-sunxi-main
git clone https://github.com/Icenowy/linux/ -b sunxi64-4.13.y linux-sun50i-dev
ARM Trusted Firmware
cd arm-trusted-firmware-sunxi-main
make CROSS_COMPILE=aarch64-unknown-linux-gnu- PLAT=sun50iw1p1 DEBUG=1 bl31
cp build/sun50iw1p1/debug/bl31.bin ../u-boot/
U-Boot
cd u-boot
make ARCH=arm CROSS_COMPILE=aarch64-unknown-linux-gnu- -j4 orangepi_pc2_defconfig
make ARCH=arm CROSS_COMPILE=aarch64-unknown-linux-gnu- -j4
cat spl/sunxi-spl.bin u-boot.itb > u-boot-sunxi-with-spl.bin
E gravar o bootloader no cartão com:
dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=8k seek=1
Kernel
cd linux-sun50i-dev
cp ../armbian/config/kernel/linux-sun50i-dev.config .config
#for i in ../armbian/patch/kernel/sun50i-dev/*.patch; do patch -p1 < $i; done
#for i in ../armbian/patch/kernel/sun50i-dev/scpi/*.patch; do patch -p1 < $i; done
make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- -j4
make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- INSTALL_MOD_PATH=/mnt/opipc -j4 modules_install
cp arch/arm64/boot/Image /mnt/opipc/boot
cp arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dtb /mnt/opipc/boot/dtbs/allwinner/sun50i-h5-orangepi-pc2.dtb