Skip to content

Commit

Permalink
CR-1142391 - Programming xclbin immediately after xbutil reset fails …
Browse files Browse the repository at this point in the history
…on V70/VCK5000 (Xilinx#7150)

* CR-1142391 - Programming xclbin immediately after xbutil reset fails on V70/VCK5000

Signed-off-by: rbramand <[email protected]>

* Add new service to do initialization tasks

> Added init-apu service for doing initialization tasks
> This service also creates softkernel user which is used to run skd.
> Added changes to decide order in which services run
> init-apu -> skd -> apu-boot

Signed-off-by: rbramand <[email protected]>

* Add missing softkernel user

Signed-off-by: rbramand <[email protected]>

* Fix comments

Signed-off-by: rbramand <[email protected]>

Signed-off-by: rbramand <[email protected]>
  • Loading branch information
rbramand-xilinx authored Nov 16, 2022
1 parent ef9b739 commit db6a4dc
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 10 deletions.
14 changes: 14 additions & 0 deletions build/build_edge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@ config_versal_project()
fi
cp $INIT_TAB_FILE $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-core/sysvinit

# Create startup script to initialize apu tasks
SERVICE_FILE=$APU_RECIPES_DIR/init-apu.service
BB_FILE=$APU_RECIPES_DIR/init-apu.bb
INIT_SCRIPT=$APU_RECIPES_DIR/init-apu

if [ ! -d $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/init-apu ]; then
$PETA_BIN/petalinux-config --silentconfig
$PETA_BIN/petalinux-create -t apps --template install -n init-apu --enable
fi

cp $SERVICE_FILE $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/init-apu/files
cp $BB_FILE $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/init-apu
cp $INIT_SCRIPT $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/init-apu/files

# Create startup script to write to sysfs entry to indicate apu booted
SERVICE_FILE=$APU_RECIPES_DIR/apu-boot.service
BB_FILE=$APU_RECIPES_DIR/apu-boot.bb
Expand Down
9 changes: 0 additions & 9 deletions src/runtime_src/tools/scripts/apu_recipes/apu-boot
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
#!/bin/sh
if [ -e /sys/bus/platform/devices/rpu-channel/ready ]; then
echo 1 > /sys/bus/platform/devices/rpu-channel/ready
# Add softkernel user for PS kernel daemon to run as
useradd softkernel
# Work-around for AIE as it defaults root access only
chmod 666 /dev/aie0
# Create default xrt.ini
echo "# xrt.ini generated by apu-boot script" > /usr/bin/xrt.ini
echo "[Runtime]" >> /usr/bin/xrt.ini
echo "verbosity=5" >> /usr/bin/xrt.ini
echo "runtime_log=syslog" >> /usr/bin/xrt.ini
fi
1 change: 1 addition & 0 deletions src/runtime_src/tools/scripts/apu_recipes/apu-boot.service
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[Unit]
Description=apu-boot
After=skd.service

[Service]
ExecStart=/usr/bin/apu-boot
Expand Down
12 changes: 12 additions & 0 deletions src/runtime_src/tools/scripts/apu_recipes/init-apu
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# Add softkernel user to run PS kernel Daemon
useradd softkernel

# Work-around for AIE as it defaults root access only
chmod 666 /dev/aie0
# Create default xrt.ini
echo "# xrt.ini generated by apu-boot script" > /usr/bin/xrt.ini
echo "[Runtime]" >> /usr/bin/xrt.ini
echo "verbosity=5" >> /usr/bin/xrt.ini
echo "runtime_log=syslog" >> /usr/bin/xrt.ini
34 changes: 34 additions & 0 deletions src/runtime_src/tools/scripts/apu_recipes/init-apu.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
SUMMARY = "Init apu service"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"

LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://init-apu file://init-apu.service "

S = "${WORKDIR}"

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

inherit update-rc.d systemd

INITSCRIPT_NAME = "init-apu"
INITSCRIPT_PARAMS = "start 99 S ."

SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} = "init-apu.service"
SYSTEMD_AUTO_ENABLE:${PN}="enable"

do_install() {
if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
install -d ${D}${sysconfdir}/init.d/
install -m 0755 ${WORKDIR}/init-apu ${D}${sysconfdir}/init.d/
fi

install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/init-apu ${D}${bindir}/
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/init-apu.service ${D}${systemd_system_unitdir}
}

FILES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${sysconfdir}/*', '', d)}"
9 changes: 9 additions & 0 deletions src/runtime_src/tools/scripts/apu_recipes/init-apu.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=APU init Daemon

[Service]
ExecStart=/usr/bin/init-apu
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion src/runtime_src/tools/scripts/apu_recipes/skd.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=Soft Kernel Daemon
After=apu-boot.service
After=init-apu.service

[Service]
Type=forking
Expand Down

0 comments on commit db6a4dc

Please sign in to comment.