diff --git a/README.md b/README.md index 29d8166..00d0bc0 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,10 @@ The following environment variables are supported: 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. + * `ENABLE_ARM64` (Default: `0`) + + If set, the image uses arm64 instead of armhf. Arm64 is not fully stable yet, some programs may be not available or broken. + A simple example for building Raspbian: ```bash diff --git a/build.sh b/build.sh index a8247ab..f1a8a3b 100755 --- a/build.sh +++ b/build.sh @@ -105,7 +105,19 @@ run_stage(){ for SUB_STAGE_DIR in "${STAGE_DIR}"/*; do if [ -d "${SUB_STAGE_DIR}" ] && [ ! -f "${SUB_STAGE_DIR}/SKIP" ]; then - run_sub_stage + if [[ ${SUB_STAGE_DIR} == *arm64 ]]; then + if [ "$ENABLE_ARM64"="1" ]; then + run_sub_stage + fi + elif [[ ${SUB_STAGE_DIR} == *armhf ]]; then + echo "elif" + if [[ ${ENABLE_ARM64} == 0 ]]; then + echo "here" + run_sub_stage + fi + else + run_sub_stage + fi fi done fi @@ -203,6 +215,8 @@ export QUILT_NO_DIFF_INDEX=1 export QUILT_NO_DIFF_TIMESTAMPS=1 export QUILT_REFRESH_ARGS="-p ab" +export ENABLE_ARM64="${ENABLE_ARM64:-0}" + # shellcheck source=scripts/common source "${SCRIPT_DIR}/common" # shellcheck source=scripts/dependencies_check diff --git a/scripts/common b/scripts/common index e2048d9..cd15369 100644 --- a/scripts/common +++ b/scripts/common @@ -9,13 +9,17 @@ bootstrap(){ export http_proxy=${APT_PROXY} - if [ "$(dpkg --print-architecture)" != "armhf" ] && [ "$(dpkg --print-architecture)" != "aarch64" ]; then + if [ "$(dpkg --print-architecture)" != "armhf" ] && [ "$(dpkg --print-architecture)" != "arm64" ]; then BOOTSTRAP_CMD=qemu-debootstrap fi - BOOTSTRAP_ARGS+=(--arch armhf) + if [ "$ENABLE_ARM64"="1" ]; then + BOOTSTRAP_ARGS+=(--arch arm64) + else + BOOTSTRAP_ARGS+=(--arch armhf) + fi + BOOTSTRAP_ARGS+=(--keyring "${STAGE_DIR}/files/debian.gpg") BOOTSTRAP_ARGS+=(--components "main,contrib,non-free") - BOOTSTRAP_ARGS+=(--keyring "${STAGE_DIR}/files/raspberrypi.gpg") BOOTSTRAP_ARGS+=("$@") printf -v BOOTSTRAP_STR '%q ' "${BOOTSTRAP_ARGS[@]}" diff --git a/stage0/00-configure-apt/00-run.sh b/stage0/00-configure-apt/00-run.sh index d10a49f..01943ef 100755 --- a/stage0/00-configure-apt/00-run.sh +++ b/stage0/00-configure-apt/00-run.sh @@ -12,7 +12,12 @@ else rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" fi +on_chroot << EOF +apt-get update -o Acquire::AllowInsecureRepositories=true +apt install gnupg -y +EOF on_chroot apt-key add - < files/raspberrypi.gpg.key + on_chroot << EOF apt-get update apt-get dist-upgrade -y diff --git a/stage0/00-configure-apt/files/sources.list b/stage0/00-configure-apt/files/sources.list index 4a5dd8a..e4e58e9 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/ RELEASE main contrib non-free rpi +deb http://deb.debian.org/debian RELEASE main contrib non-free # Uncomment line below then 'apt-get update' to enable 'apt-get source' -#deb-src http://raspbian.raspberrypi.org/raspbian/ RELEASE main contrib non-free rpi +#deb-src http://deb.debian.org/debian RELEASE main contrib non-free diff --git a/stage0/files/debian.gpg b/stage0/files/debian.gpg new file mode 100644 index 0000000..e897ec5 Binary files /dev/null and b/stage0/files/debian.gpg differ diff --git a/stage0/prerun.sh b/stage0/prerun.sh index 3b25783..283ffd5 100755 --- a/stage0/prerun.sh +++ b/stage0/prerun.sh @@ -1,5 +1,5 @@ #!/bin/bash -e if [ ! -d "${ROOTFS_DIR}" ]; then - bootstrap ${RELEASE} "${ROOTFS_DIR}" http://raspbian.raspberrypi.org/raspbian/ + bootstrap ${RELEASE} "${ROOTFS_DIR}" http://deb.debian.org/debian/ fi diff --git a/stage1/00-boot-files/00-run.sh b/stage1/00-boot-files/00-run.sh index bc61397..2902bef 100755 --- a/stage1/00-boot-files/00-run.sh +++ b/stage1/00-boot-files/00-run.sh @@ -1,4 +1,8 @@ #!/bin/bash -e install -m 644 files/cmdline.txt "${ROOTFS_DIR}/boot/" -install -m 644 files/config.txt "${ROOTFS_DIR}/boot/" +if [ "$ENABLE_ARM64"="1" ]; then + install -m 644 files/config.txt "${ROOTFS_DIR}/boot/config.txt" +else + install -m 644 files/config.arm64.txt "${ROOTFS_DIR}/boot/config.txt" +fi diff --git a/stage1/00-boot-files/files/config.arm64.txt b/stage1/00-boot-files/files/config.arm64.txt new file mode 100644 index 0000000..fd978bd --- /dev/null +++ b/stage1/00-boot-files/files/config.arm64.txt @@ -0,0 +1,68 @@ +# For more options and information see +# http://rpf.io/configtxt +# Some settings may impact device functionality. See link above for details + +# uncomment if you get no picture on HDMI for a default "safe" mode +#hdmi_safe=1 + +# uncomment this if your display has a black border of unused pixels visible +# and your display can output without overscan +#disable_overscan=1 + +# uncomment the following to adjust overscan. Use positive numbers if console +# goes off screen, and negative if there is too much border +#overscan_left=16 +#overscan_right=16 +#overscan_top=16 +#overscan_bottom=16 + +# uncomment to force a console size. By default it will be display's size minus +# overscan. +#framebuffer_width=1280 +#framebuffer_height=720 + +# uncomment if hdmi display is not detected and composite is being output +#hdmi_force_hotplug=1 + +# uncomment to force a specific HDMI mode (this will force VGA) +#hdmi_group=1 +#hdmi_mode=1 + +# uncomment to force a HDMI mode rather than DVI. This can make audio work in +# DMT (computer monitor) modes +#hdmi_drive=2 + +# uncomment to increase signal to HDMI, if you have interference, blanking, or +# no display +#config_hdmi_boost=4 + +# uncomment for composite PAL +#sdtv_mode=2 + +#uncomment to overclock the arm. 700 MHz is the default. +#arm_freq=800 + +# Uncomment some or all of these to enable the optional hardware interfaces +#dtparam=i2c_arm=on +#dtparam=i2s=on +#dtparam=spi=on + +# Uncomment this to enable infrared communication. +#dtoverlay=gpio-ir,gpio_pin=17 +#dtoverlay=gpio-ir-tx,gpio_pin=18 + +# Additional overlays and parameters are documented /boot/overlays/README + +# Enable audio (loads snd_bcm2835) +dtparam=audio=on + +# Enable ARM64 +arm_64bit=1 + +[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/01-packages b/stage2/00-copies-and-fills-armhf/01-packages similarity index 100% rename from stage2/00-copies-and-fills/01-packages rename to stage2/00-copies-and-fills-armhf/01-packages diff --git a/stage2/00-copies-and-fills/02-run.sh b/stage2/00-copies-and-fills-armhf/02-run.sh similarity index 100% rename from stage2/00-copies-and-fills/02-run.sh rename to stage2/00-copies-and-fills-armhf/02-run.sh diff --git a/stage3/00-install-packages/00-packages b/stage3/00-install-packages/00-packages index eac74ea..b9efbc2 100644 --- a/stage3/00-install-packages/00-packages +++ b/stage3/00-install-packages/00-packages @@ -2,12 +2,11 @@ gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base gstreamer1.0-plugins-g qpdfview gtk2-engines alsa-utils desktop-base git -omxplayer raspberrypi-artwork policykit-1 gvfs rfkill -chromium-browser rpi-chromium-mods +chromium rpi-chromium-mods gldriver-test fonts-droid-fallback fonts-liberation2 diff --git a/stage3/00-install-packages/00-packages-nr b/stage3/00-install-packages/00-packages-nr index ffc324b..dff33f4 100644 --- a/stage3/00-install-packages/00-packages-nr +++ b/stage3/00-install-packages/00-packages-nr @@ -3,4 +3,4 @@ mousepad lxde lxtask menu-xdg zenity xdg-utils gvfs-backends gvfs-fuse -lightdm gnome-themes-standard-data gnome-icon-theme +lightdm adwaita-icon-theme gnome-icon-theme diff --git a/stage3/00-install-packages/01-run.sh b/stage3/00-install-packages/01-run.sh index d768747..e084311 100755 --- a/stage3/00-install-packages/01-run.sh +++ b/stage3/00-install-packages/01-run.sh @@ -2,7 +2,7 @@ on_chroot << EOF update-alternatives --install /usr/bin/x-www-browser \ - x-www-browser /usr/bin/chromium-browser 86 + x-www-browser /usr/bin/chromium 86 update-alternatives --install /usr/bin/gnome-www-browser \ - gnome-www-browser /usr/bin/chromium-browser 86 + gnome-www-browser /usr/bin/chromium 86 EOF diff --git a/stage4/00-install-packages/00-packages b/stage4/00-install-packages/00-packages index f9f5ef4..dc669d4 100644 --- a/stage4/00-install-packages/00-packages +++ b/stage4/00-install-packages/00-packages @@ -13,7 +13,7 @@ tree libgl1-mesa-dri libgles1 libgles2-mesa xcompmgr geany piclone -wiringpi pigpio python-pigpio python3-pigpio raspi-gpio python-gpiozero python3-gpiozero python3-rpi.gpio +pigpio python-pigpio python3-pigpio raspi-gpio python-gpiozero python3-gpiozero python3-rpi.gpio python-spidev python3-spidev python-twython python3-twython python-smbus python3-smbus @@ -21,5 +21,6 @@ python-flask python3-flask pprompt piwiz rp-prefapps +rp-bookshelf ffmpeg vlc diff --git a/stage4/00-install-packages/00-packages-nr b/stage4/00-install-packages/00-packages-nr index b904b80..88c1cd4 100644 --- a/stage4/00-install-packages/00-packages-nr +++ b/stage4/00-install-packages/00-packages-nr @@ -1,2 +1 @@ pi-package -realvnc-vnc-server diff --git a/stage4/01-install-packages-armhf/00-packages b/stage4/01-install-packages-armhf/00-packages new file mode 100644 index 0000000..b2b149b --- /dev/null +++ b/stage4/01-install-packages-armhf/00-packages @@ -0,0 +1 @@ +wiringpi diff --git a/stage4/01-install-packages-armhf/00-packages-nr b/stage4/01-install-packages-armhf/00-packages-nr new file mode 100644 index 0000000..81b1487 --- /dev/null +++ b/stage4/01-install-packages-armhf/00-packages-nr @@ -0,0 +1 @@ +realvnc-vnc-server diff --git a/stage4/01-console-autologin/00-run.sh b/stage4/02-console-autologin/00-run.sh similarity index 100% rename from stage4/01-console-autologin/00-run.sh rename to stage4/02-console-autologin/00-run.sh diff --git a/stage4/02-extras/00-run.sh b/stage4/03-extras/00-run.sh similarity index 100% rename from stage4/02-extras/00-run.sh rename to stage4/03-extras/00-run.sh diff --git a/stage4/03-magpi/00-run.sh b/stage4/04-magpi/00-run.sh similarity index 100% rename from stage4/03-magpi/00-run.sh rename to stage4/04-magpi/00-run.sh diff --git a/stage4/03-magpi/files/.gitignore b/stage4/04-magpi/files/.gitignore similarity index 100% rename from stage4/03-magpi/files/.gitignore rename to stage4/04-magpi/files/.gitignore diff --git a/stage4/04-enable-xcompmgr/00-run.sh b/stage4/05-enable-xcompmgr/00-run.sh similarity index 100% rename from stage4/04-enable-xcompmgr/00-run.sh rename to stage4/05-enable-xcompmgr/00-run.sh diff --git a/stage5/00-install-extras-armhf/00-packages b/stage5/00-install-extras-armhf/00-packages new file mode 100644 index 0000000..4a5ec59 --- /dev/null +++ b/stage5/00-install-extras-armhf/00-packages @@ -0,0 +1,5 @@ +nuscratch +minecraft-pi python-minecraftpi python-picraft python3-picraft +wolfram-engine +nodered +realvnc-vnc-viewer diff --git a/stage5/00-install-extras/00-packages b/stage5/00-install-extras/00-packages index 609e718..229ce6b 100644 --- a/stage5/00-install-extras/00-packages +++ b/stage5/00-install-extras/00-packages @@ -1,16 +1,12 @@ mu-editor sonic-pi -scratch nuscratch scratch2 scratch3 +scratch scratch3 smartsim -minecraft-pi python-minecraftpi python-picraft python3-picraft python-sense-emu sense-emu-tools python-sense-emu-doc -wolfram-engine claws-mail greenfoot-unbundled bluej -nodered -realvnc-vnc-viewer python-games code-the-classics diff --git a/stage5/00-install-libreoffice/00-packages b/stage5/01-install-libreoffice/00-packages similarity index 100% rename from stage5/00-install-libreoffice/00-packages rename to stage5/01-install-libreoffice/00-packages