1
0

added u-boot installation

This commit is contained in:
Daniel Tartavel 2018-12-07 20:38:32 +01:00
parent 1e5184088c
commit 063d1b056e

View File

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