fonctionnalisation - troisieme etape (finale?)
Fin de la fonctionnalisation
This commit is contained in:
parent
897eeff870
commit
ee3e2a2a3d
@ -363,7 +363,7 @@ function createImageWrap()
|
||||
title "Wrap image creation"
|
||||
preImgCreation
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error in the process ${CONFIG_PATH}/createImage.sh ."
|
||||
error "line ${LINENO} error in the process ${CONFIG_PATH}/specialFunctions.sh ."
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
createimage
|
||||
@ -396,21 +396,11 @@ createimage()
|
||||
fi
|
||||
DEVICE=$(/sbin/losetup -f --show "${INSTALL_PATH}/${IMAGE}")
|
||||
|
||||
### TODO : Functionnalize
|
||||
|
||||
if [ ${TARGET} = "odroid" ]; then
|
||||
info "installing blobs"
|
||||
pushd "${CONFIG_PATH}/sd_fuse"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error directory ${CONFIG_PATH}/sd_fuse does not exists : exiting"
|
||||
exit ${ERR_1}
|
||||
else
|
||||
./sd_fusing.sh "${DEVICE}"
|
||||
fi
|
||||
pushd
|
||||
bunrningBootloader
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error in the process ${CONFIG_PATH}/specialFunctions.sh ."
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
|
||||
###
|
||||
|
||||
info "making partitions"
|
||||
echo -e "${FDISK_SCRIPT}" | /sbin/fdisk ${DEVICE}
|
||||
@ -482,10 +472,12 @@ copyingsystem()
|
||||
|
||||
info "making /etc/fstab"
|
||||
### BUG : /mnt/arm_boot is set to vfat for all plateforms, odroid configuration says ext4.
|
||||
echo -e "proc /proc proc defaults 0 0\nUUID=${BOOT_UUID} /mnt/arm_boot vfat defaults 0 0\nUUID=${ROOT_UUID} / ext4 defaults 0 0" > "${BUILD_PATH}/etc/fstab"
|
||||
#echo -e "proc /proc proc defaults 0 0\nUUID=${BOOT_UUID} /mnt/arm_boot vfat defaults 0 0\nUUID=${ROOT_UUID} / ext4 defaults 0 0" > "${BUILD_PATH}/etc/fstab"
|
||||
echo -e "proc\t/proc\tproc\tdefaults\t0\t0\nUUID=${BOOT_UUID}\t/mnt/arm_boot\t${BOOTFS}\tdefaults\t0\t0\nUUID=${ROOT_UUID}\t/\text4\tdefaults\t0\t0" > "${BUILD_PATH}/etc/fstab"
|
||||
|
||||
if [ ! -d "${BUILD_PATH}/boot/extlinux" ]; then
|
||||
info "making /boot/extlinux/extlinux.conf"
|
||||
rm -rf "${BUILD_PATH}/boot/extlinux"
|
||||
mkdir -p "${BUILD_PATH}/boot/extlinux"
|
||||
fi
|
||||
if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then
|
||||
@ -494,100 +486,12 @@ copyingsystem()
|
||||
sed -i -e s/\<FDTDIR\>/${KERNEL_ID}/g "${BUILD_PATH}/boot/extlinux/extlinux.conf"
|
||||
fi
|
||||
|
||||
### TODO : Functionnalize
|
||||
|
||||
case ${TARGET} in
|
||||
"rpi")
|
||||
info "copying 10-vchiq-permissions.rules"
|
||||
cp --preserve=mode "${CONFIG_PATH}/10-vchiq-permissions.rules" "${BUILD_PATH}/etc/udev/rules.d/"
|
||||
info "Making /etc/modules"
|
||||
echo -e "vchiq\nsnd_bcm2835\nvc4\nbrcmfmac" >> "${BUILD_PATH}"/etc/modules
|
||||
|
||||
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
|
||||
if ! [ -d "${ARM_BOOT}" ]; then
|
||||
mkdir -p "${ARM_BOOT}"
|
||||
fi
|
||||
info "copying modprobe.conf"
|
||||
/usr/bin/cp -v --preserve=mode "${CONFIG_PATH}/modprobe.conf" "${BUILD_PATH}/etc/"
|
||||
chown root:root "${BUILD_PATH}/etc/modprobe.conf"
|
||||
|
||||
info "copying firmware, overlays in rpi boot partition"
|
||||
# cp -v --preserve=mode "${BUILD_PATH}/usr/lib/linux-"* "${BOOT}/dtb"
|
||||
cp -v --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/start"* "${ARM_BOOT}/"
|
||||
cp -v --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/fixup"* "${ARM_BOOT}/"
|
||||
cp -v --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/bootcode.bin"* "${ARM_BOOT}/"
|
||||
cp -vR --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/overlays" "${ARM_BOOT}/"
|
||||
|
||||
info "copying u-boot binary to ${ARM_BOOT}"
|
||||
case ${TARGET_VERSION} in
|
||||
"0")
|
||||
info "copying u-boot for ${TARGET} 0"
|
||||
cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_0_w/u-boot.bin" "${ARM_BOOT}/kernel.img"
|
||||
;;
|
||||
"1")
|
||||
info "copying u-boot for ${TARGET} 1"
|
||||
cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi/u-boot.bin" "${ARM_BOOT}/kernel.img"
|
||||
;;
|
||||
"2")
|
||||
info "copying u-boot for ${TARGET} 2"
|
||||
cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_2/u-boot.bin" "${ARM_BOOT}/kernel.img"
|
||||
;;
|
||||
"3_32")
|
||||
info "copying u-boot for ${TARGET} 3 32 bits"
|
||||
cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "${ARM_BOOT}/kernel.img"
|
||||
;;
|
||||
"3+")
|
||||
info "copying u-boot for ${TARGET} 3b+ 32 bits"
|
||||
cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "${ARM_BOOT}/kernel.img"
|
||||
;;
|
||||
esac
|
||||
|
||||
# info "copying raspberry optionals files in opt"
|
||||
# /bin/rsync -rlptDH "${FIRMWARE_PATH}/${FIRMWARE_DIR}/opt/" "${BUILD_PATH}/opt/"
|
||||
|
||||
info "copying wifi firmware file missing in kernel-firmware-nonfree"
|
||||
if ! [ -d "${ROOT}/usr/lib/firmware/brcm/" ]; then
|
||||
/bin/mkdir -p "${ROOT}/usr/lib/firmware/brcm/"
|
||||
fi
|
||||
if ! [ -f "${ROOT}/usr/lib/firmware/brcm/brcmfmac434"* ]; then
|
||||
/bin/cp --preserve=mode "${CONFIG_PATH}/brcmfmac434"* "${ROOT}/usr/lib/firmware/brcm/"
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error copying wifi firmware in ${ROOTP}/usr/lib/firmware/brcm/ : exiting"
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
fi
|
||||
|
||||
info "copying Mageia image to root partition"
|
||||
/bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
||||
/bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/"
|
||||
;;
|
||||
|
||||
"odroid")
|
||||
ODROID_BOOT="${BUILD_PATH}/mnt/odroid_boot"
|
||||
if ! [ -d "${ODROID_BOOT}" ]; then
|
||||
mkdir -p "${ODROID_BOOT}"
|
||||
fi
|
||||
case ${TARGET_VERSION} in
|
||||
"xu4")
|
||||
info "copying u-boot for ${TARGET} ${TARGET_VERSION}"
|
||||
cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/${TARGET}-${TARGET_VERSION}/u-boot.bin" "${ARM_BOOT}/"
|
||||
;;
|
||||
esac
|
||||
# temporary code waiting inclusion of xu4 in Mageia kernel and u-boot
|
||||
|
||||
info "Copying extlinux.conf on ${ODROID_BOOT}"
|
||||
cp --preserve=mode -R "${BUILD_PATH}/boot/extlinux" "${ODROID_BOOT}/"
|
||||
info "copying Mageia image to root partition"
|
||||
/bin/rsync -rlptogDH --exclude "${ODROID_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
||||
/bin/rsync -rlptogDH "${ODROID_BOOT}/" "${BOOT}/"
|
||||
;;
|
||||
|
||||
"bananaPro")
|
||||
#TODO
|
||||
;;
|
||||
esac
|
||||
|
||||
### END TODO
|
||||
copyingCustomSystem
|
||||
if [ ${?} -ne 0 ]; then
|
||||
error "line ${LINENO} error in the process ${CONFIG_PATH}/specialFunctions.sh ."
|
||||
exit ${ERR_1}
|
||||
fi
|
||||
|
||||
# info "copying tools in /usr/local/bin/"
|
||||
# /bin/cp -v --preserve=mode "${SOURCE_PATH}/tools/" "${BUILD_PATH}/usr/local/bin/"
|
||||
@ -637,10 +541,24 @@ function preImgCreation()
|
||||
|
||||
function postPrepareChroot()
|
||||
{
|
||||
error "This function is called if no sourced file contain postPrepareChroot function."
|
||||
error "This function is called if no sourced file is containing postPrepareChroot function."
|
||||
return 1
|
||||
}
|
||||
|
||||
function bunrningBootloader()
|
||||
{
|
||||
error "This function is called if no sourced file is containing bunrningBootloader function."
|
||||
return 1
|
||||
}
|
||||
|
||||
function copyingCustomSystem()
|
||||
{
|
||||
error "This function is called if no sourced file is containing bunrningBootloader function."
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
ERRORN=0
|
||||
ERR_1=1
|
||||
ERR_DEFAULT_CONFIG=2
|
||||
@ -667,17 +585,6 @@ PLATFORMS_PATH="${SOURCE_PATH}/platforms"
|
||||
|
||||
CMDNAME=$(/bin/basename "${0}")
|
||||
|
||||
#while read -r;do
|
||||
# for MAGEIA_VERSION in $REPLY
|
||||
# do
|
||||
# if [ $MAGEIA_VERSION <= 5 ]; then
|
||||
# echo 'Mageia version >= 6 is needed'
|
||||
# exit
|
||||
# fi
|
||||
# break
|
||||
# done
|
||||
#done < /etc/version
|
||||
|
||||
|
||||
if [ ${#} == 0 ]; then
|
||||
help
|
||||
@ -812,9 +719,6 @@ else
|
||||
exit ${ERR_DEFAULT_CONFIG}
|
||||
fi
|
||||
fi
|
||||
# else # What are this "else fi" related to ?
|
||||
#
|
||||
# fi
|
||||
|
||||
if ! [ -z "${IMAGE_SIZE_P}" ]; then
|
||||
IMAGE_SIZE=${IMAGE_SIZE_P}
|
||||
@ -846,26 +750,6 @@ ROOT="/mnt/root"
|
||||
BUILD_PATH="${INSTALL_PATH}/build"
|
||||
ARM_VERSION="armv7hl"
|
||||
|
||||
# assign function for building image of TARGET ( rpi, odroid )
|
||||
# case ${TARGET} in #NOTE2 : Why isn't it inside the sourced file ? Inside the .cfg ? It will make the code more flexible.
|
||||
# "bananaPro")
|
||||
# CREATEIMG="createbproimage"
|
||||
# ;;
|
||||
#
|
||||
# "odroid")
|
||||
# CREATEIMG="createxu3image"
|
||||
# ;;
|
||||
#
|
||||
# "rpi")
|
||||
# CREATEIMG="createrpiimage"
|
||||
# ;;
|
||||
#
|
||||
# *)
|
||||
# error "No Target : ${TARGET}"
|
||||
# exit ${ERR_1}
|
||||
# ;;
|
||||
# esac
|
||||
|
||||
# Assigne a script for creating a particular target image (rpi, odroid, ...)
|
||||
if [ -e "${CONFIG_PATH}/specialFunctions.sh" ]; then
|
||||
source "${CONFIG_PATH}/specialFunctions.sh"
|
||||
@ -907,7 +791,7 @@ if [ -z ${OPT} ]; then
|
||||
OPT="--help"
|
||||
fi
|
||||
|
||||
info "Image size is: ${IMAGE_SIZE} Go"
|
||||
info "Image size is: ${IMAGE_SIZE} GB"
|
||||
|
||||
case ${OPT} in
|
||||
"clean")
|
||||
@ -928,7 +812,6 @@ case ${OPT} in
|
||||
installbasesystem
|
||||
preparechroot
|
||||
jumpchroot
|
||||
# ${CREATEIMG}
|
||||
createImageWrap
|
||||
;;
|
||||
"createchroot")
|
||||
@ -949,7 +832,6 @@ case ${OPT} in
|
||||
warning "Not enough space on disk"
|
||||
exit ${ERR_NO_SPACE}
|
||||
fi
|
||||
# ${CREATEIMG}
|
||||
createImageWrap
|
||||
;;
|
||||
"installbasesystem")
|
||||
|
Reference in New Issue
Block a user