From f43c2def652f91f584ec6acfc3ee99d54d5f19ab Mon Sep 17 00:00:00 2001 From: Dalon Westergreen Date: Fri, 20 Jan 2017 08:24:08 -0800 Subject: Only conditionally set SOCFPGA_SDIMG_PARTITION_COMMAND Since the machine conf allows you to change uboot versions you need to be able to change the sdcard creation setup --- conf/machine/arria5.conf | 2 +- conf/machine/cyclone5.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/machine/arria5.conf b/conf/machine/arria5.conf index a04f2d5..6eedabf 100644 --- a/conf/machine/arria5.conf +++ b/conf/machine/arria5.conf @@ -19,4 +19,4 @@ KERNEL_DEVICETREE_arria5 ?= " \ # Add support for SDCARD creation IMAGE_CLASSES += "sdcard_image-socfpga" -SOCFPGA_SDIMG_PARTITION_COMMAND = "generate_sdcard_partitions_v2016_11_and_newer" +SOCFPGA_SDIMG_PARTITION_COMMAND ?= "generate_sdcard_partitions_v2016_11_and_newer" diff --git a/conf/machine/cyclone5.conf b/conf/machine/cyclone5.conf index 1c4586e..a2d743b 100644 --- a/conf/machine/cyclone5.conf +++ b/conf/machine/cyclone5.conf @@ -27,5 +27,5 @@ KERNEL_DEVICETREE ?= "\ # Add support for SDCARD creation IMAGE_CLASSES += "sdcard_image-socfpga" -SOCFPGA_SDIMG_PARTITION_COMMAND = "generate_sdcard_partitions_v2016_11_and_newer" +SOCFPGA_SDIMG_PARTITION_COMMAND ?= "generate_sdcard_partitions_v2016_11_and_newer" -- cgit v1.2.3-54-g00ecf From fb8728b073ffca2acc0bdaf7f76c3a7c7b8073dc Mon Sep 17 00:00:00 2001 From: Dalon Westergreen Date: Fri, 20 Jan 2017 15:39:43 -0800 Subject: add support to generate uboot environment images create uboot environment images to populate the sdcard images. This allows non-default uboot environments to be used without the need for changing / patching uboot --- classes/sdcard_image-socfpga.bbclass | 9 +++++++- recipes-bsp/u-boot/files/v2016.11/de0-nano-soc.env | 11 ++++++++++ recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb | 23 ++++++++++++++++++++ recipes-bsp/u-boot/u-boot-socfpga-env.inc | 25 ++++++++++++++++++++++ recipes-bsp/u-boot/u-boot-socfpga_v2016.05.bb | 2 +- recipes-bsp/u-boot/u-boot-socfpga_v2016.11.bb | 6 ++++++ 6 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 recipes-bsp/u-boot/files/v2016.11/de0-nano-soc.env create mode 100644 recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb create mode 100644 recipes-bsp/u-boot/u-boot-socfpga-env.inc diff --git a/classes/sdcard_image-socfpga.bbclass b/classes/sdcard_image-socfpga.bbclass index 879c2c1..8ac12b1 100644 --- a/classes/sdcard_image-socfpga.bbclass +++ b/classes/sdcard_image-socfpga.bbclass @@ -24,6 +24,9 @@ BOOT_SPACE ?= "2048" # Fat partition size FAT_SPACE ?= "102400" +# uBoot ENV offset +SDIMG_UBOOT_ENV_OFFSET ?= "512" + # Boot partition begin at sector 1024 # This is required as for c5/a5 mainline uboot hard codes the location # of the uboot image in the sdcard to 0xa00 sector @@ -167,6 +170,10 @@ IMAGE_CMD_socfpga-sdimg () { dd if=${DEPLOY_DIR_IMAGE}/${SPL_BINARY} of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync else bbfatal "${SPL_BINARY} does not exist." - fi + fi + + if [ -e "${DEPLOY_DIR_IMAGE}/u-boot-env-${ENV_BASE_NAME}.bin" ]; then + dd if=${DEPLOY_DIR_IMAGE}/u-boot-env-${ENV_BASE_NAME}.bin of=${SDIMG} bs=1 seek=${SDIMG_UBOOT_ENV_OFFSET} + fi } diff --git a/recipes-bsp/u-boot/files/v2016.11/de0-nano-soc.env b/recipes-bsp/u-boot/files/v2016.11/de0-nano-soc.env new file mode 100644 index 0000000..0e81fa3 --- /dev/null +++ b/recipes-bsp/u-boot/files/v2016.11/de0-nano-soc.env @@ -0,0 +1,11 @@ +baudrate=115200 +bootargs=console=ttyS0,115200 +bootcmd=run mmcload; run mmcboot +fdtimage=socfpga_cyclone5_de0_sockit.dtb +bootimage=zImage +fdt_addr=100 +loadaddr=0x01000000 +mmcboot=setenv bootargs console=ttyS0,115200 root=${mmcroot} rw rootwait;bootz ${loadaddr} - ${fdt_addr} +mmcload=mmc rescan;load mmc 0:2 ${loadaddr} ${bootimage};load mmc 0:2 ${fdt_addr} ${fdtimage} +mmcroot=/dev/mmcblk0p3 +ramboot=setenv bootargs console=ttyS0,115200;bootm ${loadaddr} - ${fdt_addr} diff --git a/recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb b/recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb new file mode 100644 index 0000000..cab156a --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb @@ -0,0 +1,23 @@ +SUMMARY = "U-Boot bootloader environment image creation tool" + +require u-boot-socfpga-common.inc + +# This revision corresponds to the tag "v2016.11" +# We use the revision in order to avoid having to fetch it from the +# repo during parse +SRCREV = "29e0cfb4f77f7aa369136302cee14a91e22dca71" + +EXTRA_OEMAKE = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" STRIP=true V=1' + +do_compile () { + oe_runmake sandbox_defconfig + oe_runmake cross_tools NO_SDL=1 +} + +do_install () { + install -d ${D}${bindir} + install -m 0755 tools/mkenvimage ${D}${bindir}/uboot-mkenvimage + ln -sf uboot-mkenvimage ${D}${bindir}/mkenvimage +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-bsp/u-boot/u-boot-socfpga-env.inc b/recipes-bsp/u-boot/u-boot-socfpga-env.inc new file mode 100644 index 0000000..55621b9 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-socfpga-env.inc @@ -0,0 +1,25 @@ +DEPENDS += "u-boot-mkenvimage-native" + +#Env binary size +ENV_SIZE = "4096" + +#Env base Name +ENV_BASE_NAME ??= "${UBOOT_CONFIG}" + +# Env base file correspond to common part of all environment +ENV_BASE_FILE = "${WORKDIR}/${ENV_BASE_NAME}.env" + +do_environment_mkimage() { + if [ -e ${WORKDIR}/${PV}/${ENV_BASE_NAME}.env ]; then + mkenvimage -s ${ENV_SIZE} -o ${WORKDIR}/${ENV_BASE_NAME}.bin ${WORKDIR}/${PV}/${ENV_BASE_NAME}.env + fi +} + +do_deploy_append() { + if [ -e ${WORKDIR}/${ENV_BASE_NAME}.bin]; then + install -d ${DEPLOYDIR} + install -m 644 ${WORKDIR}/${ENV_BASE_NAME}.bin ${DEPLOYDIR}/u-boot-env-${ENV_BASE_NAME}.bin + fi +} + +addtask environment_mkimage after do_compile before do_deploy diff --git a/recipes-bsp/u-boot/u-boot-socfpga_v2016.05.bb b/recipes-bsp/u-boot/u-boot-socfpga_v2016.05.bb index 40281cb..526e22c 100644 --- a/recipes-bsp/u-boot/u-boot-socfpga_v2016.05.bb +++ b/recipes-bsp/u-boot/u-boot-socfpga_v2016.05.bb @@ -5,5 +5,5 @@ require ${COREBASE}/meta/recipes-bsp/u-boot/u-boot.inc # We use the revision in order to avoid having to fetch it from the # repo during parse SRCREV = "aeaec0e682f45b9e0c62c522fafea353931f73ed" - +PR = "r1" DEPENDS += "dtc-native" diff --git a/recipes-bsp/u-boot/u-boot-socfpga_v2016.11.bb b/recipes-bsp/u-boot/u-boot-socfpga_v2016.11.bb index 0204422..356f88a 100644 --- a/recipes-bsp/u-boot/u-boot-socfpga_v2016.11.bb +++ b/recipes-bsp/u-boot/u-boot-socfpga_v2016.11.bb @@ -1,4 +1,5 @@ require u-boot-socfpga-common.inc +require u-boot-socfpga-env.inc require ${COREBASE}/meta/recipes-bsp/u-boot/u-boot.inc # This revision corresponds to the tag "v2016.11" @@ -6,4 +7,9 @@ require ${COREBASE}/meta/recipes-bsp/u-boot/u-boot.inc # repo during parse SRCREV = "29e0cfb4f77f7aa369136302cee14a91e22dca71" +SRC_URI_append = "\ + file://v2016.11/de0-nano-soc.env \ + " +PR = "r1" + DEPENDS += "dtc-native" -- cgit v1.2.3-54-g00ecf