Skip to content

Commit

Permalink
Merge pull request #346 from trabucayre/update_simplify
Browse files Browse the repository at this point in the history
Update simplify
  • Loading branch information
enjoy-digital committed Aug 4, 2023
2 parents a419ca6 + e257929 commit e693c96
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ $ cd buildroot
$ make BR2_EXTERNAL=../linux-on-litex-vexriscv/buildroot/ litex_vexriscv_defconfig
$ make
```
The binaries are located in *output/images/*.
The binaries are located in *output/images/* and *images/*.
[> Generating the Linux binaries with USB host support (optional)
-----------------------------------------------------------------
Expand All @@ -326,12 +326,12 @@ $ cd buildroot
$ make BR2_EXTERNAL=../linux-on-litex-vexriscv/buildroot/ litex_vexriscv_usbhost_defconfig
$ make
```
The binaries are located in *output/images/*.
The binaries are located in *output/images/* and *images/*.
[> Generating the OpenSBI binary (optional)
[> Generating the OpenSBI binary (optional / part of the buildroot build sequence)
-------------------------------------------
```sh
$ git clone https://github.com/litex-hub/opensbi --branch 0.8-linux-on-litex-vexriscv
$ git clone https://github.com/litex-hub/opensbi --branch 1.3.1-linux-on-litex-vexriscv
$ cd opensbi
$ make CROSS_COMPILE=riscv-none-embed- PLATFORM=litex/vexriscv
```
Expand Down
24 changes: 24 additions & 0 deletions buildroot/board/litex_vexriscv/genimage.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
image boot.vfat {
vfat {
files = {
"boot.json",
"Image",
"opensbi.bin",
"rootfs.cpio",
"rv32.dtb"
}
}

size = 50M
}

image sdcard.img {
hdimage {
}

partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}
}
47 changes: 47 additions & 0 deletions buildroot/board/litex_vexriscv/post-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

set -e

BOARD_DIR="$(dirname $0)"
GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"

LINUX_ON_VEXRISCV_OUT_DIR=$BR2_EXTERNAL_LITEX_VEXRISCV_PATH/../images
DST_DTB=$LINUX_ON_VEXRISCV_OUT_DIR/rv32.dtb
DST_OPENSBI=$LINUX_ON_VEXRISCV_OUT_DIR/opensbi.bin
DST_IMAGE=$LINUX_ON_VEXRISCV_OUT_DIR/Image
DST_ROOTFS=$LINUX_ON_VEXRISCV_OUT_DIR/rootfs.cpio

rm -f $DST_OPENSBI $DST_ROOTFS $DST_IMAGE
ln -s $BINARIES_DIR/fw_jump.bin $DST_OPENSBI
ln -s $BINARIES_DIR/Image $DST_IMAGE
ln -s $BINARIES_DIR/rootfs.cpio $DST_ROOTFS

if [ ! -e $DST_DTB ]; then
echo ""
echo "Warning: missing file $DST_DTB"
echo "a dummy file will be created"
echo "must be replaced manually by required rv32.dtb"
echo ""
touch $DST_OPENSBI
fi

# Pass an empty rootpath. genimage makes a full copy of the given rootpath to
# ${GENIMAGE_TMP}/root so passing TARGET_DIR would be a waste of time and disk
# space. We don't rely on genimage to build the rootfs image, just to insert a
# pre-built one in the disk image.

trap 'rm -rf "${ROOTPATH_TMP}"' EXIT
ROOTPATH_TMP="$(mktemp -d)"

rm -rf "${GENIMAGE_TMP}"

genimage \
--rootpath "${ROOTPATH_TMP}" \
--tmppath "${GENIMAGE_TMP}" \
--inputpath "${LINUX_ON_VEXRISCV_OUT_DIR}" \
--outputpath "${LINUX_ON_VEXRISCV_OUT_DIR}" \
--config "${GENIMAGE_CFG}"

exit $?

20 changes: 18 additions & 2 deletions buildroot/configs/litex_vexriscv_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ BR2_TARGET_GENERIC_GETTY_PORT="console"
# Filesystem
BR2_TARGET_ROOTFS_CPIO=y

# Image
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_LITEX_VEXRISCV_PATH)/board/litex_vexriscv/post-image.sh"

# Kernel header version
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y

# Kernel (litex-rebase branch)
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
Expand All @@ -33,11 +39,21 @@ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_LITEX_VEXRISCV_PATH)/board/litex_vexriscv/linux.config"
BR2_LINUX_KERNEL_IMAGE=y

# Bootloader (opensbi)
BR2_TARGET_OPENSBI=y
BR2_TARGET_OPENSBI_CUSTOM_GIT=y
BR2_TARGET_OPENSBI_CUSTOM_REPO_URL="https://github.com/litex-hub/opensbi.git"
BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION="1.3.1-linux-on-litex-vexriscv"
BR2_TARGET_OPENSBI_PLAT="litex/vexriscv"
BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG=n

# Rootfs customisation
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_LITEX_VEXRISCV_PATH)/board/litex_vexriscv/rootfs_overlay"
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_LITEX_VEXRISCV_PATH)/patches"

#BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_18=y
# Required tools to create the SD image
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y

# Extra packages
#BR2_PACKAGE_DHRYSTONE_OPT=y
Expand Down
20 changes: 18 additions & 2 deletions buildroot/configs/litex_vexriscv_usbhost_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ BR2_TARGET_GENERIC_GETTY_PORT="console"
# Filesystem
BR2_TARGET_ROOTFS_CPIO=y

# Image
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_LITEX_VEXRISCV_PATH)/board/litex_vexriscv/post-image.sh"

# Kernel header version
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y

# Kernel (litex-rebase branch)
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
Expand All @@ -33,11 +39,21 @@ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_LITEX_VEXRISCV_PATH)/board/litex_vexriscv_usbhost/linux.config"
BR2_LINUX_KERNEL_IMAGE=y

# Bootloader (opensbi)
BR2_TARGET_OPENSBI=y
BR2_TARGET_OPENSBI_CUSTOM_GIT=y
BR2_TARGET_OPENSBI_CUSTOM_REPO_URL="https://github.com/litex-hub/opensbi.git"
BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION="1.3.1-linux-on-litex-vexriscv"
BR2_TARGET_OPENSBI_PLAT="litex/vexriscv"
BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG=n

# Rootfs customisation
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_LITEX_VEXRISCV_PATH)/board/litex_vexriscv_usbhost/rootfs_overlay"
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_LITEX_VEXRISCV_PATH)/patches"

#BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_18=y
# Required tools to create the SD image
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y

# Extra packages
#BR2_PACKAGE_DHRYSTONE_OPT=y
Expand Down

0 comments on commit e693c96

Please sign in to comment.