@@ -337,7 +337,10 Sets key size in bits. The argument has to be a multiple of 8. | |||
|
337 | 337 | |
|
338 | 338 | #### Build settings: |
|
339 | 339 | ##### `BASEDIR`=$(pwd)/images/${RELEASE} |
|
340 |
|
|
|
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 | 345 | ## Understanding the script |
|
343 | 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 | 68 | # Build directories |
|
69 | 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" |
@@ -517,42 +520,39 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 25) \* 1024 | |||
|
517 | 520 | # Calculate required image size in 512 Byte sectors |
|
518 | 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 | 523 | # Prepare image file |
|
524 | 524 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
525 |
dd if=/dev/zero of="$ |
|
|
526 |
dd if=/dev/zero of="$ |
|
|
527 |
dd if=/dev/zero of="$ |
|
|
528 |
dd if=/dev/zero of="$ |
|
|
525 | dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=${TABLE_SECTORS} | |
|
526 | dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS} | |
|
527 | dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=${TABLE_SECTORS} | |
|
528 | dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek=${ROOT_SECTORS} | |
|
529 | 529 | |
|
530 | 530 | # Write firmware/boot partition tables |
|
531 |
sfdisk -q -L -uS -f "$ |
|
|
531 | sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM | |
|
532 | 532 | ${TABLE_SECTORS},${FRMW_SECTORS},c,* |
|
533 | 533 | EOM |
|
534 | 534 | |
|
535 | 535 | # Write root partition table |
|
536 |
sfdisk -q -L -uS -f "$ |
|
|
536 | sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM | |
|
537 | 537 | ${TABLE_SECTORS},${ROOT_SECTORS},83 |
|
538 | 538 | EOM |
|
539 | 539 | |
|
540 | 540 | # Setup temporary loop devices |
|
541 |
FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $ |
|
|
542 |
ROOT_LOOP="$(losetup -o 1M -f --show $ |
|
|
541 | FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $IMAGE_NAME-frmw.img)" | |
|
542 | ROOT_LOOP="$(losetup -o 1M -f --show $IMAGE_NAME-root.img)" | |
|
543 | 543 | else # ENABLE_SPLITFS=false |
|
544 |
dd if=/dev/zero of="$ |
|
|
545 |
dd if=/dev/zero of="$ |
|
|
544 | dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=${TABLE_SECTORS} | |
|
545 | dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek=${IMAGE_SECTORS} | |
|
546 | 546 | |
|
547 | 547 | # Write partition table |
|
548 |
sfdisk -q -L -uS -f "$ |
|
|
548 | sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM | |
|
549 | 549 | ${TABLE_SECTORS},${FRMW_SECTORS},c,* |
|
550 | 550 | ${ROOT_OFFSET},${ROOT_SECTORS},83 |
|
551 | 551 | EOM |
|
552 | 552 | |
|
553 | 553 | # Setup temporary loop devices |
|
554 |
FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $ |
|
|
555 |
ROOT_LOOP="$(losetup -o 65M -f --show $ |
|
|
554 | FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $IMAGE_NAME.img)" | |
|
555 | ROOT_LOOP="$(losetup -o 65M -f --show $IMAGE_NAME.img)" | |
|
556 | 556 | fi |
|
557 | 557 | |
|
558 | 558 | if [ "$ENABLE_CRYPTFS" = true ] ; then |
@@ -599,16 +599,16 cleanup | |||
|
599 | 599 | # Create block map file(s) of image(s) |
|
600 | 600 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
601 | 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" | |
|
603 | bmaptool create -o "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.bmap" "$BASEDIR/${DATE}-rpi${RPI_MODEL}-${RELEASE}-root.img" | |
|
602 | bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img" | |
|
603 | bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img" | |
|
604 | 604 | |
|
605 | 605 | # Image was successfully created |
|
606 |
echo "$ |
|
|
607 |
echo "$ |
|
|
606 | echo "$IMAGE_NAME-frmw.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_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 | 608 | else |
|
609 | 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 | 612 | # Image was successfully created |
|
613 |
echo "$ |
|
|
613 | echo "$IMAGE_NAME.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created" | |
|
614 | 614 | fi |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant