diff --git a/README.md b/README.md index cdadb577..b4b889cf 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,11 @@ Specifies the chroot environment to be used instead of creating a new one. Note, that the parameter conflicts with `CREATE_ONLY_CHROOT`. +##### BOOT_DIR="" + +Specifies the source directory for the boot partition. Pieman ignores the boot section of pieman.yml if `BOOT_DIR` is specified. +Please note, this parameter is suitable for FAT boot partitions only. + ##### PROJECT_NAME="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" Each image is built in in the context of some project. The parameter allows specifying the project name. By default, the name is a randomly generated UUID 32-character string. diff --git a/bootstrap/14-boot-partition.sh b/bootstrap/14-boot-partition.sh index bc6ce9ba..d4aa3d65 100644 --- a/bootstrap/14-boot-partition.sh +++ b/bootstrap/14-boot-partition.sh @@ -20,31 +20,47 @@ check_if_variable_is_set SOURCE_DIR -# Get the files, which must present on the boot partition, from different -# sources and put them in the directory specified via BOOT. -boot="`get_attr ${OS} boot`" -for f in ${boot}; do - if [ ! -z `echo ${f} | egrep "^https://|^http://|^ftp://"` ]; then - info "downloading ${f} to ${BOOT}" - wget -q -O ${BOOT}/`basename ${f}` ${f} - elif [[ ${f:0:1} == "/" ]]; then - # Split the name of the target file or directory into two parts: - # original name and copy name. - IFS=':' read -ra FILE_NAMES <<< "${R}/${f}" - - info "copying ${FILE_NAMES[0]} to ${BOOT}" - - if [ -z ${FILE_NAMES[1]} ]; then - # If the name of the copy is not specified, use the original one. - cp -r ${FILE_NAMES[0]} ${BOOT} +if [ ! -z ${BOOT_DIR} ] && [ -d ${BOOT_DIR} ]; then + info "using ${BOOT_DIR} as a source for the boot partition." + cp -r --preserve "${BOOT_DIR}"/. ${BOOT} +else + # Get the files, which must present on the boot partition, from different + # sources and put them in the directory specified via BOOT. + boot="`get_attr ${OS} boot`" + for f in ${boot}; do + if [ ! -z `echo ${f} | egrep "^https://|^http://|^ftp://"` ]; then + info "downloading ${f} to ${BOOT}" + wget -q -O ${BOOT}/`basename ${f}` ${f} + elif [[ ${f:0:1} == "/" ]]; then + # Split the name of the target file or directory into two parts: + # original name and copy name. + IFS=':' read -ra FILE_NAMES <<< "${R}/${f}" + + info "copying ${FILE_NAMES[0]} to ${BOOT}" + + if [ -z ${FILE_NAMES[1]} ]; then + # If the name of the copy is not specified, use the original one. + cp -r ${FILE_NAMES[0]} ${BOOT} + else + info "`basename ${FILE_NAMES[0]}` was renamed into ${FILE_NAMES[1]}" + cp -r ${FILE_NAMES[0]} ${BOOT}/${FILE_NAMES[1]} + fi else - info "`basename ${FILE_NAMES[0]}` was renamed into ${FILE_NAMES[1]}" - cp -r ${FILE_NAMES[0]} ${BOOT}/${FILE_NAMES[1]} + info "copying `dirname ${YML_FILE}`/${f} to ${BOOT}" + cp ${SOURCE_DIR}/${f} ${BOOT} + fi + done + + if [ "${BUILD_TYPE}" = "${IMAGE_CLASSIC}" ]; then + if [[ "${DEVICE}" == "opi-pc-plus" ]]; then + "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}"/mkimage -C none -A arm -T script -d "${PIEMAN_DIR}"/files/opi/boot-pc-plus.cmd "${BOOT}"/boot.scr + fi + + if [[ "${DEVICE}" == "opi-zero" ]]; then + "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}"/mkimage -C none -A arm -T script -d "${PIEMAN_DIR}"/files/opi/boot-zero.cmd "${BOOT}"/boot.scr fi - else - info "copying `dirname ${YML_FILE}`/${f} to ${BOOT}" - cp ${SOURCE_DIR}/${f} ${BOOT} fi -done + +fi send_request_to_bsc_server PREPARED_BOOT_PARTITION_CODE diff --git a/pieman.sh b/pieman.sh index 8f06e396..df96a4e2 100755 --- a/pieman.sh +++ b/pieman.sh @@ -41,6 +41,8 @@ def_bool_var ALLOW_UNAUTHENTICATED false def_var BASE_DIR "" +def_var BOOT_DIR "" + def_var BUILD_DIR "build" def_bool_var COMPRESS_WITH_BZIP2 false @@ -323,15 +325,7 @@ case "${BUILD_TYPE}" in mount "${LOOP_DEV}p1" "${MOUNT_POINT}" - if [[ "${DEVICE}" == "opi-pc-plus" ]]; then - "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}"/mkimage -C none -A arm -T script -d "${PIEMAN_DIR}"/files/opi/boot-pc-plus.cmd "${BOOT}"/boot.scr - fi - - if [[ "${DEVICE}" == "opi-zero" ]]; then - "${TOOLSET_FULL_PATH}/uboot-${UBOOT_VER}"/mkimage -C none -A arm -T script -d "${PIEMAN_DIR}"/files/opi/boot-zero.cmd "${BOOT}"/boot.scr - fi - - rsync -a "${BOOT}"/ "${MOUNT_POINT}" + rsync -a --no-o --no-g "${BOOT}"/ "${MOUNT_POINT}" umount "${MOUNT_POINT}"