From a8d844c83dd5116782e009d2ef160ca17ae70cb1 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Tue, 8 Mar 2022 00:00:56 +0800 Subject: [PATCH] [build]: Fix marvell-armhf build hung issue (#10156) The marvel-armhf build is hung, it does not exist after waiting for a long time. It is caused by the process /etc/entropy.py which is started by the postinst script in target/debs/buster/sonic-platform-nokia-7215_1.0_armhf.deb $ cat postinst sh /usr/sbin/nokia-7215_plt_setup.sh ... $ cat usr/sbin/nokia-7215_plt_setup.sh | tail python /etc/entropy.py & $ cat etc/entropy.py if path.exists("/proc/sys/kernel/random/entropy_avail"): while 1: while avail() < 2048: with open('/dev/urandom', 'rb') as urnd, open("/dev/random", mode='wb') as rnd: d = urnd.read(512) t = struct.pack('ii', 4 * len(d), len(d)) + d fcntl.ioctl(rnd, RNDADDENTROPY, t) time.sleep(30) It is a workaround to fix the build issue, need to fix debian package, and revert the change. --- files/build_templates/sonic_debian_extension.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 393fbc042d..0874c51056 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -637,6 +637,11 @@ clean_proc() { } trap_push clean_proc sudo mount proc /proc -t proc +if [[ $CONFIGURED_ARCH == armhf ]]; then + # A workaround to fix the armhf build hung issue, caused by sonic-platform-nokia-7215_1.0_armhf.deb post installation script + ps -eo pid,cmd | grep python | grep "/etc/entropy.py" | awk '{print $1}' | xargs sudo kill -9 2>/dev/null || true +fi + sudo mkdir $FILESYSTEM_ROOT/target sudo mount --bind target $FILESYSTEM_ROOT/target sudo chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS info