All Projects → mammo0 → openwrt-bpi-r2

mammo0 / openwrt-bpi-r2

Licence: GPL-3.0 license
Scripts for building OpenWRT for Banana Pi R2

Programming Languages

shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to openwrt-bpi-r2

ansible-openwrt
Ansible collection to configure your OpenWrt devices more quickly and automatically (without Python)
Stars: ✭ 34 (+142.86%)
Mutual labels:  openwrt
luci-openwisp
OpenWISP configuration interface implemented as LuCI extensions
Stars: ✭ 21 (+50%)
Mutual labels:  openwrt
openwrt-configuration-ansible
OpenWrt configuration for router + dumb access points with Ansible playbook for centralised management
Stars: ✭ 31 (+121.43%)
Mutual labels:  openwrt
HomeLede
An Openwrt firmware for home use scenarios.
Stars: ✭ 925 (+6507.14%)
Mutual labels:  openwrt
chaos calmer
OpenIPC 1.0 (OpenWRT-based), not maintained anymore
Stars: ✭ 189 (+1250%)
Mutual labels:  openwrt
ancistrus
Netgear's D7000 Nighthawk Router Experience Distributed Project
Stars: ✭ 61 (+335.71%)
Mutual labels:  openwrt
nanopi-openwrt
Openwrt for Nanopi R2S 固件编译
Stars: ✭ 97 (+592.86%)
Mutual labels:  openwrt
linksys-wrt54g
Exploiting Linksys WRT54G using a vulnerability I found.
Stars: ✭ 31 (+121.43%)
Mutual labels:  openwrt
snapos
Snapcast OS
Stars: ✭ 73 (+421.43%)
Mutual labels:  openwrt
lispmob
LISP and LISP-MN Implementation
Stars: ✭ 44 (+214.29%)
Mutual labels:  openwrt
istore
一个 Openwrt 标准的软件中心,纯脚本实现,只依赖Openwrt标准组件。支持其它固件开发者集成到自己的固件里面。更方便入门用户搜索安装插件。The iStore is a app store for OpenWRT
Stars: ✭ 483 (+3350%)
Mutual labels:  openwrt
openwrt-scripts
A collection of some useful scripts running on OpenWrt/LEDE routers
Stars: ✭ 43 (+207.14%)
Mutual labels:  openwrt
ansible-tinc
Role to install tinc in a star/ring topology (w/ leaf/spine) (based on your variables)
Stars: ✭ 15 (+7.14%)
Mutual labels:  openwrt
lede-dockerbuilder
A (container based) LEDE/OpenWrt image builder.
Stars: ✭ 53 (+278.57%)
Mutual labels:  openwrt
source
Onion's fork of OpenWRT's source build system. The firmware for the Omega2, Omega2+, and Omega2 Pro is based on the openwrt-18.06 branch.
Stars: ✭ 73 (+421.43%)
Mutual labels:  openwrt
OpenWrt-NanoPi-R2S-R4S-Builds
OpenWRT Builds for NanoPi R2S & R4S from official Openwrt source code with minimal set of patches
Stars: ✭ 99 (+607.14%)
Mutual labels:  openwrt
openwrt-actions
利用github提供的actions编译openwrt固件
Stars: ✭ 14 (+0%)
Mutual labels:  openwrt
blynk-library-lua
Blynk library for Lua. Works with Lua 5.1+, LuaJIT, NodeMCU.
Stars: ✭ 35 (+150%)
Mutual labels:  openwrt
OpenWrt-Autobuild
OpenWrt action builds
Stars: ✭ 24 (+71.43%)
Mutual labels:  openwrt
potd
A high scalable low to medium interactive SSH/TCP honeypot using Linux Namespaces, capabilities, seccomp, cgroups designed for OpenWrt and IoT devices.
Stars: ✭ 28 (+100%)
Mutual labels:  openwrt

OpenWRT for Banana Pi R2

Important: On September 4, 2021 OpenWRT 21.02 was released. This release has a much better built-in support for the Banana Pi R2. You can download a ready to use image now from the official OpenWRT site: https://firmware-selector.openwrt.org/ (just search for Banana Pi R2)

Please have a look at the official Wiki for flashing the image to a SD card.

This means this project is now discontinued!

You can still find my images (up to version 19.07.8) on the releases page.


Finally, I want to thank everybody who used my images :)



This repository contains a collection of scripts for building a

  • SD card and
  • EMMC

image of OpenWRT. The current version is

19.07.8

Many thanks to frank-w for making this possible.

Build OpenWRT for BPi-R2

Download the precompiled images

There's a GitHub workflow that builds the SD card and EMMC image of this repository. You can download them directly from the releases page.

Manual building

If you want to build the images by yourself, please follow these instructions:

  1. Install the requiered dependencies:
    • git - just for the sake of completeness ;)
    • curl
    • dosfstools and e2fsprogs for image creation
    • for U-Boot:
      • bison
      • gcc for arm-linux-gnueabihf architecture (have a look at your distro documentaion for the right package)
      • flex
      • python (with development files)
      • swig
      • xxd
    • for OpenWRT see the official documentaion: https://openwrt.org/docs/guide-developer/build-system/install-buildsystem#examples_of_package_installations
    • for restoring:
      • qemu-arm-static (have a look at your distro documentaion for the right package) The static binaries must be registred via binfmt!
  2. Run 0_prepare.sh
  3. Run 1_build_uboot.sh
  4. Run 2_build_openwrt.sh
  5. Run 3_build_images.sh
  6. (Optional) Run restore_config.sh (Please have a look at the restoring section below for more information)

The resulting images are placed in the out directory of this repository.

For cleaning the compilation area append clean argument to any of the above mentioned scripts.

Building with Docker

If you don't want to setup the build context on your system but also want to build local, you can use docker for building it.

1) Build the Docker image

To build the Docker image run:

docker build -t bpi_r2-openwrt .

For customizations you can specify the following build arguments:

  • BUILD_USER: The name for the user that runs the build process.
  • PUID: The user ID of that user.
  • PGID: The group ID that belongs to that user.

2) Run the Docker image to build the OpenWRT images

To start the automated build process run:

docker run [--privileged] -v `pwd`:/out bpi_r2-openwrt [uboot|openwrt]

By default if no arguments were specified, the --privileged parameter is required for the image creation process. The resulting SD card and EMMC images should be available in your current working directory. Otherwise check the -v parameter. On container side the path should be equal to the VOLUME_DIR path that is defined in the Dockerfile.

The optional arguments:

  • uboot: Only build the U-Boot binary. After the build you should find the u-boot.bin in your current working directory.
  • openwrt: Only build OpenWRT. Afterwards you should find the openwrt-kernel.bin and the openwrt-rootfs.tar.gz in your current working directory.

If you use the uboot or openwrt argument, the --privileged parameter is not necessary. Afterwards you can copy the resulting U-Boot or OpenWRT files from the current working directory to the artifacts directory. Then you can call the 3_build_images.sh script directly on your host PC to build the images (check the dependencies above for this).

Flashing the images

SD card

Just flash the imge to the SD card, e.g. with dd:

dd if=BPI-R2_SD.img of=/dev/<sd_device>

EMMC

You need a running system on the Banana Pi for flashing. For this you can also use the SD card version of OpenWRT.

After logging into the system via SSH or Serial console you

  1. first need to flash the BPI-R2_EMMC.img image:

    dd if=BPI-R2_EMMC.img of=/dev/mmcblk0

    Assuming that mmcblk0 is the EMMC device.

  2. After that flash the BPI-R2_EMMC_boot0.img image:

    dd if=BPI-R2_EMMC_boot0.img of=/dev/mmcblk0boot0

    Assuming that mmcblk0boot0 is the EMMC device.

    If you get an error that you don't have permissions for this operation, you may need to activate write mode for the boot partition of the EMMC device:

    echo 0 > /sys/block/mmcblk0boot0/force_ro

Upgrading the firmware

A "normal" upgrade via the LuCi-Webinterface is not possible!

To perform an upgrade a manual reflash of the image(s) is needed like it's described in the previous section.

Warning: This would mean to lose all custom settings! So it's necessary to perform a backup of the settings first!

Backup settings

One way is via the LuCi-Webinterface:

System > Backup / Flash Firmware

Warning: The above backup does not contain additional installed packages! If you installed software packages with opkg or through LuCi, you need perform a special backup:

  1. Login to the router via SSH.
  2. Execute
sysupgrade -k -b <backup_file>.tar.gz
  1. Transfer the created file to your PC, e.g. with scp.

Restore settings

If you made the backup with the LuCi-Webinterface, you can restore your settings on the same page.

Warning: This means, that on the first boot the device uses its default configuration! If you don't want this behaviour or if you also backed up your installed packages, please use this alternative restoring method:

You could also integrate your backed up configuration into an image before flashing it to the device. To do this call the restore_config.sh script:

# this scripts asks for admin rights during execution!
restore_config.sh -i <image_file> -c <conifg_file>

<image_file> This is the image file to which the configuration should be applied. Could be either the SD card or EMMC image.

<conifg_file> This the *.tar.gz archive that was created either via LuCi or with the sysupgrade command above.

After that your settings have been integrated into the image file and can be flashed to either SD card or EMMC.

EMMC

The upgrade of the EMMC device can be done while the system is runing from that device. Usually only the BPI-R2_EMMC.img image needs to be (re-)flashed since this contains the filesystem and kernel.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].