@@ -87,6 +87,12 if [ "$BUILD_KERNEL" = true ] ; then | |||||
87 | # Load default raspberry kernel configuration |
|
87 | # Load default raspberry kernel configuration | |
88 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}" |
|
88 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}" | |
89 |
|
89 | |||
|
90 | # Set kernel configuration parameters to enable qemu emulation | |||
|
91 | if [ "$ENABLE_QEMU" = true ] ; then | |||
|
92 | echo "CONFIG_FHANDLE=y" >> ${KERNEL_DIR}/.config | |||
|
93 | echo "CONFIG_LBDAF=y" >> ${KERNEL_DIR}/.config | |||
|
94 | fi | |||
|
95 | ||||
90 | # Copy custom kernel configuration file |
|
96 | # Copy custom kernel configuration file | |
91 | if [ ! -z "$KERNELSRC_USRCONFIG" ] ; then |
|
97 | if [ ! -z "$KERNELSRC_USRCONFIG" ] ; then | |
92 | cp $KERNELSRC_USRCONFIG ${KERNEL_DIR}/.config |
|
98 | cp $KERNELSRC_USRCONFIG ${KERNEL_DIR}/.config |
@@ -169,6 +169,7 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true} | |||||
169 | ENABLE_USER=${ENABLE_USER:=true} |
|
169 | ENABLE_USER=${ENABLE_USER:=true} | |
170 | USER_NAME=${USER_NAME:="pi"} |
|
170 | USER_NAME=${USER_NAME:="pi"} | |
171 | ENABLE_ROOT=${ENABLE_ROOT:=false} |
|
171 | ENABLE_ROOT=${ENABLE_ROOT:=false} | |
|
172 | ENABLE_QEMU=${ENABLE_QEMU:=false} | |||
172 |
|
173 | |||
173 | # SSH settings |
|
174 | # SSH settings | |
174 | SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false} |
|
175 | SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false} | |
@@ -313,7 +314,7 fi | |||||
313 | # Add cryptsetup package to enable filesystem encryption |
|
314 | # Add cryptsetup package to enable filesystem encryption | |
314 | if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then |
|
315 | if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then | |
315 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup" |
|
316 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup" | |
316 | APT_INCLUDES="${APT_INCLUDES},cryptsetup,console-setup" |
|
317 | APT_INCLUDES="${APT_INCLUDES},cryptsetup,busybox,console-setup" | |
317 |
|
318 | |||
318 | if [ -z "$CRYPTFS_PASSWORD" ] ; then |
|
319 | if [ -z "$CRYPTFS_PASSWORD" ] ; then | |
319 | echo "error: no password defined (CRYPTFS_PASSWORD)!" |
|
320 | echo "error: no password defined (CRYPTFS_PASSWORD)!" | |
@@ -516,6 +517,12 if [ "$KERNEL_REDUCE" = true ] ; then | |||||
516 | KERNELSRC_CONFIG=false |
|
517 | KERNELSRC_CONFIG=false | |
517 | fi |
|
518 | fi | |
518 |
|
519 | |||
|
520 | # Configure qemu compatible kernel | |||
|
521 | if [ "$ENABLE_QEMU" = true ] ; then | |||
|
522 | KERNEL_DEFCONFIG="vexpress_defconfig" | |||
|
523 | KERNEL_OLDDEFCONFIG=true | |||
|
524 | fi | |||
|
525 | ||||
519 | # Execute bootstrap scripts |
|
526 | # Execute bootstrap scripts | |
520 | for SCRIPT in bootstrap.d/*.sh; do |
|
527 | for SCRIPT in bootstrap.d/*.sh; do | |
521 | head -n 3 "$SCRIPT" |
|
528 | head -n 3 "$SCRIPT" | |
@@ -582,6 +589,36 rm -f "${R}/initrd.img" | |||||
582 | rm -f "${R}/vmlinuz" |
|
589 | rm -f "${R}/vmlinuz" | |
583 | rm -f "${R}${QEMU_BINARY}" |
|
590 | rm -f "${R}${QEMU_BINARY}" | |
584 |
|
591 | |||
|
592 | if [ "$ENABLE_QEMU" = true ] ; then | |||
|
593 | # Setup QEMU directory | |||
|
594 | mkdir "${BASEDIR}/qemu" | |||
|
595 | ||||
|
596 | # Copy kernel image to QEMU directory | |||
|
597 | install_readonly "${BOOT_DIR}/${KERNEL_IMAGE}" "${BASEDIR}/qemu/${KERNEL_IMAGE}" | |||
|
598 | ||||
|
599 | # Copy kernel config to QEMU directory | |||
|
600 | install_readonly "${R}/boot/config-${KERNEL_VERSION}" "${BASEDIR}/qemu/config-${KERNEL_VERSION}" | |||
|
601 | ||||
|
602 | # Copy kernel dtbs to QEMU directory | |||
|
603 | for dtb in "${BOOT_DIR}/"*.dtb ; do | |||
|
604 | if [ -f "${dtb}" ] ; then | |||
|
605 | install_readonly "${dtb}" "${BASEDIR}/qemu/" | |||
|
606 | fi | |||
|
607 | done | |||
|
608 | ||||
|
609 | # Copy kernel overlays to QEMU directory | |||
|
610 | if [ -d "${BOOT_DIR}/overlays" ] ; then | |||
|
611 | # Setup overlays dtbs directory | |||
|
612 | mkdir "${BASEDIR}/qemu/overlays" | |||
|
613 | ||||
|
614 | for dtb in "${BOOT_DIR}/overlays/"*.dtb ; do | |||
|
615 | if [ -f "${dtb}" ] ; then | |||
|
616 | install_readonly "${dtb}" "${BASEDIR}/qemu/overlays/" | |||
|
617 | fi | |||
|
618 | done | |||
|
619 | fi | |||
|
620 | fi | |||
|
621 | ||||
585 | # Calculate size of the chroot directory in KB |
|
622 | # Calculate size of the chroot directory in KB | |
586 | CHROOT_SIZE=$(expr `du -s "${R}" | awk '{ print $1 }'`) |
|
623 | CHROOT_SIZE=$(expr `du -s "${R}" | awk '{ print $1 }'`) | |
587 |
|
624 | |||
@@ -690,4 +727,15 else | |||||
690 |
|
727 | |||
691 | # Image was successfully created |
|
728 | # Image was successfully created | |
692 | echo "$IMAGE_NAME.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created" |
|
729 | echo "$IMAGE_NAME.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created" | |
|
730 | ||||
|
731 | # Create qemu qcow2 image | |||
|
732 | if [ "$ENABLE_QEMU" = true ] ; then | |||
|
733 | QEMU_IMAGE=${QEMU_IMAGE:=${BASEDIR}/qemu/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} | |||
|
734 | QEMU_SIZE=16G | |||
|
735 | ||||
|
736 | qemu-img convert -f raw -O qcow2 $IMAGE_NAME.img $QEMU_IMAGE.qcow2 | |||
|
737 | qemu-img resize $QEMU_IMAGE.qcow2 $QEMU_SIZE | |||
|
738 | ||||
|
739 | echo "$QEMU_IMAGE.qcow2 ($QEMU_SIZE)" ": successfully created" | |||
|
740 | fi | |||
693 | fi |
|
741 | fi |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant