1
0

Added raspberry pi bootstrap in /boot

This commit is contained in:
Daniel Tartavel 2018-10-14 21:08:55 +02:00
parent 4796b8a6a7
commit 1e5184088c
3 changed files with 29 additions and 15 deletions

View File

@ -59,6 +59,7 @@ function help()
echo "$CMDNAME [option] [size of image in Go]" echo "$CMDNAME [option] [size of image in Go]"
echo "Options:" echo "Options:"
echo "--all create ready to burn image of Mageia $MAGEIA_VERSION" echo "--all create ready to burn image of Mageia $MAGEIA_VERSION"
echo "--clean Clean all (suppress all) to make a new image"
echo "--size size of image default: 7Go" echo "--size size of image default: 7Go"
echo "--create-chroot Create the chroot directory" echo "--create-chroot Create the chroot directory"
echo "--addmedia add mirrors" echo "--addmedia add mirrors"
@ -67,7 +68,7 @@ function help()
echo "--chroot chroot to arm directory and launch packages installation" echo "--chroot chroot to arm directory and launch packages installation"
echo "--create-image Create the image of Mageia $MAGEIA_VERSION" echo "--create-image Create the image of Mageia $MAGEIA_VERSION"
echo "--build-path Path to the build directory of the image of Mageia $MAGEIA_VERSION" echo "--build-path Path to the build directory of the image of Mageia $MAGEIA_VERSION"
echo "--target target system (for now rpi, xu3, xu4)" # echo "--target target system (for now rpi, xu3, xu4)"
echo "--config Path to config files" echo "--config Path to config files"
echo "--bootfs filesystem of boot partition (ext4 or vfat) default: etx4" echo "--bootfs filesystem of boot partition (ext4 or vfat) default: etx4"
echo -e "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)" echo -e "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)"
@ -161,12 +162,20 @@ function createchroot()
fi fi
fi fi
title "Creating $BUILD_PATH"
/bin/mkdir -p "$BUILD_PATH/usr/bin" "$BUILD_PATH/usr/lib/binfmt.d" if ! [ -d "$BUILD_PATH" ];then
if [ $? -ne 0 ];then warning "Build path does not exists, do you want i create it ? [Y|n] "
error "line $LINENO can't create $BUILD_PATH : exiting" read yn
exit 1 if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then
fi title "Creating $BUILD_PATH"
/bin/mkdir -p "$BUILD_PATH/usr/bin" "$BUILD_PATH/usr/lib/binfmt.d"
if [ $? -ne 0 ];then
error "line $LINENO can't create $BUILD_PATH : exiting"
exit 1
fi
else
exit 1
fi
/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"
@ -489,8 +498,11 @@ UUID=$ROOT_UUID / ext4 defaults 0 0" > "$BUILD_PA
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-stable/boot/" "$BOOT"
# cp -a "$FIRMWARE_PATH/firmware-stable/extra/uname_string" "$BOOT" #TODO copy to bootstrap /boot
# cp -a "$FIRMWARE_PATH/firmware-stable/extra/uname_string7" "$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"
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"
@ -508,7 +520,6 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
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-stable/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-stable/opt/" "$BUILD_PATH/opt/"
@ -650,6 +661,9 @@ do
--) --)
shift shift
break;; break;;
*)
error "Parameter $1 does not exists "
exit 1;;
esac esac
done done
@ -679,7 +693,7 @@ if [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then
if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then
/usr/bin/cp "$SOURCE_PATH/mageia4arm.cfg.template" "$SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg" /usr/bin/cp "$SOURCE_PATH/mageia4arm.cfg.template" "$SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg"
warning "You need now to modify the config file ($SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg) and relaunch the script" warning "You need now to modify the config file ($SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg) and relaunch the script"
exit 1 exit 2
fi fi
fi fi
else else
@ -689,7 +703,7 @@ else
/usr/bin/mkdir "$SOURCE_PATH/$CONFIG_PATH/" /usr/bin/mkdir "$SOURCE_PATH/$CONFIG_PATH/"
/usr/bin/cp "$SOURCE_PATH/config.template" "$SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg" /usr/bin/cp "$SOURCE_PATH/config.template" "$SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg"
warning "You need now to modify the config file ($SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg) and relaunch the script" warning "You need now to modify the config file ($SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg) and relaunch the script"
exit exit 2
fi fi
fi fi

View File

@ -25,7 +25,7 @@ TARGET="rpi"
MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION" MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION"
#MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION" #MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION"
# image will be created here # image will be created here
INSTALL_PATH="/miroirs/raspi" INSTALL_PATH="/mnt/perso/raspi-test/"
# Build directory will be created here # Build directory will be created here
BUILD_PATH="$INSTALL_PATH/build" BUILD_PATH="$INSTALL_PATH/build"

View File

@ -22,8 +22,8 @@
#Install all packages you need #Install all packages you need
/usr/sbin/urpmi --auto --no-verify-rpm basesystem chrony rng-tools man openssh-server rfkill wireless-tools bluez wpa_supplicant make dracut u-boot-tools rsync /usr/sbin/urpmi --auto --no-verify-rpm /root/kernel-odroid-4.14.y-1.armv7hl.rpm basesystem chrony rng-tools man openssh-server rfkill wireless-tools bluez wpa_supplicant make dracut u-boot-tools rsync
/usr/sbin/urpmi --urpmi-root "$BUILD_PATH" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200 ./kernel-odroid-4.14.y-1.armv7hl.rpm #/usr/sbin/urpmi --urpmi-root "$BUILD_PATH" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200
/usr/bin/chown :chrony -R /etc/chrony.keys /var/log/chrony /usr/bin/chown :chrony -R /etc/chrony.keys /var/log/chrony
/usr/bin/chown :daemon /etc/wpa_supplicant.conf /usr/bin/chown :daemon /etc/wpa_supplicant.conf