Giter VIP home page Giter VIP logo

frank-w / u-boot Goto Github PK

View Code? Open in Web Editor NEW
52.0 6.0 20.0 330.14 MB

U-Boot-Bootloader for BananaPI-R2/R64/R2Pro/R3

Makefile 0.61% C 94.46% Assembly 0.91% C++ 0.09% Python 3.07% Shell 0.13% GDB 0.01% Tcl 0.01% Batchfile 0.01% Perl 0.42% sed 0.01% Lex 0.02% Yacc 0.03% Awk 0.01% CSS 0.01% SmPL 0.02% ASL 0.15% POV-Ray SDL 0.05% Roff 0.01% Dockerfile 0.01%
u-boot uboot bpi-r2 bananapi banana-pi r2 bpi-r2pro bpi-r3 bpi-r64 r2pro

u-boot's Introduction

U-boot for BPI-R2/R64/R2Pro/R3/R4

CI

Requirements

On x86/x64-host you need cross compile tools for the armhf architecture:

sudo apt-get install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu libc6-armhf-cross u-boot-tools make gcc swig python-dev python3-pyelftools

Issues

R2:

  • loadenv fails because of resized environment (4096 => 8188)
    • backup your saved environment before update uboot or change back CONFIG_ENV_SIZE to SZ_4K (./build.sh soc)
    • erase your saved environment
env erase
  • no emmc-command (not needed "emmc pconf 0x48" = "mmc partconf 0 1 1 0")

Usage

  #edit build.conf to select bpi-r64/bpi-r2pro/bpi-r3 if needed
  ./build.sh importconfig
  ./build.sh config #optional (menuconfig)
  ./build.sh
  ./build.sh install #write to sd-card
  ./build.sh umount #umount automatic mounted partitions

building and flash image

for all boards there are basic sdcard image templates created containing the full bootchain till uboot.

  • bpi-r2.img.gz
  • bpi-r2pro.img.gz
  • bpi-r3_sdmmc.img.gz
  • bpi-r4_sdmmc.img.gz
  • bpi-r64_sdmmc.img.gz

These do not contain linux kernel or rootfs but you can flash them as base to sdcard.

gunzip -c bpi-r3_sdmmc.img.gz | sudo dd bs=1M status=progress conv=notrunc,fsync of=/dev/sdX

#writing R3 emmc (booting from spi-nand/nor and load kernel with initrd)
gunzip -c /mnt/bpi-r3_emmc.img.gz | dd bs=1M status=progress conv=notrunc,fsync of=/dev/mmcblk0

After this you can extract the rootfs and kernel to the card.

refresh partitiontable and mounting

sudo partprobe /dev/sdX
udisksctl mount -b /dev/disk/by-label/BPI-BOOT
udisksctl mount -b /dev/disk/by-label/BPI-ROOT

debian bullseye rootfs (created by buildchroot.sh in same folder): https://drive.google.com/drive/folders/1mEcz1NLX8kv_AOKCPGGBcebRtLVNrQqF?usp=share_link

kernel: https://github.com/frank-w/BPI-Router-Linux/releases/

# unpack debian rootfs
sudo tar -xzf bullseye_arm64.tar.gz -C /media/$USER/BPI-ROOT
# unpack kernel binary files
sudo tar -xzf bpi-r3_6.1.0-main.tar.gz --strip-components=1 -C /media/$USER/BPI-BOOT BPI-BOOT
# for r3 move kernel binary to root of boot-partition and rename it
mv /media/$USER/BPI-BOOT/bananapi/bpi-r3/linux/bpi-r3.itb /media/$USER/BPI-BOOT/bpi-r3-6.1.0.itb
echo "fit=bpi-r3-6.1.0.itb" >> /media/$USER/BPI-BOOT/uEnv.txt
# unpack kernel modules to rootfs
# debian uses /lib as symlink to usr/lib, extracting the dir from tar overwrites symlink with directory
# which contains then only the kernel-modules, but not other libs so extract the subfolder to /lib
sudo tar -xzf bpi-r3_6.1.0-main.tar.gz --strip-components=2 -C /media/$USER/BPI-ROOT/lib/ BPI-ROOT/lib/

R2 uses uImage and kernel=xxx in uEnv.txt (in folder bananapi/bpi-r2/linux) R64, R3, R4 uses fit in in root dir of BPI-BOOT partition (fit=bpi-rX.itb) R2Pro uses now fit and uEnv.txt too (Image.gz+dtb in extlinux folder as fallback).

set root-password and maybe make additional changes:

sudo chroot /media/$USER/BPI-ROOT
passwd
echo "bpi-r3" > /etc/hostname

/etc/fstab

# <file system>	<dir>	<type>	<options>		<dump>	<pass>
/dev/mmcblk0p5	/boot	vfat    errors=remount-ro	0	1
/dev/mmcblk0p6	/	ext4	defaults		0	0

maybe add network-config (systemd) and systemd services i uploaded here: https://drive.google.com/drive/folders/1kST9ZOv8xQWFfo9GUNIIpKjD8QuYMj8i?usp=share_link

i have created an script which creates full sdcard-Images including rootfs and kernel (except BPI-R4):

https://github.com/frank-w/BPI-Router-Images

u-boot's People

Contributors

aford173 avatar andre-arm avatar elkablo avatar forty-bot avatar gateworks avatar hsdenx avatar jhershbe avatar jwrdegoede avatar keveryang avatar kumargala avatar lbmeng avatar lokeshvutla avatar masahir0y avatar michalsimek avatar mrvan avatar nvswarren avatar openedev avatar patrickdelaunay avatar plagnioj avatar pyguy2 avatar sbabic avatar si-gdsys avatar sjg20 avatar stroese avatar trini avatar vapier avatar vdsao avatar wdenx avatar xypron avatar ziswiler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

u-boot's Issues

BPi-R4: NVMe boot does not work when booting from NAND/EMMC

I've got the system booting fine when u-boot is installed on an SD card.
But the moment I try installing it into the NAND or EMMC, the initial "pci enum" does show the NVMe disk.
But after that, no nvme device is detected, and another call to "pci enum" does not see it anymore.
This all works fine when u-boot is installed to an SD Card.

I noticed that NVMe support is disabled in the nand defconfig. So I guess this is a known issue?
Should it work when flashed to emmc?

Missing `saveenv` command

Hi, I just wrote this to the eMMC on my R4 and while it works, I noticed it is missing the saveenv command, so I cannot make changes persistent. I see that it creates a partition labeled u-boot-env so presumably there is space on the eMMC which is used for storing the environment. Could this be enabled please?

Hard-coded 32MB kernel limitation

Is there some reason you're still hard-coding kaddr 0x46000000 into the u-boot vars, and imposing a 32mb kernel size limit? I'm still running into this on all the defaults even on the 2024-07-bpi branch?

SDCard image does not boot on bpi-r4

Both the image from the latest release here and one I built myself (for added EFI support, but I also tried building a vanilla one) just fail to boot with:

F0: 102B 0000
FA: 1042 0000
FA: 1042 0000 [0200]
F9: 1041 0000
F3: 1001 0000 [0200]
F3: 1001 0000
F6: 380E 5800
F5: 4801 0000
00: 1005 0000
FA: 1042 0000
FA: 1042 0000 [0200]
F9: 1041 0000
F3: 1001 0000 [0200]
F3: 1001 0000
F6: 380E 5800
01: 102A 0001
02: 1005 0000
BP: 0200 00C0 [0001]
EC: 0000 0000 [3000]
MK: 0000 0000 [0000]
T0: 0000 0112 [0101]
System halt!

If I flash an sdcard image from the openwrt snapshots (https://firmware-selector.openwrt.org/?version=SNAPSHOT&target=mediatek%2Ffilogic&id=bananapi_bpi-r4), the system boots just fine. So I'm pretty confident the SD card, the hardware and my method of writing the image is okay.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.