pinebook-notes/u-boot/Makefile

204 lines
6.5 KiB
Makefile

# the original u-boot source drop from 2014
# https://github.com/allwinner-zh/bootloader.git (no git history. fuck.)
# root@librem15:~/pinebook/u-boot-jcarr/board/sunxi# git log --branches=* |grep ^Author |sort -u |wc -l
# 2385 contributors in u-boot (more or less. less actually. ~1500)
# push all the remote tags to your server after adding the remote
# git push -u origin --all
# git push -u origin --tags
CROSS_COMPILE ?= riscv64-linux-gnu-
all:
clone:
# git clone https://github.com/trini/u-boot.git
git clone git@git.wit.com:jcarr/u-boot.git
git remote add ayufan https://github.com/ayufan-pine64/u-boot-pine64.git
git fetch pine64
git remote add longsleep https://github.com/longsleep/u-boot-pine64.git
git fetch longsleep
git remote add rockchip https://github.com/rockchip-linux/u-boot.git
git fetch rockchip
git remote add anarsoul https://github.com/anarsoul/u-boot-pine64
git fetch anarsoul
git remote add trini https://github.com/trini/u-boot.git
git fetch trini
show:
git remote -v
git branch -r
update:
# git branch -a # shows all branches
# git ls-remote
git fetch --verbose --all --prune
# show all commits on all branches
# so you can search everywhere if you are trying to find something lost
all-commits:
git rev-list --remotes
git rev-list --all --remotes --pretty
git log --branches=*
toms-recent-commits:
git log --pretty=format:"%ad:%an:%d:%B" --date=short --reverse --all --since=2.months.ago --author=trini
# builds and runs on Jan 1 2019
build-pinebook:
export CROSS_COMPILE=/home/pinebook/cross-compilers/gcc-linaro/bin/aarch64-linux-gnu-
git checkout anarsoul/pinebook-wip-20181109
make pinebook_defconfig
make all V=1
build-qemu-arm:
make qemu_arm_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j5
build-x86-x32:
make qemu-x86_defconfig
make -j5
qemu-system-i386 -machine none -bios u-boot.bin
# this at least builds (for what it's worth)
pinebook-build1:
# git checkout -b jcarr-my-hacks-3.0 pine64/my-hacks-3.0 # old?
git checkout -b jcarr-my-hacks-1.2 pine64/my-hacks-1.2
export PATH=/root/pinebook/cross-compilers/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/:$PATH
make sun50iw1p1_config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
# https://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
build-2014-versatilepb:
git checkout v2015.04
cp include/linux/compiler-gcc5.h include/linux/compiler-gcc7.h # from v2017-03
make versatileqemu_config ARCH=arm CROSS_COMPILE=arm-none-eabi-
make all ARCH=arm CROSS_COMPILE=arm-none-eabi-
qemu-system-arm -M versatilepb -m 128M -nographic -kernel u-boot.bin
# U-Boot 2015.04 (Dec 11 2018 - 16:36:36)
#
# DRAM: 128 MiB
# WARNING: Caches not enabled
# Using default environment
#
# In: serial
# Out: serial
# Err: serial
# Net: SMC91111-0
# Warning: SMC91111-0 using MAC address from net device
# VersatilePB #
killall-qemu-arm:
killall -9 qemu-system-arm
flash:
# datasheet for eMMC 16GB flash
# Foresee NCEMASKG-16G Rev A0
rom-address-offsets-within-u-boot:
# md 0x4a000000 # eMMC u-boot.bin start
# md 0x10000 # boot0
# 0x10000 boot1 # doesn't exist
anarsoul-build:
git checkout anarsoul/pinebook-wip-20181109
# fails with arm-none-eabi-gcc (15:7-2018-q2-4) 7.3.1 20180622 on x64
# make pinebook_defconfig ARCH=arm CROSS_COMPILE=arm-none-eabi-
# make all ARCH=arm CROSS_COMPILE=arm-none-eabi- V=1
# also doesn't work with gcc-5 or gcc-8
make pinebook_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
make all ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- V=1
# also doesn't work with gcc-5 or gcc-8
make pinebook_defconfig ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
make all ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- V=1
make pinebook_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
make all ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- V=1
# native build on sid directly on the pinebook:
apt install bison flex swig python-dev
make clean; make distclean;
git checkout anarsoul/pinebook-wip-20181109
make pinebook_defconfig
make all V=1
dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1K seek=8
# boots and hangs after:
# U-Boot SPL 2018.11-rc3-00047-g54dd89fefc (Dec 16 2018 - 15:00:32 +0000)
# DRAM: 2048 MiB
# Trying to boot from MMC1
linaro-gcc:
# wget # aria2c -x6 -k1M -c https://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/aarch64-linux-gnu/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
PATH=/root/pinebook/cross-compilers/gcc-linaro/bin/:$PATH aarch64-linux-gnu-gcc -v
PATH=/root/pinebook/cross-compilers/gcc-linaro/bin/:$PATH make pinebook_defconfig ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
cp ../arm-trusted-firmware/build/fvp/release/bl31.bin .
PATH=/root/pinebook/cross-compilers/gcc-linaro/bin/:$PATH make all ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
arm-trusted-firmware:
git clone https://github.com/ARM-software/arm-trusted-firmware.git
git remote add apritzel https://github.com/apritzel/arm-trusted-firmware.git
git fetch apritzel
apt install device-tree-compiler
export CROSS_COMPILE=/root/pinebook/cross-compilers/gcc-linaro/bin/aarch64-linux-gnu-
git checkout -b pinebook apritzel/allwinner
make PLAT=sun50iw1p1 DEBUG=1 bl31
misc:
update-alternatives --set gcc "/usr/bin/gcc-7"
update-alternatives --set g++ "/usr/bin/g++-7"
need to first set it with the .syntax unified directive.
dd-current-uboot:
dd if=/dev/mmcblk0 of=current-uboot bs=1K skip=8 count=8
dd-current-partitionmap:
dd if=/dev/mmcblk0 of=current-mmcblk0 bs=1K count=64
dd-new-uboot:
dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1K seek=8
dd-zeroes:
dd if=/dev/zero of=/dev/mmcblk0 bs=1K seek=8 count=10
# drive layout:
# 179 96 30976000 mmcblk0
# 179 97 7808405 mmcblk0p1 # ended up being parted msdos 4194kB to 8G
# 179 98 11718750 mmcblk0p2 # 8G to 20G
jtag:
# https://github.com/Icenowy/sunxi-jtag
# http://linux-sunxi.org/JTAG # jtag over the mmc card connection
# http://linux-sunxi.org/JTAG/sun4iconfig
parted-external-ssd:
parted /dev/mmcblk0 mklabel msdos
parted /dev/mmcblk0 mkpart primary ext4 1MiB 30GiB
mkfs.ext4 /dev/mmcblk0p1
mount /dev/mmcblk0p1 /mnt/test/
brom64:
mmc dev 0
mmc part
fatwrite mmc 0 0 brom_a64.bin 0x10000
aarch64-linux-gnu-objdump -D -b binary -marm brom_a64.bin
install-internal-emmc:
parted /dev/mmcblk2 mklabel msdos
parted /dev/mmcblk2 mkpart primary ext4 1MiB 15.5GB
mkfs.ext4 /dev/mmcblk2p1
mount /dev/mmcblk2p1 /mnt/test/
cd /mnt/test ; tar xfj /root/mmcblk2p1.tar.bz2
dd if=/boot/u-boot-sunxi-with-spl.bin of=/dev/mmcblk2 bs=1K seek=8