Update SPEC to incl. U-Boot
Use U-Boot klist to find kernel version and file. Add additional build with QEMU Virt machine (S mode) U-Boot as payload. Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
This commit is contained in:
parent
eb25d0f265
commit
4415806684
Binary file not shown.
Binary file not shown.
|
@ -3,7 +3,7 @@
|
|||
|
||||
Name: opensbi-unstable
|
||||
# The last part is short hash
|
||||
Version: 2019.03.20.e921fc2
|
||||
Version: 2019.03.30.f9cfe30
|
||||
Release: 1%{?dist}
|
||||
Summary: RISC-V Open Source Supervisor Binary Interface
|
||||
|
||||
|
@ -12,8 +12,8 @@ URL: https://github.com/riscv/opensbi
|
|||
|
||||
# Download tarball, e.g.:
|
||||
# https://github.com/riscv/opensbi/archive/%full_commit.tar.gz
|
||||
%global full_commit e921fc26911bd27cf715483b60c22920812aab21
|
||||
Source0: https://github.com/riscv/riscv-pk/archive/%{full_commit}.tar.gz
|
||||
%global full_commit f9cfe301c92aede87e46069e66e250d4039e413e
|
||||
Source0: https://github.com/riscv/opensbi/archive/%{full_commit}.tar.gz
|
||||
|
||||
BuildRequires: systemd-udev
|
||||
BuildRequires: grubby-deprecated
|
||||
|
@ -26,6 +26,9 @@ BuildRequires: kernel-core
|
|||
BuildRequires: make
|
||||
BuildRequires: dtc
|
||||
BuildRequires: gzip
|
||||
BuildRequires: file
|
||||
# U-Boot binary builds for all platforms
|
||||
BuildRequires: uboot-images-riscv64
|
||||
# For docs
|
||||
#BuildRequires: doxygen
|
||||
#BuildRequires: doxygen-latex
|
||||
|
@ -68,28 +71,69 @@ Summary: OpenSBI QEMU virt machine firmware with Fedora kernel embedded
|
|||
OpenSBI QEMU virt machine firmware with Fedora kernel embedded as payload.
|
||||
|
||||
|
||||
%packages images-riscv64
|
||||
Summary: OpenSBI firmware binaries with Fedora U-Boot embedded
|
||||
|
||||
|
||||
%description images-riscv64
|
||||
OpenSBI firmware images for all supported platforms with embedded Fedora
|
||||
U-Boot bootloader.
|
||||
|
||||
%prep
|
||||
%autosetup -n opensbi-%{full_commit}
|
||||
|
||||
|
||||
%build
|
||||
# Find Fedora kernel image in /boot
|
||||
vmlinuz=$(find /boot | grep vmlinuz | grep -v -E '(rescue|hmac)')
|
||||
if [[ "$vmlinuz" = *$'\n'* ]]; then
|
||||
echo "We expected to find a single file!"
|
||||
mkdir -p fedora-builds/{kernel,uboot-qemu-virt}
|
||||
for build in kernel uboot-qemu-virt; do
|
||||
cp -r $(ls -1 | grep -v fedora-builds) fedora-builds/$build
|
||||
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
|
||||
|
||||
echo "Payload: $vmlinuz"
|
||||
latestKernel="/lib/modules/$(tail -n1 "$ubootDir/$ubootKList")/vmlinuz"
|
||||
|
||||
cp "$vmlinuz" Image.gz
|
||||
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 docs
|
||||
|
||||
# BUILD: kernel
|
||||
popd
|
||||
|
||||
# BUILD: uboot-qemu-virt
|
||||
pushd fedora-builds/uboot-qemu-virt
|
||||
|
||||
ubootFile=/usr/share/uboot/qemu-riscv64_smode/u-boot.bin
|
||||
make PLATFORM=qemu/virt FW_PAYLOAD_PATH="$ubootFile"
|
||||
|
||||
# BUILD: uboot-qemu-virt
|
||||
popd
|
||||
|
||||
|
||||
%install
|
||||
# BUILD: kernel
|
||||
pushd builds/kernel
|
||||
|
||||
make PLATFORM=qemu/virt I=%{buildroot} install
|
||||
#make I=%{buildroot} install_docs
|
||||
|
||||
|
@ -104,16 +148,31 @@ mv %{buildroot}/platform %{buildroot}%{_datadir}/%{name}/
|
|||
#mv %{buildroot}/docs/refman.pdf %{buildroot}%{_pkgdocdir}/
|
||||
#rm -rf %{buildroot}/docs
|
||||
|
||||
# Find Fedora kernel image in /boot and extract version
|
||||
vmlinuz=$(find /boot | grep vmlinuz | grep -v -E '(rescue|hmac)')
|
||||
vmlinuz_version=$(echo "$vmlinuz" | cut -d'-' -f2-)
|
||||
# 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")
|
||||
|
||||
|
||||
mkdir -p %{buildroot}/boot/opensbi/unstable
|
||||
cp build/platform/qemu/virt/firmware/fw_jump.elf \
|
||||
%{buildroot}/boot/opensbi/unstable/fw_jump.elf
|
||||
cp build/platform/qemu/virt/firmware/fw_payload.elf \
|
||||
%{buildroot}/boot/opensbi/unstable/fw_payload-${vmlinuz_version}.elf
|
||||
%{buildroot}/boot/opensbi/unstable/fw_payload-${latestKernelVersion}.elf
|
||||
|
||||
# BUILD: kernel
|
||||
popd
|
||||
|
||||
# BUILD: uboot-qemu-virt
|
||||
pushd builds/uboot-qemu-virt
|
||||
|
||||
cp build/platform/qemu/virt/firmware/fw_payload.elf \
|
||||
%{buildroot}/boot/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf
|
||||
|
||||
# BUILD: uboot-qemu-virt
|
||||
popd
|
||||
|
||||
%files
|
||||
%license COPYING.BSD
|
||||
|
@ -122,6 +181,7 @@ cp build/platform/qemu/virt/firmware/fw_payload.elf \
|
|||
|
||||
%files fedora
|
||||
/boot/opensbi/unstable/fw_payload-*.elf
|
||||
%exclude /boot/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf
|
||||
|
||||
%files libsbi-devel
|
||||
#%%doc %%{_pkgdocdir}/refman.pdf
|
||||
|
@ -131,6 +191,13 @@ cp build/platform/qemu/virt/firmware/fw_payload.elf \
|
|||
%files platform-virt
|
||||
%{_datadir}/%{name}
|
||||
|
||||
%files images-riscv64
|
||||
/boot/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf
|
||||
|
||||
%changelog
|
||||
* Sat Mar 30 2019 David Abdurachmanov <david.abdurachmanov@gmail.com> 2019.03.30.f9cfe30-1
|
||||
- Change the way we find kernel
|
||||
- Add a QEMU Virt machine build with U-Boot
|
||||
|
||||
* Wed Mar 20 2019 David Abdurachmanov <david.abdurachmanov@gmail.com> 2019.03.20.e921fc2-1
|
||||
- Initial version
|
||||
|
|
Loading…
Reference in New Issue