Do not use U-Boot files to find the latest kernel

We have moved to booti from bootm (wrapped kernel) and thus old
U-Boot scripts and files are no more available. Detect kernel file
and version directly from the filesystem based on modification time.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
This commit is contained in:
David Abdurachmanov 2019-08-30 14:14:01 -07:00
parent a232dac507
commit fab442dfed
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
1 changed files with 3 additions and 25 deletions

View File

@ -92,29 +92,13 @@ done
# BUILD: kernel
pushd fedora-builds/kernel
# Use klist.txt to find the latest installed kernel
[ -f /etc/sysconfig/uboot ] && . /etc/sysconfig/uboot
ubootDir=${UBOOT_DIR:-"/boot"}
ubootKList=${UBOOT_KLIST:-"klist.txt"}
if [ ! -f $ubootDir/$ubootKList ]; then
echo "U-Boot klist was not found! Cannot locate latest installed kernel image!"
exit 1
fi
latestKernel="/lib/modules/$(tail -n1 "$ubootDir/$ubootKList")/vmlinuz"
latestKernel=$(ls -1t /lib/modules/*/vmlinuz | head -n1)
file "$latestKernel"
echo "Payload: $latestKernel"
# Kernel is built with Image.gz target, we need to unpack before embedding it
# into OpenSBI
cp "$latestKernel" Image.gz
gunzip Image.gz
make PLATFORM=qemu/virt FW_PAYLOAD_PATH="$PWD/Image"
make PLATFORM=qemu/virt FW_PAYLOAD_PATH="$latestKernel"
#make docs
# BUILD: kernel
@ -162,13 +146,7 @@ mv %{buildroot}/platform %{buildroot}%{_datadir}/%{name}/
#mv %{buildroot}/docs/refman.pdf %{buildroot}%{_pkgdocdir}/
#rm -rf %{buildroot}/docs
# Use klist.txt to find the latest installed kernel
[ -f /etc/sysconfig/uboot ] && . /etc/sysconfig/uboot
ubootDir=${UBOOT_DIR:-"/boot"}
ubootKList=${UBOOT_KLIST:-"klist.txt"}
latestKernelVersion=$(tail -n1 "$ubootDir/$ubootKList")
latestKernelVersion=$(ls -1t /lib/modules/*/vmlinuz | head -n1 | cut -d'/' -f4)
mkdir -p %{buildroot}/boot/opensbi/unstable
cp build/platform/qemu/virt/firmware/fw_jump.elf \