ericwoud / buildR64ubuntu

Install a minimal Arch-Linux, Ubuntu or Debian on Banana Pi R64 from scratch.
9 stars 2 forks source link

How to compile SDMMC and EMMC images? #1

Closed darcyg closed 3 years ago

darcyg commented 3 years ago

hi , On Ubuntu 20.04, configure loopdev and compile the R64 image. Prompt error. Unable to generate image Can you provide complete operating instructions? build-error.log build.log

thx!

ericwoud commented 3 years ago

Also when using loopdev you first need to format, same as with sd card. build.sh -SD

This will create the file

On Wed, Aug 25, 2021, 1:35 PM Darcy Gong @.***> wrote:

hi , On Ubuntu 20.04, configure loopdev and compile the R64 image. Prompt error. Unable to generate image Can you provide complete operating instructions? build-error.log https://github.com/ericwoud/buildR64ubuntu/files/7046593/build-error.log build.log https://github.com/ericwoud/buildR64ubuntu/files/7046595/build.log

thx!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ericwoud/buildR64ubuntu/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3OR5EQFBFAXPVJYDXAVG3T6TIRRANCNFSM5CY3WKRQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

darcyg commented 3 years ago

Also when using loopdev you first need to format, same as with sd card. build.sh -SD This will create the file On Wed, Aug 25, 2021, 1:35 PM Darcy Gong @.***> wrote: hi , On Ubuntu 20.04, configure loopdev and compile the R64 image. Prompt error. Unable to generate image Can you provide complete operating instructions? build-error.log https://github.com/ericwoud/buildR64ubuntu/files/7046593/build-error.log build.log https://github.com/ericwoud/buildR64ubuntu/files/7046595/build.log thx! — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#1>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3OR5EQFBFAXPVJYDXAVG3T6TIRRANCNFSM5CY3WKRQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

thank!

darcyg commented 3 years ago

hi ericwoud, The EMMC image eth1 I built does not have DHCP. But SDMMC can DHCP.How to solve it?

ericwoud commented 3 years ago

Check systemd/network files for DHCP client setup.

Check isc-dhcp.service for DHCP server setup if this is what you want

With the build script DHCP settings are different for AP (access point( setup compared to RT (router) setup.

The rest is general Linux setup and there are lots of examples to find ..

⁣Get BlueMail for Android ​

On Aug 26, 2021, 3:29 PM, at 3:29 PM, Darcy Gong @.***> wrote:

hi ericwoud, The EMMC image eth1 I built does not have DHCP. But SDMMC can DHCP.How to solve it?

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/ericwoud/buildR64ubuntu/issues/1#issuecomment-906414604

darcyg commented 3 years ago

Check systemd/network files for DHCP client setup. Check isc-dhcp.service for DHCP server setup if this is what you want With the build script DHCP settings are different for AP (access point( setup compared to RT (router) setup. The rest is general Linux setup and there are lots of examples to find .. ⁣Get BlueMail for Android ​ On Aug 26, 2021, 3:29 PM, at 3:29 PM, Darcy Gong @.***> wrote: hi ericwoud, The EMMC image eth1 I built does not have DHCP. But SDMMC can DHCP.How to solve it? -- You are receiving this because you commented. Reply to this email directly or view it on GitHub: #1 (comment)

I checked all configurations. Set up a static IP and gateway. But still can't go online.

frank-w commented 3 years ago

What do you do with eth1? Mainline kernel uses dsa driver for ethernet and this does only support 1 gmac (eth0).

So you have wan and multiple lanports connected via eth0 to soc.

You have to put eth0 up and then configure dsa user port (wan,lanx) with your ip configuration (static ip or dhcp). No dhcp/static directly on eth0 and no eth1 (except second gmac patches are applied).

https://www.fw-web.de/dokuwiki/doku.php?id=en/bpi-r2/network/start

ericwoud commented 3 years ago

Kernel does not support 2 CPU ports but kernel supports external GMAC on DSA port 5.

See readme about DSA port 5.

On Fri, Aug 27, 2021, 7:40 AM Frank Wunderlich @.***> wrote:

What do you do woth eth1? Mainline kernel uses dsa driver for ethernet and this does only support 1 gmac.

So you have wan and multiple lanports connected via eth0 to soc.

You have to put eth0 up and then configure dsa user port (wan,lanx) with your ip configuration (static ip or dhcp). No dhcp/static directly on eth0 and no eth1 (except second gmac patches are applied).

https://www.fw-web.de/dokuwiki/doku.php?id=en/bpi-r2/network/start

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ericwoud/buildR64ubuntu/issues/1#issuecomment-906939808, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3OR5BMNPJDLUVXKXAJDK3T64QMTANCNFSM5CY3WKRQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

frank-w commented 3 years ago

I know this,but afair mt7530 driver supports direct connection only till 5.4. After that a vlan based setup is needed for external phy. Talked with deng qingfan or landen chao some time ago

But i wonder why it affects compile...which error comes up on compiling?

ericwoud commented 3 years ago

I have vlan setup for this already. I used this kind of setup also on Marvell chips

On Fri, Aug 27, 2021, 8:26 AM Frank Wunderlich @.***> wrote:

I know this,but afair mt7530 driver supports direct connection only till 5.4. After that a vlan based setup is needed for external phy. Talked with deng qingfan or landen chao some time ago

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ericwoud/buildR64ubuntu/issues/1#issuecomment-906958203, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3OR5DSV3PAFLMQAKVPGW3T64VZLANCNFSM5CY3WKRQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ericwoud commented 3 years ago

Strange it works on sdnnc and not on emmc. Can you compare?

darcyg commented 3 years ago

奇怪的是它适用于 sdnnc 而不适用于 emmc。你能比较吗?

Eth1 of SDMMC can use DHCP, but eth1 of EMMC cannot use DHCP. Setting the static IP of eth1 will not work either. Unable to network. The rootfs files of EMMC and SDMMC are basically the same. I compared the configurations on both sides. It is suspected that there is a problem with the kernel or DTS configuration.

ericwoud commented 3 years ago

Please Check if the firmware files are prrsent

On Fri, Aug 27, 2021, 10:43 AM Darcy Gong @.***> wrote:

奇怪的是它适用于 sdnnc 而不适用于 emmc。你能比较吗?

Eth1 of SDMMC can use DHCP, but eth1 of EMMC cannot use DHCP. Setting the static IP of eth1 will not work either. Unable to network. The rootfs files of EMMC and SDMMC are basically the same. I compared the configurations on both sides. It is suspected that there is a problem with the kernel or DTS configuration.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ericwoud/buildR64ubuntu/issues/1#issuecomment-907034969, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3OR5FKHU5NN2XRK3ZT7Z3T65F2BANCNFSM5CY3WKRQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

darcyg commented 3 years ago

Please Check if the firmware files are prrsent On Fri, Aug 27, 2021, 10:43 AM Darcy Gong @.***> wrote: 奇怪的是它适用于 sdnnc 而不适用于 emmc。你能比较吗? Eth1 of SDMMC can use DHCP, but eth1 of EMMC cannot use DHCP. Setting the static IP of eth1 will not work either. Unable to network. The rootfs files of EMMC and SDMMC are basically the same. I compared the configurations on both sides. It is suspected that there is a problem with the kernel or DTS configuration. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3OR5FKHU5NN2XRK3ZT7Z3T65F2BANCNFSM5CY3WKRQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Which firmware? About where it is. Sorry, I don't know much about kernel drivers.

darcyg commented 3 years ago

我知道这一点,但公平的 mt7530 驱动程序只支持直接连接到 5.4。之后,外部 phy 需要基于 vlan 的设置。前段时间和邓青帆或兰登超谈过

但我想知道为什么它会影响编译...编译时出现哪个错误?

Compilation is not affected. I don't have a format sdcard

darcyg commented 3 years ago

Move 'DHCP=yes', under 'Network', from 10-eth1.network to 10-wan.network. Remove 10-eth1.network file Remove 'aux' from 10-wan.network file. Adjust nftables.conf as described in the file.

I modified the nftables.conf file. But whether define Wan = Wan or WAN = eth0 or WAN= wan@eth0 Can't connect to the network

ericwoud commented 3 years ago

Compare files at /lib/firmware/mediatek

frank-w commented 3 years ago

There is no firmware file for ethernet.maybe atf/uboot does not correctly enable second gmac? I had similar problems with emmc.

Maybe disable second gmac patch so that wan goes over eth0

ericwoud commented 3 years ago

When running as Access Point, eth1 and aux are not used and still down. Then I do:

ip link set eth1 up
ip link set aux up

With startup on sdmmc:

[  673.434892] mtk_soc_eth 1b100000.ethernet eth1: configuring for fixed/rgmii link mode
[  673.443613] mtk_soc_eth 1b100000.ethernet eth1: Link is Up - 1Gbps/Full - flow control rx/tx
[  673.452659] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[  716.692568] mt7530 mdio-bus:00 aux: configuring for fixed/rgmii link mode
[  716.700044] mt7530 mdio-bus:00 aux: Link is Up - 1Gbps/Full - flow control rx/tx
[  716.703265] 8021q: adding VLAN 0 to HW filter on device aux
[  716.718588] IPv6: ADDRCONF(NETDEV_CHANGE): aux: link becomes ready

With startup on emmc:

[   72.650868] mtk_soc_eth 1b100000.ethernet eth1: configuring for fixed/rgmii link mode
[   72.658849] mtk_soc_eth 1b100000.ethernet eth1: Link is Up - 1Gbps/Full - flow control rx/tx
[  131.210445] mt7530 mdio-bus:00 aux: configuring for fixed/rgmii link mode
[  131.217930] mt7530 mdio-bus:00 aux: Link is Up - 1Gbps/Full - flow control rx/tx
[  131.219479] 8021q: adding VLAN 0 to HW filter on device aux
[  131.238892] IPv6: ADDRCONF(NETDEV_CHANGE): aux: link becomes ready

So it would seem that eth1 link does not become ready when starting from emmc. There may be some difference in bootrom with initialising eth1 interface, as I do not see where there are any other differences.

Follow the steps in the readme to not use port 5.

[Link] RequiredForOnline=no

[Network] BindCarrier=eth0 DHCP=yes

ericwoud commented 3 years ago

I have found a fix for this issue, it is quite simple.

If you set the bootswitch so it tries to boot from emmc first, the problem does not occur.

After booting from bootrom, everything is exactly the same, so this is a bootrom issue. I consider this issue as closed.

frank-w commented 3 years ago

what is the fix? don't see a commit for this. have you modified ATF/uboot/linux?

looks like eth1 is named aux in your logs

ericwoud commented 3 years ago

The solution is to switch the bootswitch when using router setup on emmc. When the boards boots, without first attempting to boot from sd, but directly boots emmc, the problem does not occur. Ap setup is not affected. I cannot read the bootrom code, so there is no way for me to find out which registers are written to between the first step skipped boot from sdmmc and the second step boot from emmc.

If you want, we could open a topic on the forum and see if anyone from mediatek picks this up...

Port 5 is named aux.

frank-w commented 3 years ago

Does this problem also happen with uboot or only without? Maybe it is caused by atf modifications (prevent boot0, bl31 loaded?)

I can try to apply your second gmac patch,if i find it

ericwoud commented 3 years ago

This was already before the boot without U-Boot and ATF is was not modified at all.

The only thing patched to use port 5 is the .dts:

https://github.com/ericwoud/buildR64ubuntu/blob/master/linux-5.15-rc1/dsaport5.patch

So here also no code is patched.

Then it is about setting up aux and wan in a separate vlan, and setting up eth1 as if it were the wan port... So only changes in /etc/systemd/network and in /etc/nftables.conf

However, booting up from emmc, when the switch is set to try sdmmc first, eth1 is broken. Only changing the switch makes eth1 functional. Whatever is causing it is happening in bootrom and the kernel driver initiallisation is not clearing this problem as it should.

Since nobody really has used eth1, I guess nobody noticed it before.

ericwoud commented 3 years ago

More info:

When the switch is set to boot from emmc first, but it cannot because I cleared the first block, then it boots from sdmmc. I thought eth1 would then also not work when booting from sdmmc,

But then eth1 does work booting from sdmmc, no matter the position of the switch.

It really only happens when booting from emmc, and it can first not boot sdmmc.