mvebu: make sdcard bootloader option configurable

Remove the necessity for boot loader from SD card image creation process
and make it configurable.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
This commit is contained in:
Tomasz Maciej Nowak 2018-02-14 17:28:09 +01:00 committed by Hauke Mehrtens
parent e10ea566cc
commit e4fa22397f
2 changed files with 21 additions and 10 deletions

View File

@ -44,10 +44,11 @@ define Build/boot-img
endef endef
define Build/sdcard-img define Build/sdcard-img
if [ -n "$(UBOOT)" ]; then UBOOT="$(STAGING_DIR_IMAGE)/$(UBOOT)"; fi; \
ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \ ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
SIGNATURE="$(SIGNATURE)" \ SIGNATURE="$(SIGNATURE)" \
./gen_mvebu_sdcard_img.sh $@ \ ./gen_mvebu_sdcard_img.sh $@ \
"$(STAGING_DIR_IMAGE)/clearfog-u-boot-spl.kwb" \ $$UBOOT \
c 32768 $@.boot \ c 32768 $@.boot \
83 $$ROOTFS_SIZE $(IMAGE_ROOTFS) 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
endef endef
@ -206,6 +207,7 @@ define Device/armada-388-clearfog-pro
IMAGE/sdcard.img.gz := boot-scr-cfpro | boot-img | sdcard-img | gzip | append-metadata IMAGE/sdcard.img.gz := boot-scr-cfpro | boot-img | sdcard-img | gzip | append-metadata
DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base
SUPPORTED_DEVICES := armada-388-clearfog-pro armada-388-clearfog SUPPORTED_DEVICES := armada-388-clearfog-pro armada-388-clearfog
UBOOT := clearfog-u-boot-spl.kwb
endef endef
TARGET_DEVICES += armada-388-clearfog-pro TARGET_DEVICES += armada-388-clearfog-pro
@ -217,6 +219,7 @@ define Device/armada-388-clearfog-base
IMAGES := sdcard.img.gz IMAGES := sdcard.img.gz
IMAGE/sdcard.img.gz := boot-scr-cfbase | boot-img | sdcard-img | gzip | append-metadata IMAGE/sdcard.img.gz := boot-scr-cfbase | boot-img | sdcard-img | gzip | append-metadata
DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base
UBOOT := clearfog-u-boot-spl.kwb
endef endef
TARGET_DEVICES += armada-388-clearfog-base TARGET_DEVICES += armada-388-clearfog-base

View File

@ -18,21 +18,27 @@
# #
usage() { usage() {
echo "$0 <outfile> <bootloader> [<type_partitionN> <sectors_partitionN> <img_partitionN>]?" echo "$0 <outfile> [<bootloader> <type_partitionN> <sectors_partitionN> <img_partitionN>]?"
} }
# always require first 3 arguments # always require first 2 or 3 arguments
# then in pairs up to 8 more for a total of up to 4 partitions # then in pairs up to 8 more for a total of up to 4 partitions
if [ $# -lt 2 ] || [ $# -gt 15 ] || [ $((($# - 2) % 3)) -ne 0 ]; then if [ $# -lt 1 ] || [ $# -gt 14 ] || [ $((($# - 1) % 3)) -ne 0 ]; then
usage if [ $# -lt 2 ] || [ $# -gt 15 ] || [ $((($# - 2) % 3)) -ne 0 ]; then
exit 1 usage
exit 1
else
BOOTLOADER="$2"
fi
fi fi
set -e set -e
# parameters # parameters
OUTFILE="$1"; shift OUTFILE="$1"; shift
BOOTLOADER="$1"; shift if [ -n "$BOOTLOADER" ]; then
shift
fi
# generate image file # generate image file
printf "Creating $OUTFILE from /dev/zero: " printf "Creating $OUTFILE from /dev/zero: "
@ -54,9 +60,11 @@ set `ptgen -o "$OUTFILE" -h $head -s $sect -l 1024 -S 0x$SIGNATURE $ptgen_args`
printf "Done\n" printf "Done\n"
# install bootloader # install bootloader
printf "Writing bootloader: " if [ -n "$BOOTLOADER" ]; then
dd of="$OUTFILE" if="$BOOTLOADER" bs=512 seek=1 conv=notrunc 2>/dev/null printf "Writing bootloader: "
printf "Done\n" dd of="$OUTFILE" if="$BOOTLOADER" bs=512 seek=1 conv=notrunc 2>/dev/null
printf "Done\n"
fi
i=1 i=1
while [ "$#" -ge 2 ]; do while [ "$#" -ge 2 ]; do