BPI-R2 new image: OpenWrt 18.06.2 source code fork

Ok I have added this commit and recompiled again and I received that compile error I mentioned in the post yesterday. It seems this commit causes the compilation failure.

Something in this patch target/linux/mediatek/patches-4.14/0066-dts-mt7623-add-pcie.patch conflicts with the OpenWRT trunk.

  Kernel: arch/arm/boot/Image is ready
  DTC     arch/arm/boot/dts/mt7623a-rfb-emmc.dtb
arch/arm/boot/dts/mt7623a-rfb-emmc.dtb: ERROR (duplicate_node_names): Duplicate node name /pcie-phy@1a149000
arch/arm/boot/dts/mt7623a-rfb-emmc.dtb: ERROR (duplicate_node_names): Duplicate node name /pcie-phy@1a14a000
ERROR: Input tree has errors, aborting (use -f to force output)
make[6]: *** [scripts/Makefile.lib:317: arch/arm/boot/dts/mt7623a-rfb-emmc.dtb] Error 2
make[5]: *** [arch/arm/Makefile:348: dtbs] Error 2
make[5]: Leaving directory '/data/MKV/openwrt_trunk/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/linux-4.14.146'
make[4]: *** [Makefile:20: /data/MKV/openwrt_trunk/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/linux-4.14.146/.image] Error 2
make[4]: Leaving directory '/data/MKV/openwrt_trunk/target/linux/mediatek'
make[3]: *** [Makefile:13: install] Error 2
make[3]: Leaving directory '/data/MKV/openwrt_trunk/target/linux'
time: target/linux/install#9.90#3.66#13.59
make[2]: *** [target/Makefile:25: target/linux/install] Error 2
make[2]: Leaving directory '/data/MKV/openwrt_trunk'
make[1]: *** [target/Makefile:19: /data/MKV/openwrt_trunk/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.target_install] Error 2
make[1]: Leaving directory '/data/MKV/openwrt_trunk'
make: *** [/data/MKV/openwrt_trunk/include/toplevel.mk:227: world] Error 2

can you post the actual dts and the mt7623.dtsi?

I think the conflict is between these 2 patches

Lexa2 OpenWRT

Trunk OpenWRT

It’s not “conflict” - it’s just the duplication. Relevant PCIe controllers definition hadn’t made it into 18.06.x branch while it had landed to upstream trunk. I can see that there are some additional changes missing in upstream patch:

Changes missing
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
@@ -466,6 +466,13 @@
 				 <MT7623_PIN_82_UTXD1_FUNC_UTXD1>;
 		};
 	};
+
+        pcie_default: pcie_pin_default {
+                pins_cmd_dat {
+                        pinmux = <MT7623_PIN_208_AUD_EXT_CK1_FUNC_PCIE0_PERST_N>,
+                                 <MT7623_PIN_209_AUD_EXT_CK2_FUNC_PCIE1_PERST_N>;
+                };
+        };
 };
 
 &pwm {
@@ -544,3 +551,26 @@
 	status = "okay";
 };
 
+&pcie {
+        pinctrl-names = "default";
+        pinctrl-0 = <&pcie_default>;
+        status = "okay";
+
+        pcie@0,0 {
+                status = "okay";
+        };
+
+        pcie@1,0 {
+                status = "okay";
+        };
+};
+
+&pcie0_phy {
+        status = "okay";
+};
+
+&pcie1_phy {
+        status = "okay";
+};
+
+

So you will need to check if missing parts were already introduced into trunk by some other patch and if they are - then drop patches-4.14/0066-dts-mt7623-add-pcie.patch from my fork entirely. If they are not - then strip out from this patch parts that were already included upstream.

I am eagerly awaiting for your sync of current OpenWRT master, mostly to enable luci client side offload and latest adblock. :slight_smile:

Truth is I’m a bit more concentrated on toying with R2 WiFi driver trying to fix problems Frank hit when trying to port it to kernel 5.4 :frowning: . But hope is not lost for syncing, it’s currently second on the list of my priorities.

Man, any work you and other developers do on this is highly appreciated! many thanks!

This is already present in cioby23s build on lexa2 repo. Check here

thanks @spikerguy but I want to build my own :wink:

Yes you can also build your own using lexa2 branch and install luci and adblocker just like cioby did.

Yesterday I have applied with success @lexa2 patches to Openwrt trunk and build a test image but for now I have the git repo locally only it’s not uploaded anywhere.

Nice job, congrats! Wanted to mention that it makes me slightly uncomfortable when people mention “lexa2 patches”. I want to clarify that those are in fact a collective effort - as it typical for OSS world. I’ve done my small bit of job arranging things like building u-boot package for R2 or creating script to produce SD images. Other than that the only thing I’ve done was to rearrange other people work and provide configuration/scripts to make it all come together. Let’s call it “lexa2 fork” or “patches from lexa2 fork” - this way I don’t get credit for the things I didn’t do.

1 Like

@LeXa2 How do I flash an image built from your 18.06 fork onto EMMC? the only generated ext4 images are sdcard and sysupgrade.

For eMMC you will have to do some manual work: install preloader to boot0 eMMC hardware partition and then upload generated SD card image to the board and dd it to the main hardware partition of eMMC. IIRC that’s enough to make it fly, i.e. shutdown your board then, remove SD card, power it back on. Due to the way board works there’s a small chance it will stuck failing to find preloader, press “reset” button in this case while continuing to keep power button pressed.
A fair warning: I’m writing this from the top of my head being like 300km away from my testing R2 board right now. Give above suggestions a try and report back your results, we will help you to figure things out from there on.

will try, Currently I only have these on MMC: `

 mmcblk0: mmc0:0001 8WPD3R 7.28 GiB  
 mmcblk0boot0: mmc0:0001 8WPD3R partition 1 4.00 MiB
 mmcblk0boot1: mmc0:0001 8WPD3R partition 2 4.00 MiB
 mmcblk0rpmb: mmc0:0001 8WPD3R partition 3 512 KiB

`

I assume that I must somehow repartition it, right? also, what bootloader should I use? and can I remove boot1 and rpmb partitions?

Preloader has to be flashed to mmcblk0boot0, other stuff to mmcblk0 (you should create partitions on this to get p1 and p2)

You cannot remove the other 2

cacn you give me a run down on what I have to do to create the partitions with the right size? what what command to use?

Just copy first 512byte from your sd-image (dd) and reboot /reload partitions e.g. with fsdisk,then create filesystems. Or just copy full sd-image and change needed parts (like uboot config and fstab if it exist on openwrt)

So I didn’t touch the boot0 partition as I already had a bootloader there. I simply did a dd from the .img file to mmcblk0 and it worked.

1 Like

Right and wrong :-). For eMMC there are two “types” of partitions: (a) hardware-defined ones that are mandated by the eMMC embedded in chip controller - these are what you posted in the message I’m replying to and (b) ordinary “software” partitions that you can create using usual end-user tools line fdisk or parted. R2 is designed in a way so when it boots from eMMC it looks for preloader in the boot0 hardware partition of eMMC chip and then preloader is hard-coded to look for u-boot on the either “main” hardware partition of eMMC or on the SD card. And then u-boot is configured in a way to look for kernel on the first ms-dos mbr style partition which is expected to be formatted as FAT. By writing image to the main hw partition of your eMMC you had “partitioned” it - ms-dos mbr partition table in included into the SD image.