diff --git a/Dockerfile b/Dockerfile index 22797d5..706a5fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ -FROM debian:stretch +FROM debian:buster ENV DEBIAN_FRONTEND noninteractive RUN apt-get -y update && \ apt-get -y install \ git vim parted \ - quilt realpath qemu-user-static debootstrap zerofree pxz zip dosfstools \ - bsdtar libcap2-bin rsync grep udev xz-utils curl xxd file \ + quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \ + bsdtar libcap2-bin rsync grep udev xz-utils curl xxd file kmod\ && rm -rf /var/lib/apt/lists/* COPY . /pi-gen/ diff --git a/README.md b/README.md index e74aad1..9fe12c9 100755 --- a/README.md +++ b/README.md @@ -7,12 +7,13 @@ _Tool used to create the raspberrypi.org Raspbian images_ pi-gen runs on Debian based operating systems. Currently it is only supported on either Debian Stretch or Ubuntu Xenial and is known to have issues building on -earlier releases of these systems. +earlier releases of these systems. On other Linux distributions it may be possible +to use the Docker build described below. To install the required dependencies for pi-gen you should run: ```bash -apt-get install quilt parted realpath qemu-user-static debootstrap zerofree pxz zip \ +apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \ dosfstools bsdtar libcap2-bin grep rsync xz-utils file git curl ``` @@ -68,6 +69,10 @@ The following environment variables are supported: Output directory for target system images and NOOBS bundles. + * `DEPLOY_ZIP` (Default: `1`) + + Setting to `0` will deploy the actual image (`.img`) instead of a zipped image (`.zip`). + * `USE_QEMU` (Default: `"0"`) Setting to '1' enables the QEMU mode - creating an image that can be mounted via QEMU for an emulated @@ -91,7 +96,7 @@ The following environment variables are supported: * `STAGE_LIST` (Default: `stage*`) - If set, then instead of working through the numeric stages in order, this list will be followed. For example setting to `stage0 stage1 mystage stage2` will run the contents of `mystage` before stage2. An absolute or relative path can be given for stages outside the pi-gen directory. + If set, then instead of working through the numeric stages in order, this list will be followed. For example setting to `"stage0 stage1 mystage stage2"` will run the contents of `mystage` before stage2. Note that quotes are needed around the list. An absolute or relative path can be given for stages outside the pi-gen directory. A simple example for building Raspbian: @@ -102,7 +107,7 @@ IMG_NAME='Raspbian' The config file can also be specified on the command line as an argument the `build.sh` or `build-docker.sh` scripts. ``` -./build -c myconfig +./build.sh -c myconfig ``` This is parsed after `config` so can be used to override values set there. @@ -154,6 +159,13 @@ It is recommended to examine build.sh for finer details. ## Docker Build +Docker can be used to perform the build inside a container. This partially isolates +the build from the host system, and allows using the script on non-debian based +systems (e.g. Fedora Linux). The isolate is not complete due to the need to use +some kernel level services for arm emulation (binfmt) and loop devices (losetup). + +To build: + ```bash vi config # Edit your config file. See above. ./build-docker.sh @@ -169,6 +181,12 @@ continue: CONTINUE=1 ./build-docker.sh ``` +To examine the container after a failure you can enter a shell within it using: + +```bash +sudo docker run -it --privileged --volumes-from=pigen_work pi-gen /bin/bash +``` + After successful build, the build container is by default removed. This may be undesired when making incremental changes to a customized build. To prevent the build script from remove the container add ```bash @@ -277,6 +295,9 @@ follows: # Troubleshooting +## `64 Bit Systems` +Please note there is currently an issue when compiling with a 64 Bit OS. See https://github.com/RPi-Distro/pi-gen/issues/271 + ## `binfmt_misc` Linux is able execute binaries from other architectures, meaning that it should be diff --git a/build-docker.sh b/build-docker.sh index e56f7d9..cb30c52 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -1,9 +1,10 @@ #!/bin/bash -e +BUILD_OPTS="$*" + DOCKER="docker" set +e -$DOCKER ps >/dev/null 2>&1 -if [ $? != 0 ]; then +if ! $DOCKER ps >/dev/null 2>&1; then DOCKER="sudo docker" fi if ! $DOCKER ps >/dev/null; then @@ -13,9 +14,8 @@ if ! $DOCKER ps >/dev/null; then fi set -e -config_file=() if [ -f config ]; then - config_file=("--env-file" "$(pwd)/config") + # shellcheck disable=SC1091 source config fi @@ -23,9 +23,10 @@ while getopts "c:" flag do case "$flag" in c) - EXTRA_CONFIG="$OPTARG" - config_file=( "${config_file[@]}" "--env-file" "$(pwd)/${EXTRA_CONFIG}") - source "$EXTRA_CONFIG" + # shellcheck disable=SC1090 + source "$OPTARG" + ;; + *) ;; esac done @@ -55,23 +56,20 @@ fi $DOCKER build -t pi-gen . if [ "$CONTAINER_EXISTS" != "" ]; then - trap "echo 'got CTRL+C... please wait 5s'; $DOCKER stop -t 5 ${CONTAINER_NAME}_cont" SIGINT SIGTERM + trap 'echo "got CTRL+C... please wait 5s"; $DOCKER stop -t 5 ${CONTAINER_NAME}_cont' SIGINT SIGTERM time $DOCKER run --rm --privileged \ --volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \ - -e IMG_NAME="${IMG_NAME}"\ pi-gen \ bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && - cd /pi-gen; ./build.sh; + cd /pi-gen; ./build.sh ${BUILD_OPTS} ; rsync -av work/*/build.log deploy/" & wait "$!" else - trap "echo 'got CTRL+C... please wait 5s'; $DOCKER stop -t 5 ${CONTAINER_NAME}" SIGINT SIGTERM + trap 'echo "got CTRL+C... please wait 5s"; $DOCKER stop -t 5 ${CONTAINER_NAME}' SIGINT SIGTERM time $DOCKER run --name "${CONTAINER_NAME}" --privileged \ - -e IMG_NAME="${IMG_NAME}"\ - "${config_file[@]}" \ pi-gen \ bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && - cd /pi-gen; ./build.sh && + cd /pi-gen; ./build.sh ${BUILD_OPTS} && rsync -av work/*/build.log deploy/" & wait "$!" fi @@ -81,7 +79,7 @@ ls -lah deploy # cleanup if [ "$PRESERVE_CONTAINER" != "1" ]; then - $DOCKER rm -v $CONTAINER_NAME + $DOCKER rm -v "$CONTAINER_NAME" fi echo "Done! Your image(s) should be in deploy/" diff --git a/build.sh b/build.sh index c8bca0d..5397330 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -e -# shellcheck disable=SC2119,SC1091 +# shellcheck disable=SC2119 run_sub_stage() { log "Begin ${SUB_STAGE_DIR}" @@ -46,11 +46,11 @@ EOF SUB_STAGE_QUILT_PATCH_DIR="$(basename "$SUB_STAGE_DIR")-pc" mkdir -p "$SUB_STAGE_QUILT_PATCH_DIR" ln -snf "$SUB_STAGE_QUILT_PATCH_DIR" .pc + quilt upgrade if [ -e "${SUB_STAGE_DIR}/${i}-patches/EDIT" ]; then echo "Dropping into bash to edit patches..." bash fi - quilt upgrade RC=0 quilt push -a || RC=$? case "$RC" in @@ -102,7 +102,7 @@ run_stage(){ ./prerun.sh log "End ${STAGE_DIR}/prerun.sh" fi - for SUB_STAGE_DIR in ${STAGE_DIR}/*; do + for SUB_STAGE_DIR in "${STAGE_DIR}"/*; do if [ -d "${SUB_STAGE_DIR}" ] && [ ! -f "${SUB_STAGE_DIR}/SKIP" ]; then run_sub_stage @@ -124,6 +124,7 @@ fi if [ -f config ]; then + # shellcheck disable=SC1091 source config fi @@ -132,11 +133,17 @@ do case "$flag" in c) EXTRA_CONFIG="$OPTARG" + # shellcheck disable=SC1090 source "$EXTRA_CONFIG" ;; + *) + ;; esac done +export PI_GEN=${PI_GEN:-pi-gen} +export PI_GEN_REPO=${PI_GEN_REPO:-https://github.com/RPi-Distro/pi-gen} + if [ -z "${IMG_NAME}" ]; then echo "IMG_NAME not set" 1>&2 exit 1 @@ -144,13 +151,14 @@ fi export USE_QEMU="${USE_QEMU:-0}" export IMG_DATE="${IMG_DATE:-"$(date +%Y-%m-%d)"}" -export IMG_FILENAME="${IMG_FILENAME:-"${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}"}" -export ZIP_FILENAME="${ZIP_FILENAME:-"image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}"}" +export IMG_FILENAME="${IMG_FILENAME:-"${IMG_DATE}-${IMG_NAME}"}" +export ZIP_FILENAME="${ZIP_FILENAME:-"image_${IMG_DATE}-${IMG_NAME}"}" BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" export SCRIPT_DIR="${BASE_DIR}/scripts" export WORK_DIR="${WORK_DIR:-"${BASE_DIR}/work/${IMG_DATE}-${IMG_NAME}"}" export DEPLOY_DIR=${DEPLOY_DIR:-"${BASE_DIR}/deploy"} +export DEPLOY_ZIP="${DEPLOY_ZIP:-1}" export LOG_FILE="${WORK_DIR}/build.log" export FIRST_USER_NAME=${FIRST_USER_NAME:-pi} @@ -189,6 +197,16 @@ source "${SCRIPT_DIR}/common" # shellcheck source=scripts/dependencies_check source "${SCRIPT_DIR}/dependencies_check" +#check username is valid +if [[ ! "$FIRST_USER_NAME" =~ ^[a-z][-a-z0-9_]*$ ]]; then + echo "Invalid FIRST_USER_NAME: $FIRST_USER_NAME" + exit 1 +fi + +if [[ -n "${APT_PROXY}" ]] && ! curl --silent "${APT_PROXY}" >/dev/null ; then + echo "Could not reach APT_PROXY server: ${APT_PROXY}" + exit 1 +fi dependencies_check "${BASE_DIR}/depends" @@ -197,8 +215,8 @@ log "Begin ${BASE_DIR}" STAGE_LIST=${STAGE_LIST:-${BASE_DIR}/stage*} -for STAGE_DIR_ in $STAGE_LIST; do - STAGE_DIR=`realpath "${STAGE_DIR_}"` +for STAGE_DIR in $STAGE_LIST; do + STAGE_DIR=$(realpath "${STAGE_DIR}") run_stage done diff --git a/depends b/depends index 80db669..6238eb1 100644 --- a/depends +++ b/depends @@ -1,10 +1,10 @@ quilt parted -realpath +realpath:coreutils qemu-arm-static:qemu-user-static debootstrap zerofree -pxz zip +zip mkdosfs:dosfstools capsh:libcap2-bin bsdtar @@ -15,3 +15,4 @@ curl xxd file git +lsmod:kmod diff --git a/export-image/00-allow-rerun/00-run.sh b/export-image/00-allow-rerun/00-run.sh index f7c5b4e..dd67f4c 100755 --- a/export-image/00-allow-rerun/00-run.sh +++ b/export-image/00-allow-rerun/00-run.sh @@ -3,3 +3,7 @@ if [ ! -x "${ROOTFS_DIR}/usr/bin/qemu-arm-static" ]; then cp /usr/bin/qemu-arm-static "${ROOTFS_DIR}/usr/bin/" fi + +if [ -e "${ROOTFS_DIR}/etc/ld.so.preload" ]; then + mv "${ROOTFS_DIR}/etc/ld.so.preload" "${ROOTFS_DIR}/etc/ld.so.preload.disabled" +fi diff --git a/export-image/01-set-sources/00-patches/0-sources.diff b/export-image/01-set-sources/00-patches/0-sources.diff deleted file mode 100644 index 17badff..0000000 --- a/export-image/01-set-sources/00-patches/0-sources.diff +++ /dev/null @@ -1,9 +0,0 @@ -Index: export-jessie/rootfs/etc/apt/sources.list.d/raspi.list -=================================================================== ---- export-jessie.orig/rootfs/etc/apt/sources.list.d/raspi.list -+++ export-jessie/rootfs/etc/apt/sources.list.d/raspi.list -@@ -1,3 +1,3 @@ --deb http://archive.raspberrypi.org/debian/ stretch main ui staging -+deb http://archive.raspberrypi.org/debian/ stretch main ui - # Uncomment line below then 'apt-get update' to enable 'apt-get source' - #deb-src http://archive.raspberrypi.org/debian/ stretch main ui diff --git a/export-image/01-set-sources/00-patches/series b/export-image/01-set-sources/00-patches/series deleted file mode 100644 index 49ccdbc..0000000 --- a/export-image/01-set-sources/00-patches/series +++ /dev/null @@ -1 +0,0 @@ -0-sources.diff diff --git a/export-image/03-set-partuuid/00-run.sh b/export-image/03-set-partuuid/00-run.sh index e166e97..1538c07 100755 --- a/export-image/03-set-partuuid/00-run.sh +++ b/export-image/03-set-partuuid/00-run.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}.img" +IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img" IMGID="$(dd if="${IMG_FILE}" skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f 2 -d' ')" diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh index f5a5fd8..9215dec 100755 --- a/export-image/04-finalise/01-run.sh +++ b/export-image/04-finalise/01-run.sh @@ -1,20 +1,28 @@ #!/bin/bash -e -IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}.img" -INFO_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}.info" +IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img" +INFO_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.info" on_chroot << EOF /etc/init.d/fake-hwclock stop hardlink -t /usr/share/doc EOF -if [ -d "${ROOTFS_DIR}/home/pi/.config" ]; then - chmod 700 "${ROOTFS_DIR}/home/pi/.config" +if [ -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" ]; then + chmod 700 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" fi rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" rm -f "${ROOTFS_DIR}/usr/bin/qemu-arm-static" +if [ "${USE_QEMU}" != "1" ]; then + if [ -e "${ROOTFS_DIR}/etc/ld.so.preload.disabled" ]; then + mv "${ROOTFS_DIR}/etc/ld.so.preload.disabled" "${ROOTFS_DIR}/etc/ld.so.preload" + fi +fi + +rm -f "${ROOTFS_DIR}/etc/network/interfaces.dpkg-old" + rm -f "${ROOTFS_DIR}/etc/apt/sources.list~" rm -f "${ROOTFS_DIR}/etc/apt/trusted.gpg~" @@ -43,24 +51,24 @@ rm -f "${ROOTFS_DIR}/etc/vnc/updateid" update_issue "$(basename "${EXPORT_DIR}")" install -m 644 "${ROOTFS_DIR}/etc/rpi-issue" "${ROOTFS_DIR}/boot/issue.txt" -install files/LICENSE.oracle "${ROOTFS_DIR}/boot/" - cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE" { - firmware=$(zgrep "firmware as of" \ - "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" | \ - head -n1 | sed -n 's|.* \([^ ]*\)$|\1|p') - printf "\nFirmware: https://github.com/raspberrypi/firmware/tree/%s\n" "$firmware" + if [ -f "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" ]; then + firmware=$(zgrep "firmware as of" \ + "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" | \ + head -n1 | sed -n 's|.* \([^ ]*\)$|\1|p') + printf "\nFirmware: https://github.com/raspberrypi/firmware/tree/%s\n" "$firmware" - kernel="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/git_hash")" - printf "Kernel: https://github.com/raspberrypi/linux/tree/%s\n" "$kernel" + kernel="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/git_hash")" + printf "Kernel: https://github.com/raspberrypi/linux/tree/%s\n" "$kernel" - uname="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7")" + uname="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7")" + printf "Uname string: %s\n" "$uname" + fi - printf "Uname string: %s\n" "$uname" printf "\nPackages:\n" dpkg -l --root "$ROOTFS_DIR" } >> "$INFO_FILE" @@ -68,17 +76,22 @@ cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE" ROOT_DEV="$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')" unmount "${ROOTFS_DIR}" -zerofree -v "${ROOT_DEV}" +zerofree "${ROOT_DEV}" unmount_image "${IMG_FILE}" mkdir -p "${DEPLOY_DIR}" -rm -f "${DEPLOY_DIR}/${ZIP_FILENAME}.zip" +rm -f "${DEPLOY_DIR}/${ZIP_FILENAME}${IMG_SUFFIX}.zip" +rm -f "${DEPLOY_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img" -pushd "${STAGE_WORK_DIR}" > /dev/null -zip "${DEPLOY_DIR}/${ZIP_FILENAME}.zip" \ - "$(basename "${IMG_FILE}")" -popd > /dev/null +if [ "${DEPLOY_ZIP}" == "1" ]; then + pushd "${STAGE_WORK_DIR}" > /dev/null + zip "${DEPLOY_DIR}/${ZIP_FILENAME}${IMG_SUFFIX}.zip" \ + "$(basename "${IMG_FILE}")" + popd > /dev/null +else + cp "$IMG_FILE" "$DEPLOY_DIR" +fi cp "$INFO_FILE" "$DEPLOY_DIR" diff --git a/export-image/04-finalise/files/LICENSE.oracle b/export-image/04-finalise/files/LICENSE.oracle deleted file mode 100644 index 00898ca..0000000 --- a/export-image/04-finalise/files/LICENSE.oracle +++ /dev/null @@ -1,72 +0,0 @@ -Taken from http://www.java.com/license - -Oracle Binary Code License Agreement for the Java SE Platform Products and JavaFX - -ORACLE AMERICA, INC. ("ORACLE"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS BINARY CODE LICENSE AGREEMENT AND SUPPLEMENTAL LICENSE TERMS (COLLECTIVELY "AGREEMENT"). PLEASE READ THE AGREEMENT CAREFULLY. BY SELECTING THE "ACCEPT LICENSE AGREEMENT" (OR THE EQUIVALENT) BUTTON AND/OR BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, THEN SELECT THE "DECLINE LICENSE AGREEMENT" (OR THE EQUIVALENT) BUTTON AND YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. - -1. DEFINITIONS. "Software" means the software identified above in binary form that you selected for download, install or use (in the version You selected for download, install or use) from Oracle or its authorized licensees, any other machine readable materials (including, but not limited to, libraries, source files, header files, and data files), any updates or error corrections provided by Oracle, and any user manuals, programming guides and other documentation provided to you by Oracle under this Agreement. "General Purpose Desktop Computers and Servers" means computers, including desktop and laptop computers, or servers, used for general computing functions under end user control (such as but not specifically limited to email, general purpose Internet browsing, and office suite productivity tools). The use of Software in systems and solutions that provide dedicated functionality (other than as mentioned above) or designed for use in embedded or function-specific software applications, for example but not limited to: Software embedded in or bundled with industrial control systems, wireless mobile telephones, wireless handheld devices, kiosks, TV/STB, Blu-ray Disc devices, telematics and network control switching equipment, printers and storage management systems, and other related systems are excluded from this definition and not licensed under this Agreement. "Programs" means (a) Java technology applets and applications intended to run on the Java Platform, Standard Edition platform on Java-enabled General Purpose Desktop Computers and Servers; and (b) JavaFX technology applications intended to run on the JavaFX Runtime on JavaFX-enabled General Purpose Desktop Computers and Servers. “Commercial Features” means those features identified in Table 1-1 (Commercial Features In Java SE Product Editions) of the Java SE documentation accessible at http://www.oracle.com/technetwork/java/javase/documentation/index.html. “README File” means the README file for the Software accessible at http://www.oracle.com/technetwork/java/javase/documentation/index.html. - -2. LICENSE TO USE. Subject to the terms and conditions of this Agreement including, but not limited to, the Java Technology Restrictions of the Supplemental License Terms, Oracle grants you a non-exclusive, non-transferable, limited license without license fees to reproduce and use internally the Software complete and unmodified for the sole purpose of running Programs. THE LICENSE SET FORTH IN THIS SECTION 2 DOES NOT EXTEND TO THE COMMERCIAL FEATURES. YOUR RIGHTS AND OBLIGATIONS RELATED TO THE COMMERCIAL FEATURES ARE AS SET FORTH IN THE SUPPLEMENTAL TERMS ALONG WITH ADDITIONAL LICENSES FOR DEVELOPERS AND PUBLISHERS. - -3. RESTRICTIONS. Software is copyrighted. Title to Software and all associated intellectual property rights is retained by Oracle and/or its licensors. Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. You acknowledge that the Software is developed for general use in a variety of information management applications; it is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use the Software in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle disclaims any express or implied warranty of fitness for such uses. No right, title or interest in or to any trademark, service mark, logo or trade name of Oracle or its licensors is granted under this Agreement. Additional restrictions for developers and/or publishers licenses are set forth in the Supplemental License Terms. - -4. DISCLAIMER OF WARRANTY. THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ORACLE FURTHER DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. - -5. LIMITATION OF LIABILITY. IN NO EVENT SHALL ORACLE BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR DATA USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT, EVEN IF ORACLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ORACLE'S ENTIRE LIABILITY FOR DAMAGES HEREUNDER SHALL IN NO EVENT EXCEED ONE THOUSAND DOLLARS (U.S. $1,000). - -6. TERMINATION. This Agreement is effective until terminated. You may terminate this Agreement at any time by destroying all copies of Software. This Agreement will terminate immediately without notice from Oracle if you fail to comply with any provision of this Agreement. Either party may terminate this Agreement immediately should any Software become, or in either party's opinion be likely to become, the subject of a claim of infringement of any intellectual property right. Upon termination, you must destroy all copies of Software. - -7. EXPORT REGULATIONS. You agree that U.S. export control laws and other applicable export and import laws govern your use of the Software, including technical data; additional information can be found on Oracle's Global Trade Compliance web site (http://www.oracle.com/products/export). You agree that neither the Software nor any direct product thereof will be exported, directly, or indirectly, in violation of these laws, or will be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation. - -8. TRADEMARKS AND LOGOS. You acknowledge and agree as between you -and Oracle that Oracle owns the ORACLE and JAVA trademarks and all ORACLE- and JAVA-related trademarks, service marks, logos and other brand -designations ("Oracle Marks"), and you agree to comply with the Third -Party Usage Guidelines for Oracle Trademarks currently located at -http://www.oracle.com/us/legal/third-party-trademarks/index.html . Any use you make of the Oracle Marks inures to Oracle's benefit. - -9. U.S. GOVERNMENT LICENSE RIGHTS. If Software is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the Government's rights in Software and accompanying documentation shall be only those set forth in this Agreement. - -10. GOVERNING LAW. This agreement is governed by the substantive and procedural laws of California. You and Oracle agree to submit to the exclusive jurisdiction of, and venue in, the courts of San Francisco, or Santa Clara counties in California in any dispute arising out of or relating to this agreement. - -11. SEVERABILITY. If any provision of this Agreement is held to be unenforceable, this Agreement will remain in effect with the provision omitted, unless omission would frustrate the intent of the parties, in which case this Agreement will immediately terminate. - -12. INTEGRATION. This Agreement is the entire agreement between you and Oracle relating to its subject matter. It supersedes all prior or contemporaneous oral or written communications, proposals, representations and warranties and prevails over any conflicting or additional terms of any quote, order, acknowledgment, or other communication between the parties relating to its subject matter during the term of this Agreement. No modification of this Agreement will be binding, unless in writing and signed by an authorized representative of each party. - -SUPPLEMENTAL LICENSE TERMS - -These Supplemental License Terms add to or modify the terms of the Binary Code License Agreement. Capitalized terms not defined in these Supplemental Terms shall have the same meanings ascribed to them in the Binary Code License Agreement. These Supplemental Terms shall supersede any inconsistent or conflicting terms in the Binary Code License Agreement, or in any license contained within the Software. - -A. COMMERCIAL FEATURES. You may not use the Commercial Features for running Programs, Java applets or applications in your internal business operations or for any commercial or production purpose, or for any purpose other than as set forth in Sections B, C, D and E of these Supplemental Terms. If You want to use the Commercial Features for any purpose other than as permitted in this Agreement, You must obtain a separate license from Oracle. - -B. SOFTWARE INTERNAL USE FOR DEVELOPMENT LICENSE GRANT. Subject to the terms and conditions of this Agreement and restrictions and exceptions set forth in the README File incorporated herein by reference, including, but not limited to the Java Technology Restrictions of these Supplemental Terms, Oracle grants you a non-exclusive, non-transferable, limited license without fees to reproduce internally and use internally the Software complete and unmodified for the purpose of designing, developing, and testing your Programs. - -C. LICENSE TO DISTRIBUTE SOFTWARE. Subject to the terms and conditions of this Agreement and restrictions and exceptions set forth in the README File, including, but not limited to the Java Technology Restrictions and Limitations on Redistribution of these Supplemental Terms, Oracle grants you a non-exclusive, non-transferable, limited license without fees to reproduce and distribute the Software, provided that (i) you distribute the Software complete and unmodified and only bundled as part of, and for the sole purpose of running, your Programs, (ii) the Programs add significant and primary functionality to the Software, (iii) you do not distribute additional software intended to replace any component(s) of the Software, (iv) you do not remove or alter any proprietary legends or notices contained in the Software, (v) you only distribute the Software subject to a license agreement that: (a) is a complete, unmodified reproduction of this Agreement; or (b) protects Oracle's interests consistent with the terms contained in this Agreement and that includes the notice set forth in Section H, and (vi) you agree to defend and indemnify Oracle and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Software. The license set forth in this Section C does not extend to the Software identified in Section G. - -D. LICENSE TO DISTRIBUTE REDISTRIBUTABLES. Subject to the terms and conditions of this Agreement and restrictions and exceptions set forth in the README File, including but not limited to the Java Technology Restrictions and Limitations on Redistribution of these Supplemental Terms, Oracle grants you a non-exclusive, non-transferable, limited license without fees to reproduce and distribute those files specifically identified as redistributable in the README File ("Redistributables") provided that: (i) you distribute the Redistributables complete and unmodified, and only bundled as part of Programs, (ii) the Programs add significant and primary functionality to the Redistributables, (iii) you do not distribute additional software intended to supersede any component(s) of the Redistributables (unless otherwise specified in the applicable README File), (iv) you do not remove or alter any proprietary legends or notices contained in or on the Redistributables, (v) you only distribute the Redistributables pursuant to a license agreement that: (a) is a complete, unmodified reproduction of this Agreement; or (b) protects Oracle's interests consistent with the terms contained in the Agreement and includes the notice set forth in Section H, (vi) you agree to defend and indemnify Oracle and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Software. The license set forth in this Section D does not extend to the Software identified in Section G. - -E. DISTRIBUTION BY PUBLISHERS. This section pertains to your distribution of the JavaTM SE Development Kit Software (“JDK”) with your printed book or magazine (as those terms are commonly used in the industry) relating to Java technology ("Publication"). Subject to and conditioned upon your compliance with the restrictions and obligations contained in the Agreement, Oracle hereby grants to you a non-exclusive, nontransferable limited right to reproduce complete and unmodified copies of the JDK on electronic media (the "Media") for the sole purpose of inclusion and distribution with your Publication(s), subject to the following terms: (i) You may not distribute the JDK on a stand-alone basis; it must be distributed with your Publication(s); (ii) You are responsible for downloading the JDK from the applicable Oracle web site; (iii) You must refer to the JDK as JavaTM SE Development Kit; (iv) The JDK must be reproduced in its entirety and without any modification whatsoever (including with respect to all proprietary notices) and distributed with your Publication subject to a license agreement that is a complete, unmodified reproduction of this Agreement; (v) The Media label shall include the following information: “Copyright [YEAR], Oracle America, Inc. All rights reserved. Use is subject to license terms. ORACLE and JAVA trademarks and all ORACLE- and JAVA-related trademarks, service marks, logos and other brand designations are trademarks or registered trademarks of Oracle in the U.S. and other countries.” [YEAR] is the year of Oracle's release of the Software; the year information can typically be found in the Software’s “About” box or screen. This information must be placed on the Media label in such a manner as to only apply to the JDK; (vi) You must clearly identify the JDK as Oracle's product on the Media holder or Media label, and you may not state or imply that Oracle is responsible for any third-party software contained on the Media; (vii) You may not include any third party software on the Media which is intended to be a replacement or substitute for the JDK; (viii) You agree to defend and indemnify Oracle and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of the JDK and/or the Publication; ; and (ix) You shall provide Oracle with a written notice for each Publication; such notice shall include the following information: (1) title of Publication, (2) author(s), (3) date of Publication, and (4) ISBN or ISSN numbers. Such notice shall be sent to Oracle America, Inc., 500 Oracle Parkway, Redwood Shores, California 94065 U.S.A , Attention: General Counsel. - -F. JAVA TECHNOLOGY RESTRICTIONS. You may not create, modify, or change the behavior of, or authorize your licensees to create, modify, or change the behavior of, classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun", “oracle” or similar convention as specified by Oracle in any naming convention designation. - -G. LIMITATIONS ON REDISTRIBUTION. You may not redistribute or otherwise transfer patches, bug fixes or updates made available by Oracle through Oracle Premier Support, including those made available under Oracle's Java SE Support program. - -H. COMMERCIAL FEATURES NOTICE. For purpose of complying with Supplemental Term Section C.(v)(b) and D.(v)(b), your license agreement shall include the following notice, where the notice is displayed in a manner that anyone using the Software will see the notice: - -Use of the Commercial Features for any commercial or production purpose requires a separate license from Oracle. “Commercial Features” means those features identified Table 1-1 (Commercial Features In Java SE Product Editions) of the Java SE documentation accessible at http://www.oracle.com/technetwork/java/javase/documentation/index.html - - - -I. SOURCE CODE. Software may contain source code that, unless expressly licensed for other purposes, is provided solely for reference purposes pursuant to the terms of this Agreement. Source code may not be redistributed unless expressly provided for in this Agreement. - -J. THIRD PARTY CODE. Additional copyright notices and license terms applicable to portions of the Software are set forth in the THIRDPARTYLICENSEREADME file accessible at http://www.oracle.com/technetwork/java/javase/documentation/index.html. In addition to any terms and conditions of any third party opensource/freeware license identified in the THIRDPARTYLICENSEREADME file, the disclaimer of warranty and limitation of liability provisions in paragraphs 4 and 5 of the Binary Code License Agreement shall apply to all Software in this distribution. - -K. TERMINATION FOR INFRINGEMENT. Either party may terminate this Agreement immediately should any Software become, or in either party's opinion be likely to become, the subject of a claim of infringement of any intellectual property right. - -L. INSTALLATION AND AUTO-UPDATE. The Software's installation and auto-update processes transmit a limited amount of data to Oracle (or its service provider) about those specific processes to help Oracle understand and optimize them. Oracle does not associate the data with personally identifiable information. You can find more information about the data Oracle collects as a result of your Software download at http://www.oracle.com/technetwork/java/javase/documentation/index.html. - -For inquiries please contact: Oracle America, Inc., 500 Oracle Parkway, - -Redwood Shores, California 94065, USA. - -Last updated 02 April 2013 - diff --git a/export-image/prerun.sh b/export-image/prerun.sh index ca13b70..ea1e2d6 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}.img" +IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img" unmount_image "${IMG_FILE}" @@ -9,11 +9,11 @@ rm -f "${IMG_FILE}" rm -rf "${ROOTFS_DIR}" mkdir -p "${ROOTFS_DIR}" -BOOT_SIZE=$(du --apparent-size -s "${EXPORT_ROOTFS_DIR}/boot" --block-size=1 | cut -f 1) +BOOT_SIZE="$((256 * 1024 * 1024))" TOTAL_SIZE=$(du --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --block-size=1 | cut -f 1) ROUND_SIZE="$((4 * 1024 * 1024))" -ROUNDED_ROOT_SECTOR=$(((2 * BOOT_SIZE + ROUND_SIZE) / ROUND_SIZE * ROUND_SIZE / 512 + 8192)) +ROUNDED_ROOT_SECTOR=$(((BOOT_SIZE + ROUND_SIZE) / ROUND_SIZE * ROUND_SIZE / 512 + 8192)) IMG_SIZE=$(((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024) + ROUND_SIZE - 1) / ROUND_SIZE * ROUND_SIZE)) truncate -s "${IMG_SIZE}" "${IMG_FILE}" @@ -23,7 +23,7 @@ n 8192 -+$((BOOT_SIZE * 2 /512)) ++$((BOOT_SIZE / 512)) p t c @@ -37,16 +37,12 @@ p w EOF -PARTED_OUT=$(parted -s "${IMG_FILE}" unit b print) -BOOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^ 1'| xargs echo -n \ -| cut -d" " -f 2 | tr -d B) -BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^ 1'| xargs echo -n \ -| cut -d" " -f 4 | tr -d B) +PARTED_OUT=$(parted -sm "${IMG_FILE}" unit b print) +BOOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 2 | tr -d B) +BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 4 | tr -d B) -ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^ 2'| xargs echo -n \ -| cut -d" " -f 2 | tr -d B) -ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^ 2'| xargs echo -n \ -| cut -d" " -f 4 | tr -d B) +ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 2 | tr -d B) +ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 4 | tr -d B) BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}") ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}") @@ -66,4 +62,5 @@ mount -v "$ROOT_DEV" "${ROOTFS_DIR}" -t ext4 mkdir -p "${ROOTFS_DIR}/boot" mount -v "$BOOT_DEV" "${ROOTFS_DIR}/boot" -t vfat -rsync -aHAXx --exclude var/cache/apt/archives "${EXPORT_ROOTFS_DIR}/" "${ROOTFS_DIR}/" +rsync -aHAXx --exclude /var/cache/apt/archives --exclude /boot "${EXPORT_ROOTFS_DIR}/" "${ROOTFS_DIR}/" +rsync -rtx "${EXPORT_ROOTFS_DIR}/boot/" "${ROOTFS_DIR}/boot/" diff --git a/export-noobs/00-release/00-run.sh b/export-noobs/00-release/00-run.sh index 85ee454..1d0b12f 100755 --- a/export-noobs/00-release/00-run.sh +++ b/export-noobs/00-release/00-run.sh @@ -10,17 +10,23 @@ install -v files/release_notes.txt "${NOOBS_DIR}/" tar -v -c -C files/marketing -f "${NOOBS_DIR}/marketing.tar" . +BOOT_SHASUM="$(sha256sum "${NOOBS_DIR}/boot.tar.xz" | cut -f1 -d' ')" +ROOT_SHASUM="$(sha256sum "${NOOBS_DIR}/root.tar.xz" | cut -f1 -d' ')" + BOOT_SIZE="$(xz --robot -l "${NOOBS_DIR}/boot.tar.xz" | grep totals | cut -f 5)" ROOT_SIZE="$(xz --robot -l "${NOOBS_DIR}/root.tar.xz" | grep totals | cut -f 5)" BOOT_SIZE="$(( BOOT_SIZE / 1024 / 1024 + 1))" ROOT_SIZE="$(( ROOT_SIZE / 1024 / 1024 + 1))" -BOOT_NOM="$(( BOOT_SIZE * 3 ))" +BOOT_NOM="256" ROOT_NOM="$(( ROOT_SIZE + 400 ))" mv "${NOOBS_DIR}/OS.png" "${NOOBS_DIR}/${NOOBS_NAME// /_}.png" +sed "${NOOBS_DIR}/partitions.json" -i -e "s|BOOT_SHASUM|${BOOT_SHASUM}|" +sed "${NOOBS_DIR}/partitions.json" -i -e "s|ROOT_SHASUM|${ROOT_SHASUM}|" + sed "${NOOBS_DIR}/partitions.json" -i -e "s|BOOT_SIZE|${BOOT_SIZE}|" sed "${NOOBS_DIR}/partitions.json" -i -e "s|ROOT_SIZE|${ROOT_SIZE}|" diff --git a/export-noobs/00-release/files/OS.png b/export-noobs/00-release/files/OS.png index 10ecc62..02b67cf 100644 Binary files a/export-noobs/00-release/files/OS.png and b/export-noobs/00-release/files/OS.png differ diff --git a/export-noobs/00-release/files/os.json b/export-noobs/00-release/files/os.json index a37e266..afa9f9a 100644 --- a/export-noobs/00-release/files/os.json +++ b/export-noobs/00-release/files/os.json @@ -1,7 +1,7 @@ { "description": "NOOBS_DESCRIPTION", "feature_level": 35120124, - "kernel": "4.14", + "kernel": "4.19", "name": "NOOBS_NAME", "password": "raspberry", "release_date": "UNRELEASED", @@ -11,9 +11,10 @@ "Pi 2", "Pi Zero", "Pi 3", - "Pi Compute Module 3" + "Pi Compute Module 3", + "Pi 4" ], "url": "http://www.raspbian.org/", "username": "pi", - "version": "stretch" + "version": "buster" } diff --git a/export-noobs/00-release/files/partition_setup.sh b/export-noobs/00-release/files/partition_setup.sh index e41a9d3..851290e 100644 --- a/export-noobs/00-release/files/partition_setup.sh +++ b/export-noobs/00-release/files/partition_setup.sh @@ -3,6 +3,7 @@ set -ex +# shellcheck disable=SC2154 if [ -z "$part1" ] || [ -z "$part2" ]; then printf "Error: missing environment variable part1 or part2\n" 1>&2 exit 1 @@ -17,7 +18,8 @@ sed /tmp/1/cmdline.txt -i -e "s|root=[^ ]*|root=${part2}|" sed /tmp/2/etc/fstab -i -e "s|^[^#].* / |${part2} / |" sed /tmp/2/etc/fstab -i -e "s|^[^#].* /boot |${part1} /boot |" -if [ -z $restore ]; then +# shellcheck disable=SC2154 +if [ -z "$restore" ]; then if [ -f /mnt/ssh ]; then cp /mnt/ssh /tmp/1/ fi @@ -31,7 +33,12 @@ if [ -z $restore ]; then fi if ! grep -q resize /proc/cmdline; then - sed -i 's| init=/usr/lib/raspi-config/init_resize.sh||;s| quiet||2g' /tmp/1/cmdline.txt + if ! grep -q splash /tmp/1/cmdline.txt; then + sed -i "s| quiet||g" /tmp/1/cmdline.txt + fi + sed -i 's| init=/usr/lib/raspi-config/init_resize.sh||' /tmp/1/cmdline.txt + else + sed -i '1 s|.*|& sdhci.debug_quirks2=4|' /tmp/1/cmdline.txt fi fi diff --git a/export-noobs/00-release/files/partitions.json b/export-noobs/00-release/files/partitions.json index c2e2bcb..3d06017 100644 --- a/export-noobs/00-release/files/partitions.json +++ b/export-noobs/00-release/files/partitions.json @@ -6,7 +6,8 @@ "mkfs_options": "-F 32", "partition_size_nominal": BOOT_NOM, "uncompressed_tarball_size": BOOT_SIZE, - "want_maximised": false + "want_maximised": false, + "sha256sum": "BOOT_SHASUM" }, { "filesystem_type": "ext4", @@ -14,7 +15,8 @@ "mkfs_options": "-O ^huge_file", "partition_size_nominal": ROOT_NOM, "uncompressed_tarball_size": ROOT_SIZE, - "want_maximised": true + "want_maximised": true, + "sha256sum": "ROOT_SHASUM" } ] } diff --git a/export-noobs/00-release/files/release_notes.txt b/export-noobs/00-release/files/release_notes.txt index 3a71c1e..5fe21e0 100644 --- a/export-noobs/00-release/files/release_notes.txt +++ b/export-noobs/00-release/files/release_notes.txt @@ -1,5 +1,50 @@ UNRELEASED: * +2019-06-20: + * Based on Debian Buster + * Support for Raspberry Pi 4 hardware + * FKMS OpenGL desktop graphics driver and xcompmgr compositing window manager used when running on Raspberry Pi 4 + * Screen Configuration application added for use with FKMS driver + * Raspberry Pi 4 video output options added to Raspberry Pi Configuration + * Uses new PiXflat UI theme for GTK and Openbox + * CPU activity gauge plugin no longer shown on taskbar by default + * CPU temperature gauge plugin added (not shown by default) + * USB ejecter and Bluetooth taskbar icons hidden when not appropriate + * Version 74.0.3729.157 of Chromium web browser included + * Version 32.0.0.207 of Flash player included + * IDLE Python IDE removed + * Wolfram Mathematica removed temporarily due to incompatibility with Buster + * Display of package sizes removed from Recommended Software + * Appearance Settings modified to support independent settings for two monitors + * Oracle Java 7 and 8 replaced with OpenJDK 11 + * Miscellaneous small bug fixes + * On-board 5GHz WiFi blocked by rfkill by default + The block is removed when taking one of the following actions: + - Selecting a locale in the first run wizard + - Setting the WiFi country in the Raspberry Pi Configuration tool or the Network Settings applet + - Setting the WiFi country in raspi-config + - Providing a wpa_supplicant.conf file through the boot partition + - Running 'rfkill unblock wifi' + * Boot partition size set to 256M + * Linux kernel 4.19.50 + * Raspberry Pi firmware 88ca9081f5e51cdedd16d5dbc85ed12a25123201 +2019-04-08: + * Chromium browser updated to version 72 + * VLC media player updated to version 3.0.6 + * RealVNC Server updated to version 6.4.0 + * Flash player updated to version 32.0.0.156 + * Performance improvements to SDL library + * Performance improvements to pixman library + * Option to set display underscan added to startup wizard + * Mounted external drives now displayed on desktop by default + * Network plugin modified for improved compatibility with wpa_passphrase + * SD Card Copier tweaks to reduce copy failures + * Various minor bug fixes and appearance tweaks + * Added ethtool + * Added rng-tools + * Add PINN restore support + * Linux kernel 4.14.98 + * Raspberry Pi firmware f8939644f7bd3065068787f1f92b3f3c79cf3de9 2018-11-13: * Two versions of image created - "base" image has no optional software packages included; "full" image has all optional packages - Removed from "base" image - LibreOffice, Thonny, Scratch, Scratch 2, Sonic Pi, Minecraft, Python Games, SmartSim, SenseHAT Emulator diff --git a/export-noobs/prerun.sh b/export-noobs/prerun.sh index 47a4f9b..54e0c59 100755 --- a/export-noobs/prerun.sh +++ b/export-noobs/prerun.sh @@ -1,24 +1,20 @@ #!/bin/bash -e -IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}.img" +IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img" NOOBS_DIR="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}" unmount_image "${IMG_FILE}" mkdir -p "${STAGE_WORK_DIR}" -cp "${WORK_DIR}/export-image/${IMG_FILENAME}.img" "${STAGE_WORK_DIR}/" +cp "${WORK_DIR}/export-image/${IMG_FILENAME}${IMG_SUFFIX}.img" "${STAGE_WORK_DIR}/" rm -rf "${NOOBS_DIR}" -PARTED_OUT=$(parted -s "${IMG_FILE}" unit b print) -BOOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^ 1'| xargs echo -n \ -| cut -d" " -f 2 | tr -d B) -BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^ 1'| xargs echo -n \ -| cut -d" " -f 4 | tr -d B) +PARTED_OUT=$(parted -sm "${IMG_FILE}" unit b print) +BOOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 2 | tr -d B) +BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 4 | tr -d B) -ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^ 2'| xargs echo -n \ -| cut -d" " -f 2 | tr -d B) -ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^ 2'| xargs echo -n \ -| cut -d" " -f 4 | tr -d B) +ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 2 | tr -d B) +ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 4 | tr -d B) BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}") ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}") @@ -33,8 +29,8 @@ mount "$BOOT_DEV" "${STAGE_WORK_DIR}/rootfs/boot" ln -sv "/lib/systemd/system/apply_noobs_os_config.service" "$ROOTFS_DIR/etc/systemd/system/multi-user.target.wants/apply_noobs_os_config.service" -bsdtar --numeric-owner --format gnutar --use-compress-program pxz -C "${STAGE_WORK_DIR}/rootfs/boot" -cpf "${NOOBS_DIR}/boot.tar.xz" . +bsdtar --numeric-owner --format gnutar -C "${STAGE_WORK_DIR}/rootfs/boot" -cpf - . | xz -T0 > "${NOOBS_DIR}/boot.tar.xz" umount "${STAGE_WORK_DIR}/rootfs/boot" -bsdtar --numeric-owner --format gnutar --use-compress-program pxz -C "${STAGE_WORK_DIR}/rootfs" --one-file-system -cpf "${NOOBS_DIR}/root.tar.xz" . +bsdtar --numeric-owner --format gnutar -C "${STAGE_WORK_DIR}/rootfs" --one-file-system -cpf - . | xz -T0 > "${NOOBS_DIR}/root.tar.xz" unmount_image "${IMG_FILE}" diff --git a/scripts/common b/scripts/common index bdddead..f264755 100644 --- a/scripts/common +++ b/scripts/common @@ -4,21 +4,22 @@ log (){ export -f log bootstrap(){ - local ARCH - ARCH=$(dpkg --print-architecture) + local BOOTSTRAP_CMD=debootstrap + local BOOTSTRAP_ARGS=() export http_proxy=${APT_PROXY} - if [ "$ARCH" != "armhf" ]; then - local BOOTSTRAP_CMD=qemu-debootstrap - else - local BOOTSTRAP_CMD=debootstrap + if [ "$(dpkg --print-architecture)" != "armhf" ] && [ "$(dpkg --print-architecture)" != "aarch64" ]; then + BOOTSTRAP_CMD=qemu-debootstrap fi - capsh --drop=cap_setfcap -- "${BOOTSTRAP_CMD}" --components=main,contrib,non-free \ - --arch armhf \ - --keyring "${STAGE_DIR}/files/raspberrypi.gpg" \ - "$1" "$2" "$3" || true + BOOTSTRAP_ARGS+=(--arch armhf) + BOOTSTRAP_ARGS+=(--components "main,contrib,non-free") + BOOTSTRAP_ARGS+=(--keyring "${STAGE_DIR}/files/raspberrypi.gpg") + BOOTSTRAP_ARGS+=("$@") + + setarch linux32 capsh --drop=cap_setfcap -- "${BOOTSTRAP_CMD}" "${BOOTSTRAP_ARGS[@]}" || true + if [ -d "$2/debootstrap" ]; then rmdir "$2/debootstrap" fi @@ -56,7 +57,7 @@ unmount_image(){ sync sleep 1 local LOOP_DEVICES - LOOP_DEVICES=$(losetup -j "${1}" | cut -f1 -d':') + LOOP_DEVICES=$(losetup --list | grep "$(basename "${1}")" | cut -f1 -d' ') for LOOP_DEV in ${LOOP_DEVICES}; do if [ -n "${LOOP_DEV}" ]; then local MOUNTED_DIR @@ -88,14 +89,14 @@ on_chroot() { mount --bind /sys "${ROOTFS_DIR}/sys" fi - capsh --drop=cap_setfcap "--chroot=${ROOTFS_DIR}/" -- -e "$@" + setarch linux32 capsh --drop=cap_setfcap "--chroot=${ROOTFS_DIR}/" -- -e "$@" } export -f on_chroot update_issue() { local GIT_HASH GIT_HASH=$(git rev-parse HEAD) - echo -e "Raspberry Pi reference ${IMG_DATE}\nGenerated using pi-gen, https://github.com/RPi-Distro/pi-gen, ${GIT_HASH}, ${1}" > "${ROOTFS_DIR}/etc/rpi-issue" + echo -e "Raspberry Pi reference ${IMG_DATE}\nGenerated using ${PI_GEN}, ${PI_GEN_REPO}, ${GIT_HASH}, ${1}" > "${ROOTFS_DIR}/etc/rpi-issue" } export -f update_issue diff --git a/scripts/dependencies_check b/scripts/dependencies_check index 1b92a9c..375512b 100644 --- a/scripts/dependencies_check +++ b/scripts/dependencies_check @@ -27,4 +27,12 @@ dependencies_check() echo "$missing" false fi + + + if ! grep -q "/proc/sys/fs/binfmt_misc" /proc/mounts; then + echo "Module binfmt_misc not loaded in host" + echo "Please run:" + echo " sudo modprobe binfmt_misc" + exit 1 + fi } diff --git a/stage0/00-configure-apt/files/raspi.list b/stage0/00-configure-apt/files/raspi.list index 656ab48..122287e 100644 --- a/stage0/00-configure-apt/files/raspi.list +++ b/stage0/00-configure-apt/files/raspi.list @@ -1,3 +1,3 @@ -deb http://archive.raspberrypi.org/debian/ stretch main ui staging +deb http://archive.raspberrypi.org/debian/ buster main # Uncomment line below then 'apt-get update' to enable 'apt-get source' -#deb-src http://archive.raspberrypi.org/debian/ stretch main ui +#deb-src http://archive.raspberrypi.org/debian/ buster main diff --git a/stage0/00-configure-apt/files/sources.list b/stage0/00-configure-apt/files/sources.list index 45e5210..61820ac 100644 --- a/stage0/00-configure-apt/files/sources.list +++ b/stage0/00-configure-apt/files/sources.list @@ -1,3 +1,3 @@ -deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi +deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi # Uncomment line below then 'apt-get update' to enable 'apt-get source' -#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi +#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi diff --git a/stage0/prerun.sh b/stage0/prerun.sh index 7c09b02..9ce3e02 100755 --- a/stage0/prerun.sh +++ b/stage0/prerun.sh @@ -1,5 +1,5 @@ #!/bin/bash -e if [ ! -d "${ROOTFS_DIR}" ]; then - bootstrap stretch "${ROOTFS_DIR}" http://raspbian.raspberrypi.org/raspbian/ + bootstrap buster "${ROOTFS_DIR}" http://raspbian.raspberrypi.org/raspbian/ fi diff --git a/stage1/00-boot-files/files/config.txt b/stage1/00-boot-files/files/config.txt index 06364c5..578d736 100644 --- a/stage1/00-boot-files/files/config.txt +++ b/stage1/00-boot-files/files/config.txt @@ -54,3 +54,11 @@ # Enable audio (loads snd_bcm2835) dtparam=audio=on + +[pi4] +# Enable DRM VC4 V3D driver on top of the dispmanx display stack +dtoverlay=vc4-fkms-v3d +max_framebuffers=2 + +[all] +#dtoverlay=vc4-fkms-v3d diff --git a/stage2/00-copies-and-fills/02-run.sh b/stage2/00-copies-and-fills/02-run.sh new file mode 100755 index 0000000..a7ab5ec --- /dev/null +++ b/stage2/00-copies-and-fills/02-run.sh @@ -0,0 +1,3 @@ +#!/bin/bash -e + +mv "${ROOTFS_DIR}/etc/ld.so.preload" "${ROOTFS_DIR}/etc/ld.so.preload.disabled" diff --git a/stage2/01-sys-tweaks/00-packages b/stage2/01-sys-tweaks/00-packages index f058ffb..b1e1de6 100644 --- a/stage2/01-sys-tweaks/00-packages +++ b/stage2/01-sys-tweaks/00-packages @@ -23,3 +23,5 @@ htop man-db policykit-1 ssh-import-id +rng-tools +ethtool diff --git a/stage2/02-net-tweaks/01-run.sh b/stage2/02-net-tweaks/01-run.sh index 2192943..3ba2ef9 100755 --- a/stage2/02-net-tweaks/01-run.sh +++ b/stage2/02-net-tweaks/01-run.sh @@ -6,14 +6,17 @@ install -v -m 644 files/wait.conf "${ROOTFS_DIR}/etc/systemd/system/dhcpcd.serv install -v -d "${ROOTFS_DIR}/etc/wpa_supplicant" install -v -m 600 files/wpa_supplicant.conf "${ROOTFS_DIR}/etc/wpa_supplicant/" -if [ -v WPA_COUNTRY ] -then +if [ -v WPA_COUNTRY ]; then echo "country=${WPA_COUNTRY}" >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" fi -if [ -v WPA_ESSID -a -v WPA_PASSWORD ] -then +if [ -v WPA_ESSID ] && [ -v WPA_PASSWORD ]; then on_chroot <> "/etc/wpa_supplicant/wpa_supplicant.conf" +wpa_passphrase "${WPA_ESSID}" "${WPA_PASSWORD}" >> "/etc/wpa_supplicant/wpa_supplicant.conf" EOF fi + +# Disable wifi on 5GHz models +mkdir -p "${ROOTFS_DIR}/var/lib/systemd/rfkill/" +echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmc:wlan" +echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmc:wlan" diff --git a/stage3/00-install-packages/00-packages b/stage3/00-install-packages/00-packages index 61c652f..eac74ea 100644 --- a/stage3/00-install-packages/00-packages +++ b/stage3/00-install-packages/00-packages @@ -12,3 +12,4 @@ gldriver-test fonts-droid-fallback fonts-liberation2 obconf +arandr diff --git a/stage3/00-install-packages/00-packages-nr b/stage3/00-install-packages/00-packages-nr index 3915e3a..c015287 100644 --- a/stage3/00-install-packages/00-packages-nr +++ b/stage3/00-install-packages/00-packages-nr @@ -1,6 +1,6 @@ xserver-xorg-video-fbdev xserver-xorg xinit xserver-xorg-video-fbturbo epiphany-browser -lxde lxtask menu-xdg gksu -netsurf-gtk zenity xdg-utils +lxde lxtask menu-xdg +zenity xdg-utils gvfs-backends gvfs-fuse lightdm gnome-themes-standard-data gnome-icon-theme diff --git a/stage4/00-install-packages/00-packages b/stage4/00-install-packages/00-packages index b0fcf1b..aac5493 100644 --- a/stage4/00-install-packages/00-packages +++ b/stage4/00-install-packages/00-packages @@ -1,6 +1,5 @@ -java-common oracle-java8-jdk -python idle python3-pygame python-pygame python-tk -python3 idle3 python3-tk +python python3-pygame python-pygame python-tk +python3 python3-tk python3-thonny python3-pgzero python-serial python3-serial python-picamera python3-picamera @@ -11,7 +10,7 @@ python3-numpy pypy alacarte rc-gui sense-hat tree -libgl1-mesa-dri libgles1-mesa libgles2-mesa xcompmgr +libgl1-mesa-dri libgles1 libgles2-mesa xcompmgr geany piclone wiringpi pigpio python-pigpio python3-pigpio raspi-gpio python-gpiozero python3-gpiozero python3-rpi.gpio @@ -23,5 +22,5 @@ python-picraft python3-picraft pprompt piwiz rp-prefapps -libav-tools +ffmpeg vlc diff --git a/stage4/00-install-packages/00-packages-nr b/stage4/00-install-packages/00-packages-nr index 9e19f6c..b904b80 100644 --- a/stage4/00-install-packages/00-packages-nr +++ b/stage4/00-install-packages/00-packages-nr @@ -1,3 +1,2 @@ -timidity pi-package realvnc-vnc-server diff --git a/stage4/01-console-autologin/00-run.sh b/stage4/01-console-autologin/00-run.sh index 2189bef..665dcdb 100755 --- a/stage4/01-console-autologin/00-run.sh +++ b/stage4/01-console-autologin/00-run.sh @@ -1,4 +1,5 @@ #!/bin/bash -e -ln -sf /etc/systemd/system/autologin@.service \ - "${ROOTFS_DIR}/etc/systemd/system/getty.target.wants/getty@tty1.service" +on_chroot << EOF + SUDO_USER="${FIRST_USER_NAME}" raspi-config nonint do_boot_behaviour B4 +EOF diff --git a/stage4/03-magpi/00-run.sh b/stage4/03-magpi/00-run.sh index da00ecc..cc5a820 100755 --- a/stage4/03-magpi/00-run.sh +++ b/stage4/03-magpi/00-run.sh @@ -11,6 +11,5 @@ fi file "files/$magpi_latest" | grep -q "PDF document" -install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/MagPi" -install -v -o 1000 -g 1000 -m 644 "files/$magpi_latest" "${ROOTFS_DIR}/home/pi/MagPi/" - +install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/MagPi" +install -v -o 1000 -g 1000 -m 644 "files/$magpi_latest" "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/MagPi/" diff --git a/stage4/04-enable-xcompmgr/00-run.sh b/stage4/04-enable-xcompmgr/00-run.sh new file mode 100755 index 0000000..ad6298d --- /dev/null +++ b/stage4/04-enable-xcompmgr/00-run.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +on_chroot << EOF + raspi-config nonint do_xcompmgr 0 +EOF diff --git a/stage5/00-install-extras/00-packages b/stage5/00-install-extras/00-packages index 23e682c..5eb164e 100644 --- a/stage5/00-install-extras/00-packages +++ b/stage5/00-install-extras/00-packages @@ -1,4 +1,4 @@ -python3-thonny +mu-editor sonic-pi scratch nuscratch scratch2 smartsim @@ -6,9 +6,8 @@ smartsim minecraft-pi python-minecraftpi python-sense-emu sense-emu-tools python-sense-emu-doc -wolfram-engine claws-mail -greenfoot bluej +greenfoot-unbundled bluej nodered realvnc-vnc-viewer