BPI R2 LEDE(openwrt) source code


(gary) #42

Latest souce code of OpenWRT(LEDE)

source code(Please note that the branch is bpi-r2-on-lede-v1)

Configurion of LEDE

TARGET=MediaTek Ralink ARM Boot Loaders=u-boot-bpi_r2 (This option is mandatory) …

How to build

make -j1 V=s

Images

when above steps is done, we will below two images under /build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_32/:

  • mtk-bpi-r2-EMMC.img
  • mtk-bpi-r2-SD.img

How to use SD image

A SD card is requried and then install mtk-bpi-r2-SD.img to SD card by running below command:

dd if=mtk-bpi-r2-SD.img of=/dev/sdb

where /dev/sdb is the SD card.

And then install the SD card to R2 board, power it on, the board will boot from SD card.

How to use EMMC image

We need another system which is running on SD card to program EMMC image to EMMC, please follow below steps to do:

1. Copy EMMC image to a running system which is on SD card
2. Program EMMC image to User Data Area of EMMC: dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0
3. Unlock EMMC boot0 block: echo 0 > /sys/block/mmcblk0boot0/force_ro
4. Program preloader to EMMC boot0 block:
     dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0boot0 bs=1M count=1
5. Change the Partition configurion of EMMC is 48h: reboot the system which is running SD, and enter the U-boot command line, run command
    emmc pconf 48
6. Power off, remove SD card, and then power on R2 board.

(Anton Buchfelder) #43

Hello together,

i successfully flashed build Reboot (SNAPSHOT, r4768-b1d4a37) from @garywang to my Banana R2 board. Now i have some questions:

  1. Is it right that WAN Port isn’t working at the moment? (what is the reason / what is to do?)
  2. Is there a way to get Internet without the WAN port ?

Thank you a lot.

Greets Anton


(gary) #44

The WAN and br-lan should be working fine, please follow below steps. I think we can get internet via br-lan or wireless, and so on, this depends on you purpose…

Instruction

Please remove the configuration for lan and wan in /etc/config/network, and then add below lines in that file.

config interface 'lan'
      option type 'bridge'
      option ifname 'lan0 lan1 lan2 lan3'
      option proto 'dhcp'

config interface 'wan'
      option ifname 'wan'
      option proto 'dhcp'

(Kishan Gondaliya) #45

Hey @garywang, I into bananpi r2 from last few hours. I am linux developer and would like to contribute to make better OpenWRT/LEDE functional on this board. Few points: What are you current working on? What I can do here for banana pi r2?

And by “Program preloader to EMMC boot0 block:” do you mean to replace current bootloader?


(Anton Buchfelder) #46

dmesg.txt (25,3 KB)

@garywang Hi Gary thank you for response. Can you please have a look to my kernel logs? I think i have a bigger problem. Thank you!

Greets Anton


(Frank W.) #47

do you see wan-port in “ip a”? in you dmesg there is no wan-port…have you connected a cable to it?

the obvious error is “Error: Driver ‘gpio-keys’ is already registered, aborting…”

i don’t know why the driver is loaded multiple times, but gpio itself failes on the first load

[    3.129754] mediatek-mt7623-pinctrl 1000b000.pinctrl: pin_config_group_set op failed for group 256
[    3.138696] gpio-keys gpio_keys: Error applying setting, reverse things back
[    3.145716] gpio-keys: probe of gpio_keys failed with error -22

maybe you can look in /etc/modules.d/ because of this:

[ 7.433808] kmodloader: loading kernel modules from /etc/modules.d/*

you can try “CONFIG_PINCTRL_MT2701=y” in kernel-config instead of “CONFIG_PINCTRL_MT7623”, maybe dts must be changed like this: https://github.com/frank-w/BPI-R2-4.14/blob/afd4925b8ee9c30ede9de1fe24191d2022157eea/arch/arm/boot/dts/mt7623.dtsi#L229 ( compatible = “mediatek,mt7623-pinctrl”,“mediatek,mt2701-pinctrl”; )


(gary) #48

Thanks a lot Kishan. I’m working on supporting wireless on R2 board. And the HDMI and MIPI interface is not supported if we use OpenWRT/LEDE, do you want to focus on them?

For "Program preloader to EMMC boot0 block“, we need to copy preloader from EMMC IMAGE file to EMMC boot0 block, by default, there is no available preloader in EMMC boot0 block.


(gary) #49

Hi Anton

I’ll try to fix the error “gpio-keys…”, I’d like to know what else problem did you encounter?

And you’re using old release of LEDE, can you please follow latest release: https://github.com/garywangcn/bpi-r2_lede/tree/bpi-r2-on-lede-v1.

Thanks Gary


(Kishan Gondaliya) #50

Gary,

Regarding wireless, OpenWRT uses backport drivers, from github I saw that you deleted mt74 Makefile, at first I thought it was by mistake, but now when I look at kernel config file it looks like you are enabling drivers from kernel itself, correct me if I’m wrong.

From my opinion this hack will create mess in future. I will also look for other things you mentioned but moreover I am interested in bringing up wireless as soon as possible. Let me know how are you proceeding for wireless.


(Frank W.) #51

@garywang as your master-branch isn’t your current “stable” version you should define the “bpi-r2-on-lede-v1”-branch as the default branch, so that one gets cloned…many users may not know that they must change branch before building it and so using the old version :slight_smile:

like i changed the default branch in my 4.14 (master is from torvalds/linux and my work goes to main) you can do it, maybe then there are less users using the wrong version


(gary) #52

Thanks for your suggestion, I’ve changed the default branch from master to bpi-r2-on-lede-v1.

Thanks again for your great support.


(Frank W.) #53

is it right that mtk-bpi-r2-EMMC.img should be programmed to boot-partition? i ask because it have the same size as SD-card-image (67MB) so it seems to be the full OS and not only the preloader which is burned to boot0 when using other images (like debian, ubuntu). i see that you burn the image to both…boot0 and mmcblkx

attention: here is emmc/SD swapped instead of ubuntu/debian-images and my Kernel! with my kernel and debian/ubuntu-Images you must use mmcblk1 instead of mmcblk0

i’ve uploaded the current images again to my gdrive… https://drive.google.com/drive/folders/1oP7jy1KrrIOifvImo2nQ59wx3_9hHkgk?usp=sharing


(Anton Buchfelder) #54

@garywang Hi Gary, i don’t know what i did wrong. I did git clone then git checkout bpi-r2-on-lede-v1 I am still not sure if i had the right and last version.

build_log_part1.txt (214,6 KB) build_log.txt (252,5 KB)

Sorry i am a beginner who try to learn this all. I hope you can help me to catch me mistake.

  1. I do not have wifi devices.

  2. WAN Port is not working.

Thank you very much. Also thank you to everybody who helps me and gave answers.

banana_r2_log.txt (55,0 KB)

I have 2 times the same version of software. Do i have to delete build_dir? Did something went wrong with my build?


(Frank W.) #55

I see wan…what does not work? try settong a static ip+subnetmask if not done yet

4: wan@eth1

Your repo is right and actual.

Wifi maybe needs the wmt-tools initialization like in debian/ubuntu


(Anton Buchfelder) #56

@frank-w Thanks for your response. I tried to detect wifi configuration, but wireless file stays empty. Do you have any idea what went wrong if i build software? I do not find a new file in build_dir. WAN: DHCP is not working! I do not get ipv4 address and internet access.


(gary) #57

If you’re using latest code, you will see the folder package/utils/wmt, if not, please pull latest code.

And we need to run below commands manually to activate WIFI device:

  1. wmt_loader
  2. stp_uart_launcher -p /etc/firmware &
  3. echo 1 >/dev/wmtWifi

Please follow link BPI R2 LEDE(openwrt) source code to use the latest SD or EMMC image.

And please note that after change /etc/config/network, a rebooting operation is required to take it effect.


(gary) #58

We have to program Preloader which is in first 1MB of EMMC image to boot0-partition, and then program entire image to user area of EMMC.


(Anton Buchfelder) #59

@garywang Here are some different logs and configs of my device. I have the newest software now at my device. Can someone explain me how to get wifi working? I already followed the instruction of gary. WAN Port is working. Thank you.

serial_lede.txt (42,3 KB)


(Frank W.) #60

Gary wrote you how to get wifi working:

  1. wmt_loader
  2. stp_uart_launcher -p /etc/firmware &
  3. echo 1 >/dev/wmtWifi

Step 3 is for wifi-client…if you want ap-mode you must

  1. echo A >/dev/wmtWifi

And the starting hostapd,dnsmasq and defining ip-address subnet+routing


(Anton Buchfelder) #61

@frank-w Thank you very much. Step 3 for AP was not clear for me.

@garywang why do we need wmt_loader? I want to understand why we need this solution. Thank you.