##// 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 336 ##### `CRYPTFS_XTSKEYSIZE`=512
337 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 348 ## Understanding the script
340 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 66 UBOOT_URL=${UBOOT_URL:=git://git.denx.de/u-boot.git}
67 67
68 68 # Build directories
69 BASEDIR="$(pwd)/images/${RELEASE}"
69 BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}}
70 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 75 # Chroot directories
73 76 R="${BUILDDIR}/chroot"
@@ -524,42 +527,39 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 25) \* 1024
524 527 # Calculate required image size in 512 Byte sectors
525 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 530 # Prepare image file
531 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}
533 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-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}
535 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
532 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=${TABLE_SECTORS}
533 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS}
534 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=${TABLE_SECTORS}
535 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
536 536
537 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 539 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
540 540 EOM
541 541
542 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 544 ${TABLE_SECTORS},${ROOT_SECTORS},83
545 545 EOM
546 546
547 547 # Setup temporary loop devices
548 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-frmw.img)"
549 ROOT_LOOP="$(losetup -o 1M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img)"
548 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $IMAGE_NAME-frmw.img)"
549 ROOT_LOOP="$(losetup -o 1M -f --show $IMAGE_NAME-root.img)"
550 550 else # ENABLE_SPLITFS=false
551 dd if=/dev/zero of="$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.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}
551 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=${TABLE_SECTORS}
552 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek=${IMAGE_SECTORS}
553 553
554 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 556 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
557 557 ${ROOT_OFFSET},${ROOT_SECTORS},83
558 558 EOM
559 559
560 560 # Setup temporary loop devices
561 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}.img)"
562 ROOT_LOOP="$(losetup -o 65M -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 $IMAGE_NAME.img)"
563 563 fi
564 564
565 565 if [ "$ENABLE_CRYPTFS" = true ] ; then
@@ -606,16 +606,16 cleanup
606 606 # Create block map file(s) of image(s)
607 607 if [ "$ENABLE_SPLITFS" = true ] ; then
608 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"
610 bmaptool create -o "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.bmap" "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img"
609 bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img"
610 bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img"
611 611
612 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"
614 echo "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_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 "$IMAGE_NAME-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
615 615 else
616 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 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 621 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant