Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[platform][marvell] Arm 32-bit Arch support changes #5749

Merged
merged 7 commits into from
Dec 3, 2020

Conversation

Sabareesh-Kumar-Anandan
Copy link
Contributor

Signed-off-by: Sabareesh Kumar Anandan sanandan@marvell.com

- Why I did it
- How I did it
Added Arm 32-bit arch build fixes
Added marvell armhf platform specific changes

- How to verify it
Compiled for arm 32-bit sonic image and verified it

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@@ -52,6 +52,9 @@ main()
{
fw_uboot_env_cfg
et6448m_profile

python /etc/entropy.py &
/bin/sh /etc/inband_mgmt.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this inband mgmt port?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ET6448M board, down't have OOB (mgmt) port.
To access management, we have enabled in-band management feature in one of the data port.

ifconfig eth0 down
systemctl restart networking
fi
sleep 120
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such sleep concerns me. why do we need so long wait time.

Copy link
Contributor

@antony-rheneus antony-rheneus Nov 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once ip address is assigned for in-band port, we can add longer delay to check back the status of the port again

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what ip addr here? are we assume dhcp on eth0? why do we need to wait for ip address to be assign on eth0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the same board, via Ethernet USB dongle, management interface can also be created. so one difference would be ip address would not be assigned for in-band interface as it would have been created after syncd init.
Whereas for external eth0, ip address would be assigned statically/dhcp, and it should not be disturbed unnecessarily.

modprobe i2c_mv64xxx
modprobe i2c-dev
modprobe i2c_mux_gpio
sleep 60
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such sleep concerns me. why do we need so long wait time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, the logic is to start a monitoring loop for the creation of in-band management port once data ports are initialized through sai.
So sleep has been introduced to start later after syncd docker is initialized.

fi
sleep 120
else
sleep 3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why sleep 3 here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At any time user can restart syncd docker by any means, at that time this loop has to monitor the reincarnation of the data port used for in-band and then restart ifup scripts for management port.
Longer the delay lesser the cpu utilization.

@@ -52,6 +52,9 @@ main()
{
fw_uboot_env_cfg
et6448m_profile

python /etc/entropy.py &
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this entropy.py use for?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In A385 CPU arch, random number generator is not supported in CPU soc. During bootup, systemd requires lot of random seeds, so this has been handled in SW by providing entropy from pseudo random generator.

fi
# armhf-marvell_et6448m_52x-r0 - Platform = Et6448M
# armhf-nokia_ixs7215_52x-r0 - Platform = Nokia IPD6448M
PLATFORM=`sed -n 's/onie_platform=\(.*\)/\1/p' $MACH_FILE`
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/onie_platform=(.*)/\1/p [](start = 18, length = 27)

s/onie_platform=(.*)/\1/p [](start = 18, length = 27)

s/^onie_platform=\(.*\)/\1/p
Could you add ^ at the beginning of the regex? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -68,6 +100,13 @@ prepare_boot_menu() {
echo $FW_ENV_DEFAULT > /etc/fw_env.config
echo "Using pre-configured uboot env"
fi
if [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
#FW_ENV_DEFAULT='/dev/mtd1 0x0000000 0x10000'
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#FW_ENV_DEFAULT='/dev/mtd1 0x0000000 0x10000' [](start = 8, length = 45)

#FW_ENV_DEFAULT='/dev/mtd1 0x0000000 0x10000' [](start = 8, length = 45)

remove unused code? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

blk_dev="/dev/sda"
demo_part=$(sgdisk -p $blk_dev | grep -e "$demo_volume_label" -e "$legacy_volume_label" | awk '{print $1}')
# ONIE partition size 168MB
onie_part_size=168
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

168 [](start = 19, length = 3)

How do you determine this number? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If board is from manufacturing without sonic partition, then skip onie partition size as per platform partition layout

echo "Error: Unable to create partition $demo_part on $blk_dev"
exit 1
}
partprobe || true
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems wrong indentation level. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

# Make filesystem
mkfs.ext4 -L $demo_volume_label /dev/$demo_dev

}
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra empty line #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@qiluo-msft
Copy link
Collaborator

qiluo-msft commented Nov 13, 2020

Remove extra empty line #Closed


Refers to: platform/marvell-armhf/platform.conf:269 in 8765059. [](commit_id = 8765059e8f0d4264c793aa6f31312edf852727bf, deletion_comment = False)

@@ -0,0 +1,17 @@
#!/usr/bin/python
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python [](start = 11, length = 6)

Is this script compatible with python3? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes and verified

d = urnd.read(512)
t = struct.pack('ii', 4 * len(d), len(d)) + d
fcntl.ioctl(rnd, RNDADDENTROPY, t)
time.sleep(30)
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time.sleep(30) [](start = 4, length = 14)

why sleep? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In A385 CPU arch, random number generator is not supported in CPU soc. During bootup, systemd requires lot of random seeds, so this has been handled in SW by providing entropy from pseudo random generator. Added sleep 30 to not to hog the CPU

@@ -52,6 +52,9 @@ main()
{
fw_uboot_env_cfg
et6448m_profile

python /etc/entropy.py &
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

& [](start = 27, length = 1)

why run in background? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

periodically we need to update random

modprobe i2c_mv64xxx
modprobe i2c-dev
modprobe i2c_mux_gpio
sleep 60
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sleep 60 [](start = 5, length = 8)

In general I am worried about the magic number sleep in all scripts. Do you want to achieve some collaboration between them? Is there any risk in future platforms? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no use to start inband mgmt script before entire system is ready. So we have added 60sec sleep
This is specific only to this platform. Not applicable for other platforms.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the info. So my concern is "entire system is ready" < 60s, any risk here? If risk happens, what is the impact?


In reply to: 526620478 [](ancestors = 526620478)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no risk in that case. In-band mgmt port will be brought up after that.

FROM multiarch/debian-debootstrap:armhf-buster
COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qemu /usr/bin/qemu-arm-static [](start = 12, length = 29)

Why copy a binary from another image? Seems a hack. #Closed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a hack, but to change the qemu version from 4 to 5, and qemu 4 has severe segfaults with golang

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you achieve this goal by installing qemu-user-static package? I see version 5.0 https://packages.debian.org/buster-backports/qemu-user-static


In reply to: 526621660 [](ancestors = 526621660)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldnt able to install qemu from debian buster.
Error Logs:
Unpacking qemu-user-static (1:5.0-14~ bpo10+1) ...
dpkg (subprocess): unable to execute rm command for cleanup (rm): Too many levels of symbolic links
dpkg: error while cleaning up:
rm command for cleanup subprocess returned error exit status 2
Could not exec dpkg!
E: Sub-process /usr/bin/dpkg returned an error code (100)
E: Problem executing scripts DPkg::Post-Invoke 'rm -f /var/cache/apt/archives/.deb /var/cache/apt/archives/partial/.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code
The command '/bin/sh -c apt-get install -y qemu-user-static=1:5.0-14~bpo10+1' returned a non-zero code: 100

Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with this error message. I notice you are using dpkg directly. Did you try use apt-get. Please add something like below into /etc/apt/sources.list

deb [arch=amd64] http://debian-archive.trafficmanager.net/debian buster-backports main

I don't have an armhf dev environment, so please test it first.


In reply to: 530707840 [](ancestors = 530707840,526621660)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I have already done that.
echo 'deb [arch=armhf] http://ftp.debian.org/debian buster-backports main' >> /etc/apt/sources.list
apt-get install -y qemu-user-static=5.0-14~ bpo10+1

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I see deb ... line, but I cannot find the second part.

apt-get install -y qemu-user-static=5.0-14~ bpo10+1

In reply to: 532104630 [](ancestors = 532104630,530707840,526621660)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried below lines and it was not working. got same errors as above. So, I didnt add this to the PR.
echo 'deb [arch=armhf] http://ftp.debian.org/debian buster-backports main' >> /etc/apt/sources.list
apt-get install -y qemu-user-static=5.0-14~ bpo10+1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @qiluo-msft, @Sabareesh-Kumar-Anandan,

We actually can't upgrade the qemu-user-static by doing apt-get install -y qemu-user-static=5.0-14~ bpo10+1. Because the docker sonic-slave-buster is already running in the emulated arm environment, if you try to install qemu-user-static, it will pull the qemu-user-static binaries from the Debian repo for the arm arch and these binaries are to emulate something else from the arm host arch.

What we want is to update a qemu-arm-static binary emulating the arm client arch from the x86_64 host arch, copying the new version from multiarch/qemu-user-static:x86_64-arm-5.0.0-2 is a correct way to do this.

Thanks,
Benjamin

if [ "$PLATFORM" = "armhf-marvell_et6448m_52x-r0" ]; then
trap_push "${onie_bin} umount /dev/ubi0_0|| true"
mount -t ubifs /dev/ubi0_0 $demo_mnt || {
echo "mount -t ubifs /dev/ubi0_0 $demo_mnt Failed"
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed [](start = 55, length = 6)

If this is a failure, exit? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on failure, trap push will take care as script is enabled with -e

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mount ... || { echo "..." } will always succeed. I see your message said "Failed", so I guess you need exit after echo.


In reply to: 526622606 [](ancestors = 526622606)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added exit

@qiluo-msft
Copy link
Collaborator

qiluo-msft commented Nov 19, 2020

Remove extra empty line #Closed


Refers to: platform/marvell-armhf/platform.conf:267 in 8765059. [](commit_id = 8765059e8f0d4264c793aa6f31312edf852727bf, deletion_comment = False)

@Sabareesh-Kumar-Anandan
Copy link
Contributor Author

Remove extra empty line

Refers to: platform/marvell-armhf/platform.conf:267 in a085fde. [](commit_id = a085fde, deletion_comment = False)

removed it

@Sabareesh-Kumar-Anandan
Copy link
Contributor Author

Hi @lguohan,
We have answered/addressed all the comments. Do you have any more comments?
Also, Can you please retrigger the tests? Failures were not caused by this PR.

Sabareesh Kumar Anandan added 4 commits November 30, 2020 13:45
Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
Sabareesh Kumar Anandan added 3 commits November 30, 2020 13:45
Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
Copy link
Collaborator

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please also check with other reviewers.

@lguohan lguohan merged commit fe524c3 into sonic-net:master Dec 3, 2020
santhosh-kt pushed a commit to santhosh-kt/sonic-buildimage that referenced this pull request Feb 25, 2021
- Added Arm 32-bit arch build fixes
- Added marvell armhf platform specific changes

Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants