##// END OF EJS Templates
Add IMAGE_NAME
Denis Mosolov -
r138:9cc6bc7aa1ed
parent child
Show More
@@ -337,7 +337,10 Sets key size in bits. The argument has to be a multiple of 8.
337
337
338 #### Build settings:
338 #### Build settings:
339 ##### `BASEDIR`=$(pwd)/images/${RELEASE}
339 ##### `BASEDIR`=$(pwd)/images/${RELEASE}
340 Path to a directory where the script stores all temporary files during generating the image.
340 Set a path to a working directory used by the script to generate an image.
341
342 ##### `IMAGE_NAME`=${BASEDIR}/${DATE}-rpi${RPI_MODEL}-${RELEASE}
343 Set a filename for the output file(s). Note: the script will create $IMAGE_NAME.img if `ENABLE_SPLITFS`=false or $IMAGE_NAME-frmw.img and $IMAGE_NAME-root.img if `ENABLE_SPLITFS`=true.
341
344
342 ## Understanding the script
345 ## Understanding the script
343 The functions of this script that are required for the different stages of the bootstrapping are split up into single files located inside the `bootstrap.d` directory. During the bootstrapping every script in this directory gets executed in lexicographical order:
346 The functions of this script that are required for the different stages of the bootstrapping are split up into single files located inside the `bootstrap.d` directory. During the bootstrapping every script in this directory gets executed in lexicographical order:
@@ -68,6 +68,9 UBOOT_URL=${UBOOT_URL:=git://git.denx.de/u-boot.git}
68 # Build directories
68 # Build directories
69 BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}}
69 BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}}
70 BUILDDIR="${BASEDIR}/build"
70 BUILDDIR="${BASEDIR}/build"
71 # Prepare date string for default image file name
72 DATE="$(date +%Y-%m-%d)"
73 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-rpi${RPI_MODEL}-${RELEASE}}
71
74
72 # Chroot directories
75 # Chroot directories
73 R="${BUILDDIR}/chroot"
76 R="${BUILDDIR}/chroot"
@@ -517,42 +520,39 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 25) \* 1024
517 # Calculate required image size in 512 Byte sectors
520 # Calculate required image size in 512 Byte sectors
518 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS})
521 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS})
519
522
520 # Prepare date string for image file name
521 DATE="$(date +%Y-%m-%d)"
522
523 # Prepare image file
523 # Prepare image file
524 if [ "$ENABLE_SPLITFS" = true ] ; then
524 if [ "$ENABLE_SPLITFS" = true ] ; then
525 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img" bs=512 count=${TABLE_SECTORS}
525 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=${TABLE_SECTORS}
526 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS}
526 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS}
527 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img" bs=512 count=${TABLE_SECTORS}
527 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=${TABLE_SECTORS}
528 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
528 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
529
529
530 # Write firmware/boot partition tables
530 # Write firmware/boot partition tables
531 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img" 2> /dev/null <<EOM
531 sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
532 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
532 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
533 EOM
533 EOM
534
534
535 # Write root partition table
535 # Write root partition table
536 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img" 2> /dev/null <<EOM
536 sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
537 ${TABLE_SECTORS},${ROOT_SECTORS},83
537 ${TABLE_SECTORS},${ROOT_SECTORS},83
538 EOM
538 EOM
539
539
540 # Setup temporary loop devices
540 # Setup temporary loop devices
541 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img)"
541 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $IMAGE_NAME-frmw.img)"
542 ROOT_LOOP="$(losetup -o 1M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img)"
542 ROOT_LOOP="$(losetup -o 1M -f --show $IMAGE_NAME-root.img)"
543 else # ENABLE_SPLITFS=false
543 else # ENABLE_SPLITFS=false
544 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img" bs=512 count=${TABLE_SECTORS}
544 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=${TABLE_SECTORS}
545 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img" bs=512 count=0 seek=${IMAGE_SECTORS}
545 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek=${IMAGE_SECTORS}
546
546
547 # Write partition table
547 # Write partition table
548 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img" 2> /dev/null <<EOM
548 sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM
549 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
549 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
550 ${ROOT_OFFSET},${ROOT_SECTORS},83
550 ${ROOT_OFFSET},${ROOT_SECTORS},83
551 EOM
551 EOM
552
552
553 # Setup temporary loop devices
553 # Setup temporary loop devices
554 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img)"
554 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $IMAGE_NAME.img)"
555 ROOT_LOOP="$(losetup -o 65M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img)"
555 ROOT_LOOP="$(losetup -o 65M -f --show $IMAGE_NAME.img)"
556 fi
556 fi
557
557
558 if [ "$ENABLE_CRYPTFS" = true ] ; then
558 if [ "$ENABLE_CRYPTFS" = true ] ; then
@@ -599,16 +599,16 cleanup
599 # Create block map file(s) of image(s)
599 # Create block map file(s) of image(s)
600 if [ "$ENABLE_SPLITFS" = true ] ; then
600 if [ "$ENABLE_SPLITFS" = true ] ; then
601 # Create block map files for "bmaptool"
601 # Create block map files for "bmaptool"
602 bmaptool create -o "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.bmap" "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img"
602 bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img"
603 bmaptool create -o "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.bmap" "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img"
603 bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img"
604
604
605 # Image was successfully created
605 # Image was successfully created
606 echo "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
606 echo "$IMAGE_NAME-frmw.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
607 echo "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
607 echo "$IMAGE_NAME-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
608 else
608 else
609 # Create block map file for "bmaptool"
609 # Create block map file for "bmaptool"
610 bmaptool create -o "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.bmap" "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img"
610 bmaptool create -o "$IMAGE_NAME.bmap" "$IMAGE_NAME.img"
611
611
612 # Image was successfully created
612 # Image was successfully created
613 echo "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
613 echo "$IMAGE_NAME.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
614 fi
614 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant