Merge branch 'master' into arm64
This commit is contained in:
commit
8808124cc3
4 changed files with 66 additions and 13 deletions
12
README.md
12
README.md
|
@ -1,16 +1,16 @@
|
||||||
# pi-gen
|
# pi-gen
|
||||||
|
|
||||||
_Tool used to create the raspberrypi.org Raspbian images_
|
Tool used to create Raspberry Pi OS images. (Previously known as Raspbian).
|
||||||
|
|
||||||
|
|
||||||
## Dependencies
|
## 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
|
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
|
earlier releases of these systems. On other Linux distributions it may be possible
|
||||||
to use the Docker build described below.
|
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
|
```bash
|
||||||
apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \
|
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
|
system for each build stage, amounting to tens of gigabytes in the case of
|
||||||
Raspbian.
|
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"`)
|
* `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)
|
* `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`)
|
* `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
|
- **Stage 2** - lite system. This stage produces the Raspbian-Lite image. It
|
||||||
installs some optimized memory functions, sets timezone and charmap
|
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
|
dphys-swapfile, and other basics for managing the hardware. It also
|
||||||
creates necessary groups and gives the pi user access to sudo and the
|
creates necessary groups and gives the pi user access to sudo and the
|
||||||
standard console hardware permission groups.
|
standard console hardware permission groups.
|
||||||
|
|
|
@ -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_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)
|
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}")
|
echo "Mounting BOOT_DEV..."
|
||||||
ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}")
|
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 "/boot: offset $BOOT_OFFSET, length $BOOT_LENGTH"
|
||||||
echo "/: offset $ROOT_OFFSET, length $ROOT_LENGTH"
|
echo "/: offset $ROOT_OFFSET, length $ROOT_LENGTH"
|
||||||
|
|
||||||
|
|
|
@ -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_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)
|
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}")
|
echo "Mounting BOOT_DEV..."
|
||||||
ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}")
|
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 "/boot: offset $BOOT_OFFSET, length $BOOT_LENGTH"
|
||||||
echo "/: offset $ROOT_OFFSET, length $ROOT_LENGTH"
|
echo "/: offset $ROOT_OFFSET, length $ROOT_LENGTH"
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,12 @@ network={
|
||||||
EOL
|
EOL
|
||||||
fi
|
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/"
|
mkdir -p "${ROOTFS_DIR}/var/lib/systemd/rfkill/"
|
||||||
echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan"
|
if [ -n "$WPA_COUNTRY" ]; then
|
||||||
echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan"
|
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
|
||||||
|
|
Loading…
Reference in a new issue