Porting Banana Pi BPI-R2 (Mediatek) to upstream; questions

Hi all,

I'm trying to port changes from vendor-provided LEDE tree to current master (ideally with upstreaming in mind though I don't place my hopes high for now). For now my aim is to build an upstream OpenWrt image with minimal changes and make it boot, then look at what's broken and fix it one by one.

Vendor-provided .dts for the board includes bootargs field with additional kernel command line arguments. It includes mtdparts, block2mtd and even rootfstype. It seems strange for me that the arguments are placed there instead of e.g. getting passed from U-Boot (and on Mediatek's current configuration bootloader arguments are not used at all); what is the usual approach for such arguments? Is it okay to just leave them there or should I move them?

it's easier to have them there (from my point of view) so you don't have to work with uboot (serial access), so if they can be changed from config file, it's good enough

regards

Fair enough. FWIW I have serial access so I can meddle with u-boot but my primary concern was to try to do things with upstreamable quality from the start.

Thanks!

it they don't have special values, like unique serial number or mac address or something else and can be used on any device then it can go upstream like that, my thoughts

1 Like

Next question: current Mediatek kernel defines CMDLINE_FORCE=1 which means that it will ignore command line arguments passed from the bootloader. However they are actually used in case of BPI-R2 and I'd like to change that to CMDLINE_EXTEND=1 (which means that they will be combined with the default ones). Why was it defined this way initially? Not sure where to ask this but hope for at least some pointers...

EDIT: Had an answer from neoraider@#lede-dev: this is usual practice because bootloader arguments are not always controllable by OpenWrt.

as I said, most of times it's easier to mangle the boot options in linux than in u-boot
good luck on next steps

Yeah, I was mostly wondering whether I should move existing options from U-Boot there too (which I did in the end).

Thanks! I'm trying to build a complete image for SD card with U-Boot now (decided to do that first to speedup current process of writing vendor image and doing sysupgrade from there). Let's see how far that goes...

I'm trying to make a particular package (uboot) build automatically for a platform (mediatek/32) for the device. I've defined Device/bpi-r2 in mediatek/image/32.mk and specified uboot-bpi_r2 in DEVICE_PACKAGES but uboot builder doesn't run during the build. What am I doing wrong?

My end aim is to build combined images with uboot. For this I've also specified IMAGES and IMAGE/sdcard.img.gz in Device and it does run the builder (but doesn't find uboot if I don't specifically enable the package).

Another specific question: there is Image/Build/squashfs defined in mediatek/image/32.mk and I'd like to reuse some of its outputs in my Build/bpi-r2-sd-image -- how do I specify that dependency?

Not sure if it's correct place for my question but I'm curious what's the status of openwrt support for bpi-r2?
Is image from https://downloads.openwrt.org/releases/18.06.2/targets/mediatek/mt7623/ operational?
Not sure how to flash it correctly.