##// END OF EJS Templates
Merge pull request #72 from denismosolov/image-name...
drtyhlpr -
r140:efc5a8fb5f7a Fusion
parent child
Show More
@@ -336,6 +336,15 Set cipher specification string. `aes-xts*` ciphers are strongly recommended.
336 ##### `CRYPTFS_XTSKEYSIZE`=512
336 ##### `CRYPTFS_XTSKEYSIZE`=512
337 Sets key size in bits. The argument has to be a multiple of 8.
337 Sets key size in bits. The argument has to be a multiple of 8.
338
338
339 ---
340
341 #### Build settings:
342 ##### `BASEDIR`=$(pwd)/images/${RELEASE}
343 Set a path to a working directory used by the script to generate an image.
344
345 ##### `IMAGE_NAME`=${BASEDIR}/${DATE}-rpi${RPI_MODEL}-${RELEASE}
346 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.
347
339 ## Understanding the script
348 ## Understanding the script
340 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:
349 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:
341
350
@@ -66,8 +66,11 FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git}
66 UBOOT_URL=${UBOOT_URL:=git://git.denx.de/u-boot.git}
66 UBOOT_URL=${UBOOT_URL:=git://git.denx.de/u-boot.git}
67
67
68 # Build directories
68 # Build directories
69 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"
@@ -524,42 +527,39 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 25) \* 1024
524 # Calculate required image size in 512 Byte sectors
527 # Calculate required image size in 512 Byte sectors
525 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS})
528 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS})
526
529
527 # Prepare date string for image file name
528 DATE="$(date +%Y-%m-%d)"
529
530 # Prepare image file
530 # Prepare image file
531 if [ "$ENABLE_SPLITFS" = true ] ; then
531 if [ "$ENABLE_SPLITFS" = true ] ; then
532 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img" bs=512 count=${TABLE_SECTORS}
532 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=${TABLE_SECTORS}
533 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS}
533 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS}
534 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img" bs=512 count=${TABLE_SECTORS}
534 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=${TABLE_SECTORS}
535 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
535 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
536
536
537 # Write firmware/boot partition tables
537 # Write firmware/boot partition tables
538 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img" 2> /dev/null <<EOM
538 sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
539 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
539 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
540 EOM
540 EOM
541
541
542 # Write root partition table
542 # Write root partition table
543 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img" 2> /dev/null <<EOM
543 sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
544 ${TABLE_SECTORS},${ROOT_SECTORS},83
544 ${TABLE_SECTORS},${ROOT_SECTORS},83
545 EOM
545 EOM
546
546
547 # Setup temporary loop devices
547 # Setup temporary loop devices
548 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img)"
548 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $IMAGE_NAME-frmw.img)"
549 ROOT_LOOP="$(losetup -o 1M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img)"
549 ROOT_LOOP="$(losetup -o 1M -f --show $IMAGE_NAME-root.img)"
550 else # ENABLE_SPLITFS=false
550 else # ENABLE_SPLITFS=false
551 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img" bs=512 count=${TABLE_SECTORS}
551 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=${TABLE_SECTORS}
552 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img" bs=512 count=0 seek=${IMAGE_SECTORS}
552 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek=${IMAGE_SECTORS}
553
553
554 # Write partition table
554 # Write partition table
555 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img" 2> /dev/null <<EOM
555 sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM
556 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
556 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
557 ${ROOT_OFFSET},${ROOT_SECTORS},83
557 ${ROOT_OFFSET},${ROOT_SECTORS},83
558 EOM
558 EOM
559
559
560 # Setup temporary loop devices
560 # Setup temporary loop devices
561 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img)"
561 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $IMAGE_NAME.img)"
562 ROOT_LOOP="$(losetup -o 65M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img)"
562 ROOT_LOOP="$(losetup -o 65M -f --show $IMAGE_NAME.img)"
563 fi
563 fi
564
564
565 if [ "$ENABLE_CRYPTFS" = true ] ; then
565 if [ "$ENABLE_CRYPTFS" = true ] ; then
@@ -606,16 +606,16 cleanup
606 # Create block map file(s) of image(s)
606 # Create block map file(s) of image(s)
607 if [ "$ENABLE_SPLITFS" = true ] ; then
607 if [ "$ENABLE_SPLITFS" = true ] ; then
608 # Create block map files for "bmaptool"
608 # Create block map files for "bmaptool"
609 bmaptool create -o "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.bmap" "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img"
609 bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img"
610 bmaptool create -o "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.bmap" "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img"
610 bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img"
611
611
612 # Image was successfully created
612 # Image was successfully created
613 echo "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
613 echo "$IMAGE_NAME-frmw.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
614 echo "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
614 echo "$IMAGE_NAME-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
615 else
615 else
616 # Create block map file for "bmaptool"
616 # Create block map file for "bmaptool"
617 bmaptool create -o "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.bmap" "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img"
617 bmaptool create -o "$IMAGE_NAME.bmap" "$IMAGE_NAME.img"
618
618
619 # Image was successfully created
619 # Image was successfully created
620 echo "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
620 echo "$IMAGE_NAME.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
621 fi
621 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant