aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge Schneider <[email protected]>2020-09-23 20:02:52 +0100
committerSerge Schneider <[email protected]>2020-09-23 20:02:52 +0100
commit8808124cc319932f5fff4d8c5b78a9b6de95d642 (patch)
tree0286d12828d5a87ea5cf45bf1e8921e27b6ce249
parentbc3970f9e397c495177ff346b1f359d51bc79540 (diff)
parentd1596451b9d81c360c6cf89a10ed1c30e19e4e02 (diff)
Merge branch 'master' into arm64
-rw-r--r--README.md12
-rwxr-xr-xexport-image/prerun.sh28
-rwxr-xr-xexport-noobs/prerun.sh28
-rwxr-xr-xstage2/02-net-tweaks/01-run.sh11
4 files changed, 66 insertions, 13 deletions
diff --git a/README.md b/README.md
index e7f224a..8b7f875 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,16 @@
# pi-gen
-_Tool used to create the raspberrypi.org Raspbian images_
+Tool used to create Raspberry Pi OS images. (Previously known as Raspbian).
## Dependencies
-pi-gen runs on Debian based operating systems. Currently it is only supported on
+pi-gen runs on Debian-based operating systems. Currently it is only supported on
either Debian Buster or Ubuntu Xenial and is known to have issues building on
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:
+To install the required dependencies for `pi-gen` you should run:
```bash
apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \
@@ -68,7 +68,7 @@ The following environment variables are supported:
system for each build stage, amounting to tens of gigabytes in the case of
Raspbian.
- **CAUTION**: If your working directory is on an NTFS partition you probably won't be able to build. Make sure this is a proper Linux filesystem.
+ **CAUTION**: If your working directory is on an NTFS partition you probably won't be able to build: make sure this is a proper Linux filesystem.
* `DEPLOY_DIR` (Default: `"$BASE_DIR/deploy"`)
@@ -124,7 +124,7 @@ The following environment variables are supported:
* `WPA_ESSID`, `WPA_PASSWORD` and `WPA_COUNTRY` (Default: unset)
- If these are set, they are use to configure `wpa_supplicant.conf`, so that the Raspberry Pi can automatically connect to a wifi network on first boot. If `WPA_ESSID` is set and `WPA_PASSWORD` is unset an unprotected wifi network will be configured. If set, `WPA_PASSWORD` must be between 8 and 63 characters.
+ If these are set, they are use to configure `wpa_supplicant.conf`, so that the Raspberry Pi can automatically connect to a wireless network on first boot. If `WPA_ESSID` is set and `WPA_PASSWORD` is unset an unprotected wireless network will be configured. If set, `WPA_PASSWORD` must be between 8 and 63 characters.
* `ENABLE_SSH` (Default: `0`)
@@ -276,7 +276,7 @@ maintenance and allows for more easy customization.
- **Stage 2** - lite system. This stage produces the Raspbian-Lite image. It
installs some optimized memory functions, sets timezone and charmap
- defaults, installs fake-hwclock and ntp, wifi and bluetooth support,
+ defaults, installs fake-hwclock and ntp, wireless LAN and bluetooth support,
dphys-swapfile, and other basics for managing the hardware. It also
creates necessary groups and gives the pi user access to sudo and the
standard console hardware permission groups.
diff --git a/export-image/prerun.sh b/export-image/prerun.sh
index 8bbc566..4b5cf8c 100755
--- a/export-image/prerun.sh
+++ b/export-image/prerun.sh
@@ -39,8 +39,32 @@ BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | 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}")
+echo "Mounting BOOT_DEV..."
+cnt=0
+until BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}"); do
+ if [ $cnt -lt 5 ]; then
+ cnt=$((cnt + 1))
+ echo "Error in losetup for BOOT_DEV. Retrying..."
+ sleep 5
+ else
+ echo "ERROR: losetup for BOOT_DEV failed; exiting"
+ exit 1
+ fi
+done
+
+echo "Mounting ROOT_DEV..."
+cnt=0
+until ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}"); do
+ if [ $cnt -lt 5 ]; then
+ cnt=$((cnt + 1))
+ echo "Error in losetup for ROOT_DEV. Retrying..."
+ sleep 5
+ else
+ echo "ERROR: losetup for ROOT_DEV failed; exiting"
+ exit 1
+ fi
+done
+
echo "/boot: offset $BOOT_OFFSET, length $BOOT_LENGTH"
echo "/: offset $ROOT_OFFSET, length $ROOT_LENGTH"
diff --git a/export-noobs/prerun.sh b/export-noobs/prerun.sh
index 54e0c59..c161ee6 100755
--- a/export-noobs/prerun.sh
+++ b/export-noobs/prerun.sh
@@ -16,8 +16,32 @@ BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | 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}")
+echo "Mounting BOOT_DEV..."
+cnt=0
+until BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}"); do
+ if [ $cnt -lt 5 ]; then
+ cnt=$((cnt + 1))
+ echo "Error in losetup for BOOT_DEV. Retrying..."
+ sleep 5
+ else
+ echo "ERROR: losetup for BOOT_DEV failed; exiting"
+ exit 1
+ fi
+done
+
+echo "Mounting ROOT_DEV..."
+cnt=0
+until ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}"); do
+ if [ $cnt -lt 5 ]; then
+ cnt=$((cnt + 1))
+ echo "Error in losetup for ROOT_DEV. Retrying..."
+ sleep 5
+ else
+ echo "ERROR: losetup for ROOT_DEV failed; exiting"
+ exit 1
+ fi
+done
+
echo "/boot: offset $BOOT_OFFSET, length $BOOT_LENGTH"
echo "/: offset $ROOT_OFFSET, length $ROOT_LENGTH"
diff --git a/stage2/02-net-tweaks/01-run.sh b/stage2/02-net-tweaks/01-run.sh
index 0929755..d82381b 100755
--- a/stage2/02-net-tweaks/01-run.sh
+++ b/stage2/02-net-tweaks/01-run.sh
@@ -25,7 +25,12 @@ network={
EOL
fi
-# Disable wifi on 5GHz models
+# Disable wifi on 5GHz models if WPA_COUNTRY is not set
mkdir -p "${ROOTFS_DIR}/var/lib/systemd/rfkill/"
-echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan"
-echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan"
+if [ -n "$WPA_COUNTRY" ]; then
+ echo 0 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan"
+ echo 0 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan"
+else
+ echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan"
+ echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan"
+fi