-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
@@ -52,6 +52,9 @@ main() | |||
{ | |||
fw_uboot_env_cfg | |||
et6448m_profile | |||
|
|||
python /etc/entropy.py & | |||
/bin/sh /etc/inband_mgmt.sh |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why sleep 3 here?
There was a problem hiding this comment.
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 & |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
platform/marvell-armhf/platform.conf
Outdated
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` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
platform/marvell-armhf/platform.conf
Outdated
@@ -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' |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
platform/marvell-armhf/platform.conf
Outdated
echo "Error: Unable to create partition $demo_part on $blk_dev" | ||
exit 1 | ||
} | ||
partprobe || true |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 | ||
|
||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Remove extra empty line #Closed Refers to: platform/marvell-armhf/platform.conf:269 in 8765059. [](commit_id = 8765059e8f0d4264c793aa6f31312edf852727bf, deletion_comment = False) |
235eb09
to
a085fde
Compare
@@ -0,0 +1,17 @@ | |||
#!/usr/bin/python |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 & |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added exit
Remove extra empty line #Closed Refers to: platform/marvell-armhf/platform.conf:267 in 8765059. [](commit_id = 8765059e8f0d4264c793aa6f31312edf852727bf, deletion_comment = False) |
Hi @lguohan, |
3a80614
to
8667ee8
Compare
Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
8765059
to
097eaa1
Compare
There was a problem hiding this 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.
- Added Arm 32-bit arch build fixes - Added marvell armhf platform specific changes Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
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)
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)