Finlay after spending some time i got natively OpenWrt with 4.14.20 Kernel running on my R2.
I will try to sum up all thinks here to get a little walk thru:
What you need:
- USB-to-UART adapter -> connected to āDebug UARTā on board and on other side to your computer
- a running TFTP-Server
- a ĀµSD card + reader
- of course cabling for networking, power supply etc.
-
Get the āmtk-bpi-r2-SD.imgā Image from FrankWās google drive:
https://drive.google.com/open?id=1rtsqj3otRo41lQkjZLm1-oj7SyAjkuL6
-
Put it on a ĀµSD card
sudo dd if=mtk-bpi-r2-SD.img of=/dev/mmcblk0
Pleas note! I use here my build-in card reader on my notebook. So i got the ĀµSD card mapped to mmcblk0. If you have a external card reader they maybe appear as /der/sdx! Check Kernel ring buffer for right device name before you overwrite your own sys-partiton !
Donāt panic! This image contains not partitions so many tools will you show an empty ĀµSD card. This is not true! If you realy want to look if the image file is writen to ĀµSD then try tools like diff, hexdump or binwalk
You can do it same way on the .img file to get the same outputā¦
-
Wire up the R2 with the USB to UART adapter. I use the buspirate with minicom but there are so many other solutions out there that may also work.
-
Put the ĀµSD into the R2 and press power button for about 6-8 seconds to boot up your board. You will see lines like thisā¦
ā¦and at this point press any key! So you will get into U-Boot
-
Now checkout the OpenWrt source code from github on your local computer
git clone https://github.com/openwrt/openwrt.git
-
Step into the openwrt folder and execute following commands to update and install feeds first:
cd openwrt ./scripts/feed update -a ./scripts/feed install -a
-
Get config for the R2 target
make menuconfig
set following:
- Target system -> MediaTek Ralink ARM
- Target images -> ramdisk
Let other thinks as there are for first time. Then exit and save all changes to .config file
-
Build the images:
make
-
After successful build step into
cd build_dir/target-arm_cortex-a7_musl_eabi/linux-mediatek_32/
Here you will find following files:
- uImage-mt7623a-rfb-emmc-initramfs
- root.squashfs
copy both files to your tftp-server. Check Permissions on files and that your tftp-server is running now and serving these files.
-
Connect your R2 borad (WAN Port) with the tftp server via Ethernet cable.
-
Now you need to configure the R2-WAN-Network device in U-Boot
setenv ipaddr <set your temporary ip address for B2 board> setenv netmask 255.255.255.0 setenv serverip <set the ip adress of the tftp server>
-
check if thetftp-server is reachable by the R2
ping <ip address of the tftp server>
if you get a message āis aliveā then you can proceed with next step other wise you must check your cabling, tftp server and network configuration.
-
Getting the kernel with init into emmc:
tftp 84000000 uImage-mt7623a-rfb-emmc-initramfs mmc dev 0 mmc write 84000000 1000 6000
-
Now get the rootfs into emmc:
tftp 84000000 root.squashfs mmc dev 0 mmc write 84000000 20A00 6000
-
Remove your ĀµSD card from board
-
Reboot your board via āresetā command and you are done!
Known issue:
- After first boot all my network devices are populated and accessable via ping except the wifi. After second boot i get only eth0 and eth1 but not functional. I can bring the device up but link did not appear. I find out that if i enter the U-Boot again and bring up the WAN device via ping command and then boot to OS all devices again ready until reboot without U-Boot step. Maybe an initialization problem
Currently i did not have time to look deeper into this and check other thinks like wifi. Will do so maybe in next daysā¦
If you have questions so feel free to ask