Add a parameter to set free space in qemu images
Avoid the need to redimension the qemu disk size.
This commit is contained in:
parent
b5699a9a4a
commit
4790ecd526
|
@ -97,6 +97,9 @@ The following environment variables are supported:
|
||||||
|
|
||||||
Change the keyboard default mapping (gb=qwerty, fr=azerty).
|
Change the keyboard default mapping (gb=qwerty, fr=azerty).
|
||||||
|
|
||||||
|
* `FREE_SPACE_MB` (Default: <int> 400)
|
||||||
|
|
||||||
|
Add a free space in the partition (value in megabyte). If Qemu image is generated it could be usefull to have a lot of free space.
|
||||||
|
|
||||||
A simple example for building Raspbian:
|
A simple example for building Raspbian:
|
||||||
|
|
||||||
|
|
1
build.sh
1
build.sh
|
@ -134,6 +134,7 @@ fi
|
||||||
|
|
||||||
export USE_QEMU="${USE_QEMU:-0}"
|
export USE_QEMU="${USE_QEMU:-0}"
|
||||||
export LAST_STAGE=${LAST_STAGE:-5}
|
export LAST_STAGE=${LAST_STAGE:-5}
|
||||||
|
export FREE_SPACE_MB=${FREE_SPACE_MB:-400}
|
||||||
export RPI_LOCALHOST=${RPI_LOCALHOST:-"raspberrypi"}
|
export RPI_LOCALHOST=${RPI_LOCALHOST:-"raspberrypi"}
|
||||||
export RPI_USERNAME=${RPI_USERNAME:-"pi"}
|
export RPI_USERNAME=${RPI_USERNAME:-"pi"}
|
||||||
export RPI_USERPASS=${RPI_USERPASS:-"raspberry"}
|
export RPI_USERPASS=${RPI_USERPASS:-"raspberry"}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
IMG_NAME="Raspbian"
|
IMG_NAME="Raspbian"
|
||||||
USE_QEMU=1
|
USE_QEMU=1
|
||||||
LAST_STAGE=5
|
LAST_STAGE=5
|
||||||
|
FREE_SPACE_MB=500
|
||||||
KEYBOARD_LANG="gb"
|
KEYBOARD_LANG="gb"
|
||||||
RPI_LOCALHOST="raspberrypi"
|
RPI_LOCALHOST="raspberrypi"
|
||||||
RPI_USERNAME="pi"
|
RPI_USERNAME="pi"
|
||||||
|
|
|
@ -16,6 +16,11 @@ ROUND_SIZE="$((4 * 1024 * 1024))"
|
||||||
ROUNDED_ROOT_SECTOR=$(((2 * BOOT_SIZE + ROUND_SIZE) / ROUND_SIZE * ROUND_SIZE / 512 + 8192))
|
ROUNDED_ROOT_SECTOR=$(((2 * 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))
|
IMG_SIZE=$(((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024) + ROUND_SIZE - 1) / ROUND_SIZE * ROUND_SIZE))
|
||||||
|
|
||||||
|
if [ "${USE_QEMU}" = "1" ]; then
|
||||||
|
log "Added ${FREE_SPACE_MB} to qemu image (${IMG_SIZE})"
|
||||||
|
IMG_SIZE=$(((BOOT_SIZE + TOTAL_SIZE + (FREE_SPACE_MB * 1024 * 1024) + ROUND_SIZE - 1) / ROUND_SIZE * ROUND_SIZE))
|
||||||
|
fi
|
||||||
|
|
||||||
truncate -s "${IMG_SIZE}" "${IMG_FILE}"
|
truncate -s "${IMG_SIZE}" "${IMG_FILE}"
|
||||||
fdisk -H 255 -S 63 "${IMG_FILE}" <<EOF
|
fdisk -H 255 -S 63 "${IMG_FILE}" <<EOF
|
||||||
o
|
o
|
||||||
|
|
|
@ -17,7 +17,7 @@ BOOT_SIZE="$(( BOOT_SIZE / 1000000 + 1))"
|
||||||
ROOT_SIZE="$(( ROOT_SIZE / 1000000 + 1))"
|
ROOT_SIZE="$(( ROOT_SIZE / 1000000 + 1))"
|
||||||
|
|
||||||
BOOT_NOM="$(( BOOT_SIZE * 3 ))"
|
BOOT_NOM="$(( BOOT_SIZE * 3 ))"
|
||||||
ROOT_NOM="$(( ROOT_SIZE + 400 ))"
|
ROOT_NOM="$(( ROOT_SIZE + 400))"
|
||||||
|
|
||||||
mv "${NOOBS_DIR}/OS.png" "${NOOBS_DIR}/${NOOBS_NAME// /_}.png"
|
mv "${NOOBS_DIR}/OS.png" "${NOOBS_DIR}/${NOOBS_NAME// /_}.png"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user