added u-boot installation
This commit is contained in:
parent
1e5184088c
commit
063d1b056e
@ -75,9 +75,10 @@ function help()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# cleaning
|
# cleaning build space
|
||||||
function clean()
|
function clean()
|
||||||
{
|
{
|
||||||
|
# Unmounting /dev /proc /sys in chroot
|
||||||
title "Cleaning"
|
title "Cleaning"
|
||||||
if ! [ -z "$(mountpoint -qd "$BUILD_PATH/dev")" ];then
|
if ! [ -z "$(mountpoint -qd "$BUILD_PATH/dev")" ];then
|
||||||
info "Unmounting $BUILD_PATH/dev"
|
info "Unmounting $BUILD_PATH/dev"
|
||||||
@ -103,18 +104,21 @@ function clean()
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Removing old Build directory
|
||||||
if [ -d "$BUILD_PATH" ];then
|
if [ -d "$BUILD_PATH" ];then
|
||||||
info "Removing $BUILD_PATH"
|
info "Removing $BUILD_PATH"
|
||||||
/bin/rm -Rf "$BUILD_PATH"
|
/bin/rm -Rf "$BUILD_PATH"
|
||||||
else
|
else
|
||||||
warning "$BUILD_PATH does not exists"
|
warning "$BUILD_PATH does not exists"
|
||||||
fi
|
fi
|
||||||
|
# removing old image
|
||||||
if [ -e "$IMAGE" ];then
|
if [ -e "$IMAGE" ];then
|
||||||
info "Removing $IMAGE"
|
info "Removing $IMAGE"
|
||||||
/bin/rm -f "$INSTALL_PATH/$IMAGE"
|
/bin/rm -f "$INSTALL_PATH/$IMAGE"
|
||||||
else
|
else
|
||||||
warning "$IMAGE does not exists"
|
warning "$IMAGE does not exists"
|
||||||
fi
|
fi
|
||||||
|
# removing loop devices
|
||||||
for LOOP in $(ls /dev/loop*[0-9]p1)
|
for LOOP in $(ls /dev/loop*[0-9]p1)
|
||||||
do
|
do
|
||||||
X=${LOOP:0:10}
|
X=${LOOP:0:10}
|
||||||
@ -123,6 +127,7 @@ function clean()
|
|||||||
partx -d "$X"
|
partx -d "$X"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
# Removing boot and root directory
|
||||||
if [ -d "$BOOT" ];then
|
if [ -d "$BOOT" ];then
|
||||||
info "Removing $BOOT"
|
info "Removing $BOOT"
|
||||||
/bin/rmdir "$BOOT"
|
/bin/rmdir "$BOOT"
|
||||||
@ -140,7 +145,6 @@ function clean()
|
|||||||
|
|
||||||
# creation of install path and copy of qemu ( installing it if not yet installed )
|
# creation of install path and copy of qemu ( installing it if not yet installed )
|
||||||
|
|
||||||
|
|
||||||
function createchroot()
|
function createchroot()
|
||||||
{
|
{
|
||||||
title "Making chroot"
|
title "Making chroot"
|
||||||
@ -152,6 +156,7 @@ function createchroot()
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Starting qemu service if not started
|
||||||
/bin/systemctl is-active systemd-binfmt.service
|
/bin/systemctl is-active systemd-binfmt.service
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
title "Starting systemd-binfmt.service"
|
title "Starting systemd-binfmt.service"
|
||||||
@ -162,7 +167,7 @@ function createchroot()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create Build path
|
||||||
if ! [ -d "$BUILD_PATH" ];then
|
if ! [ -d "$BUILD_PATH" ];then
|
||||||
warning "Build path does not exists, do you want i create it ? [Y|n] "
|
warning "Build path does not exists, do you want i create it ? [Y|n] "
|
||||||
read yn
|
read yn
|
||||||
@ -176,6 +181,9 @@ function createchroot()
|
|||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
info "Build path exists"
|
||||||
|
fi
|
||||||
|
#Copying qemu
|
||||||
/bin/cp /bin/qemu-arm-static "$BUILD_PATH/usr/bin/"
|
/bin/cp /bin/qemu-arm-static "$BUILD_PATH/usr/bin/"
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ];then
|
||||||
error "line $LINENO can't copy /bin/qemu-user-static to $BUILD_PATH/usr/bin/ : exiting"
|
error "line $LINENO can't copy /bin/qemu-user-static to $BUILD_PATH/usr/bin/ : exiting"
|
||||||
@ -188,6 +196,7 @@ function createchroot()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# adding Mageia repositories
|
||||||
function addmedia()
|
function addmedia()
|
||||||
{
|
{
|
||||||
title "Creating media $MIRROR"
|
title "Creating media $MIRROR"
|
||||||
@ -229,7 +238,7 @@ function installbasesystem()
|
|||||||
# error "line $LINENO error installing basesystem-minimal : exiting"
|
# error "line $LINENO error installing basesystem-minimal : exiting"
|
||||||
# exit 1
|
# exit 1
|
||||||
#fi
|
#fi
|
||||||
/sbin/urpmi --urpmi-root "$BUILD_PATH" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200 urpmi locales-fr systemd
|
/sbin/urpmi --urpmi-root "$BUILD_PATH" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200 urpmi locales-fr systemd u-boot
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ];then
|
||||||
error "line $LINENO error installing urpmi or locales.fr : exiting"
|
error "line $LINENO error installing urpmi or locales.fr : exiting"
|
||||||
exit 1
|
exit 1
|
||||||
@ -289,7 +298,6 @@ EOF" >>"$BUILD_PATH/second_stage_install.sh"
|
|||||||
info "Copying skel in root directory"
|
info "Copying skel in root directory"
|
||||||
/bin/rsync -a /etc/skel/ "$BUILD_PATH/root/"
|
/bin/rsync -a /etc/skel/ "$BUILD_PATH/root/"
|
||||||
|
|
||||||
#configuration for target
|
|
||||||
|
|
||||||
case $TARGET in
|
case $TARGET in
|
||||||
xu3|xu4)
|
xu3|xu4)
|
||||||
@ -428,6 +436,7 @@ p
|
|||||||
w
|
w
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Activate loop device
|
||||||
/sbin/losetup -d "$DEVICE"
|
/sbin/losetup -d "$DEVICE"
|
||||||
DEVICE=$(/sbin/partx -va "$INSTALL_PATH/$IMAGE" | /bin/grep -m 1 -E -o '/dev/loop.?')
|
DEVICE=$(/sbin/partx -va "$INSTALL_PATH/$IMAGE" | /bin/grep -m 1 -E -o '/dev/loop.?')
|
||||||
info "device $DEVICE"
|
info "device $DEVICE"
|
||||||
@ -497,16 +506,17 @@ UUID=$ROOT_UUID / ext4 defaults 0 0" > "$BUILD_PA
|
|||||||
case $TARGET in
|
case $TARGET in
|
||||||
rpi)
|
rpi)
|
||||||
# info "copying raspberry firmware in /boot"
|
# info "copying raspberry firmware in /boot"
|
||||||
# /bin/rsync -rlptDH "$FIRMWARE_PATH/firmware-stable/boot/" "$BOOT"
|
# /bin/rsync -rlptDH "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/" "$BOOT"
|
||||||
#TODO copy to bootstrap /boot
|
#TODO copy to bootstrap /boot
|
||||||
cp -a "$FIRMWARE_PATH/firmware-stable/boot/start*" "$BOOT"
|
cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/start*" "$BOOT"
|
||||||
cp -a "$FIRMWARE_PATH/firmware-stable/boot/fixup*" "$BOOT"
|
cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/fixup*" "$BOOT"
|
||||||
cp -a "$FIRMWARE_PATH/firmware-stable/extra/uname_string" "$BOOT"
|
#cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/extra/uname_string" "$BOOT"
|
||||||
cp -a "$FIRMWARE_PATH/firmware-stable/extra/uname_string7" "$BOOT"
|
#cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/extra/uname_string7" "$BOOT"
|
||||||
info "copying config.txt, boot.cmd and 10-vchiq-permissions.rules"
|
info "copying config.txt, boot.cmd and 10-vchiq-permissions.rules"
|
||||||
cp "$SOURCE_PATH/$CONFIG_PATH/config.txt" "$BOOT"
|
cp "$SOURCE_PATH/$CONFIG_PATH/config.txt" "$BOOT"
|
||||||
cp "$SOURCE_PATH/$CONFIG_PATH/boot.cmd" "$BOOT"
|
cp "$SOURCE_PATH/$CONFIG_PATH/boot.cmd" "$BOOT"
|
||||||
cp "$SOURCE_PATH/$CONFIG_PATH/10-vchiq-permissions.rules" "$BUILD_PATH/etc/udev/rules.d/"
|
cp "$SOURCE_PATH/$CONFIG_PATH/10-vchiq-permissions.rules" "$BUILD_PATH/etc/udev/rules.d/"
|
||||||
|
# Making /etc/modules
|
||||||
echo "vchiq
|
echo "vchiq
|
||||||
snd_bcm2835
|
snd_bcm2835
|
||||||
vc4
|
vc4
|
||||||
@ -516,15 +526,17 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
|
|||||||
/bin/cp -a "$SOURCE_PATH/$CONFIG_PATH/modprobe.conf" "$BUILD_PATH/etc/"
|
/bin/cp -a "$SOURCE_PATH/$CONFIG_PATH/modprobe.conf" "$BUILD_PATH/etc/"
|
||||||
chown root:root "$BUILD_PATH/etc/modprobe.conf"
|
chown root:root "$BUILD_PATH/etc/modprobe.conf"
|
||||||
|
|
||||||
info "making /boot/cmdline.txt"
|
#info "making /boot/cmdline.txt"
|
||||||
echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait fsck.repair=1" > "$BOOT/cmdline.txt"
|
#echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait fsck.repair=1" > "$BOOT/cmdline.txt"
|
||||||
# info "copying raspberry modules in /lib/modules"
|
# info "copying raspberry modules in /lib/modules"
|
||||||
# /bin/rsync -rlptDH "$FIRMWARE_PATH/firmware-stable/modules/" "$BUILD_PATH/lib/modules/"
|
# /bin/rsync -rlptDH "$FIRMWARE_PATH/$FIRMWARE_DIR/modules/" "$BUILD_PATH/lib/modules/"
|
||||||
# info "copying raspberry optionals files in opt"
|
# info "copying raspberry optionals files in opt"
|
||||||
# /bin/rsync -rlptDH "$FIRMWARE_PATH/firmware-stable/opt/" "$BUILD_PATH/opt/"
|
# /bin/rsync -rlptDH "$FIRMWARE_PATH/$FIRMWARE_DIR/opt/" "$BUILD_PATH/opt/"
|
||||||
|
|
||||||
info "copying wifi firmware file missing in Mageia"
|
info "copying wifi firmware file missing in kernel-firmware-nonfree"
|
||||||
/bin/mkdir -p "$ROOT/usr/lib/firmware/brcm/"
|
if ! [ -d "$ROOT/usr/lib/firmware/brcm/" ];then
|
||||||
|
/bin/mkdir -p "$ROOT/usr/lib/firmware/brcm/"
|
||||||
|
fi
|
||||||
/bin/cp "$SOURCE_PATH/$CONFIG_PATH/brcmfmac43430-sdio.txt" "$ROOT/usr/lib/firmware/brcm/"
|
/bin/cp "$SOURCE_PATH/$CONFIG_PATH/brcmfmac43430-sdio.txt" "$ROOT/usr/lib/firmware/brcm/"
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ];then
|
||||||
error "line $LINENO error copying wifi firmware in $ROOTP/usr/lib/firmware/brcm/ : exiting"
|
error "line $LINENO error copying wifi firmware in $ROOTP/usr/lib/firmware/brcm/ : exiting"
|
||||||
@ -548,6 +560,7 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
|
|||||||
/bin/mkdir "$ROOT/boot"
|
/bin/mkdir "$ROOT/boot"
|
||||||
|
|
||||||
copyingcommon
|
copyingcommon
|
||||||
|
# Syncing devices before unmounting
|
||||||
/usr/bin/sync
|
/usr/bin/sync
|
||||||
/usr/bin/umount "$BOOT" "$ROOT"
|
/usr/bin/umount "$BOOT" "$ROOT"
|
||||||
if [ $? -eq 0 ];then
|
if [ $? -eq 0 ];then
|
||||||
@ -679,7 +692,7 @@ ARM_VERSION="armv7hl"
|
|||||||
|
|
||||||
# path of config file
|
# path of config file
|
||||||
if ! [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then
|
if ! [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then
|
||||||
info " Config path do not exists, defaulting to ./$TARGET"
|
info " Config path does not exists, defaulting to ./$TARGET"
|
||||||
CONFIG_PATH="$SOURCE_PATH/$TARGET"
|
CONFIG_PATH="$SOURCE_PATH/$TARGET"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -707,7 +720,7 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# assign TARGET ( rpi, xu3 or xu4 )
|
# assign function for building image of TARGET ( rpi, xu3 or xu4 )
|
||||||
case $TARGET in
|
case $TARGET in
|
||||||
xu3|xu4)
|
xu3|xu4)
|
||||||
CREATEIMG="createxu3image"
|
CREATEIMG="createxu3image"
|
||||||
@ -729,11 +742,12 @@ info "Commande : $CMDNAME"
|
|||||||
info "Firmware path : $FIRMWARE_PATH"
|
info "Firmware path : $FIRMWARE_PATH"
|
||||||
info "Firmware dir : $FIRMWARE_DIR"
|
info "Firmware dir : $FIRMWARE_DIR"
|
||||||
|
|
||||||
|
# Defining default image size to 7 go
|
||||||
if [[ "$IMAGE_SIZE" -lt 7 ]] || [[ "$IMAGE_SIZE" -gt 128 ]];then
|
if [[ "$IMAGE_SIZE" -lt 7 ]] || [[ "$IMAGE_SIZE" -gt 128 ]];then
|
||||||
IMAGE_SIZE=7
|
IMAGE_SIZE=7
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# change dir to install path and create it if not existing
|
||||||
if [ "$OPT" != "clean" ];then
|
if [ "$OPT" != "clean" ];then
|
||||||
info "cd $INSTALL_PATH"
|
info "cd $INSTALL_PATH"
|
||||||
if ! [ -e "$INSTALL_PATH" ];then
|
if ! [ -e "$INSTALL_PATH" ];then
|
||||||
@ -750,14 +764,11 @@ if [ "$OPT" != "clean" ];then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#if no parameters then display help message
|
||||||
if [ -z $OPT ];then
|
if [ -z $OPT ];then
|
||||||
OPT="--help"
|
OPT="--help"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
info "Image size is: $IMAGE_SIZE Go"
|
info "Image size is: $IMAGE_SIZE Go"
|
||||||
|
|
||||||
case $OPT in
|
case $OPT in
|
||||||
@ -805,6 +816,7 @@ case $OPT in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
if ! [ -z $ERRORN ];then
|
if ! [ -z $ERRORN ];then
|
||||||
warning "Some errors occurs : $ERRORN errors"
|
warning "Some errors occurs : $ERRORN errors"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user