Merge branch 'master' into arm64

This commit is contained in:
Serge Schneider 2022-02-02 14:26:31 +00:00
commit 2b3ba5b2a6
5 changed files with 42 additions and 11 deletions

View file

@ -8,7 +8,7 @@ RUN apt-get -y update && \
git vim parted \ git vim parted \
quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \ quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \
libarchive-tools libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc\ libarchive-tools libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc\
binfmt-support ca-certificates qemu-utils kpartx \ binfmt-support ca-certificates qemu-utils kpartx fdisk gpg \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY . /pi-gen/ COPY . /pi-gen/

View file

@ -15,12 +15,30 @@ 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 \
dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \ dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \
qemu-utils kpartx qemu-utils kpartx gpg
``` ```
The file `depends` contains a list of tools needed. The format of this The file `depends` contains a list of tools needed. The format of this
package is `<tool>[:<debian-package>]`. package is `<tool>[:<debian-package>]`.
## Getting started with building your images
Getting started is as simple as cloning this repository on your build machine. You
can do so with:
```bash
git clone -depth 1 https://github.com/RPI-Distro/pi-gen.git
```
Using `--depth 1` with `git clone` will create a shallow clone, only containing
the latest revision of the repository. Do not do this on your development machine.
Also, be careful to clone the repository to a base path **NOT** containing spaces.
This configuration is not supported by debootstrap and will lead to `pi-gen` not
running.
After cloning the repository, you can move to the next step and start configuring
your build.
## Config ## Config
@ -328,7 +346,7 @@ maintenance and allows for more easy customization.
- **Stage 5** - The Raspbian Full image. More development - **Stage 5** - The Raspbian Full image. More development
tools, an email client, learning tools like Scratch, specialized packages tools, an email client, learning tools like Scratch, specialized packages
like sonic-pi, office productivity, etc. like sonic-pi, office productivity, etc.
### Stage specification ### Stage specification
@ -380,8 +398,8 @@ Example:
```bash ```bash
root@build-machine:~/$ lsblk | grep nbd root@build-machine:~/$ lsblk | grep nbd
nbd1 43:32 0 10G 0 disk nbd1 43:32 0 10G 0 disk
├─nbd1p1 43:33 0 10G 0 part ├─nbd1p1 43:33 0 10G 0 part
└─nbd1p1 253:0 0 10G 0 part └─nbd1p1 253:0 0 10G 0 part
root@build-machine:~/$ ps xa | grep qemu-nbd root@build-machine:~/$ ps xa | grep qemu-nbd
@ -405,7 +423,7 @@ It can happen, that your build stops in case of an error. Normally `./build.sh`
A typical message indicating that there are some orphaned device mapper entries is this: A typical message indicating that there are some orphaned device mapper entries is this:
``` ```
Failed to set NBD socket Failed to set NBD socket
Disconnect client, due to: Unexpected end-of-file before all bytes were read Disconnect client, due to: Unexpected end-of-file before all bytes were read
``` ```
@ -428,10 +446,10 @@ If that happens go through the following steps:
or or
sudo ./imagetool.sh --cleanup sudo ./imagetool.sh --cleanup
``` ```
Note: The `imagetool.sh` command will cleanup any /dev/nbdX that is not connected to a running `qemu-nbd` daemon. Be careful if you use network block devices for other tasks utilizing NBDs on your build machine as well. Note: The `imagetool.sh` command will cleanup any /dev/nbdX that is not connected to a running `qemu-nbd` daemon. Be careful if you use network block devices for other tasks utilizing NBDs on your build machine as well.
Now you should be able to start a new build without running into troubles again. Most of the time, especially when using Docker build, you will only need no. 3 to get everything up and running again. Now you should be able to start a new build without running into troubles again. Most of the time, especially when using Docker build, you will only need no. 3 to get everything up and running again.
# Troubleshooting # Troubleshooting

View file

@ -48,7 +48,7 @@ fi
CONTAINER_NAME=${CONTAINER_NAME:-pigen_work} CONTAINER_NAME=${CONTAINER_NAME:-pigen_work}
CONTINUE=${CONTINUE:-0} CONTINUE=${CONTINUE:-0}
PRESERVE_CONTAINER=${PRESERVE_CONTAINER:-0} PRESERVE_CONTAINER=${PRESERVE_CONTAINER:-0}
PIGEN_DOCKER_OPTS=${PIGEN_DOCKER_OPTS:-""} PIGEN_DOCKER_OPTS=${PIGEN_DOCKER_OPTS:-""}
if [ -z "${IMG_NAME}" ]; then if [ -z "${IMG_NAME}" ]; then
echo "IMG_NAME not set in 'config'" 1>&2 echo "IMG_NAME not set in 'config'" 1>&2
@ -98,6 +98,8 @@ if [ "${CONTAINER_EXISTS}" != "" ]; then
--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \ --volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
pi-gen \ pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
# binfmt_misc is sometimes not mounted with debian bullseye image
(mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc || true) &&
cd /pi-gen; ./build.sh ${BUILD_OPTS} && cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
rsync -av work/*/build.log deploy/" & rsync -av work/*/build.log deploy/" &
wait "$!" wait "$!"
@ -112,6 +114,8 @@ else
-e "GIT_HASH=${GIT_HASH}" \ -e "GIT_HASH=${GIT_HASH}" \
pi-gen \ pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
# binfmt_misc is sometimes not mounted with debian bullseye image
(mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc || true) &&
cd /pi-gen; ./build.sh ${BUILD_OPTS} && cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
rsync -av work/*/build.log deploy/" & rsync -av work/*/build.log deploy/" &
wait "$!" wait "$!"

View file

@ -133,7 +133,7 @@ run_stage(){
done done
fi fi
if [ "${USE_QCOW2}" = "1" ]; then if [ "${USE_QCOW2}" = "1" ]; then
unload_qimage unload_qimage
else else
# make sure we are not umounting during export-image stage # make sure we are not umounting during export-image stage
@ -155,6 +155,14 @@ if [ "$(id -u)" != "0" ]; then
fi fi
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ $BASE_DIR = *" "* ]]; then
echo "There is a space in the base path of pi-gen"
echo "This is not a valid setup supported by debootstrap."
echo "Please remove the spaces, or move pi-gen directory to a base path without spaces" 1>&2
exit 1
fi
export BASE_DIR export BASE_DIR
if [ -f config ]; then if [ -f config ]; then
@ -369,7 +377,7 @@ for EXPORT_DIR in ${EXPORT_DIRS}; do
else else
run_stage run_stage
fi fi
if [ "${USE_QEMU}" != "1" ]; then if [ "${USE_QEMU}" != "1" ]; then
if [ -e "${EXPORT_DIR}/EXPORT_NOOBS" ]; then if [ -e "${EXPORT_DIR}/EXPORT_NOOBS" ]; then
# shellcheck source=/dev/null # shellcheck source=/dev/null

View file

@ -19,3 +19,4 @@ lsmod:kmod
bc bc
qemu-nbd:qemu-utils qemu-nbd:qemu-utils
kpartx kpartx
gpg