From 1e5184088c8412620c86b81ac2c98d0a18c5cb32 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Sun, 14 Oct 2018 21:08:55 +0200 Subject: [PATCH] Added raspberry pi bootstrap in /boot --- create_arm_img_urpmi.sh | 38 +++++++++++++++++++++++++------------ rpi/mageia4arm.cfg | 2 +- xu4/second_stage_install.sh | 4 ++-- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/create_arm_img_urpmi.sh b/create_arm_img_urpmi.sh index 47c1904..f074ef3 100755 --- a/create_arm_img_urpmi.sh +++ b/create_arm_img_urpmi.sh @@ -59,6 +59,7 @@ function help() echo "$CMDNAME [option] [size of image in Go]" echo "Options:" 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 "--create-chroot Create the chroot directory" echo "--addmedia add mirrors" @@ -67,7 +68,7 @@ function help() echo "--chroot chroot to arm directory and launch packages installation" 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 "--target target system (for now rpi, xu3, xu4)" +# echo "--target target system (for now rpi, xu3, xu4)" echo "--config Path to config files" 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)" @@ -161,12 +162,20 @@ function createchroot() fi 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 + + if ! [ -d "$BUILD_PATH" ];then + warning "Build path does not exists, do you want i create it ? [Y|n] " + read yn + if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then + 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/" if [ $? -ne 0 ];then 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) # info "copying raspberry firmware in /boot" # /bin/rsync -rlptDH "$FIRMWARE_PATH/firmware-stable/boot/" "$BOOT" -# cp -a "$FIRMWARE_PATH/firmware-stable/extra/uname_string" "$BOOT" -# cp -a "$FIRMWARE_PATH/firmware-stable/extra/uname_string7" "$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" 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" @@ -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" # info "copying raspberry modules in /lib/modules" # /bin/rsync -rlptDH "$FIRMWARE_PATH/firmware-stable/modules/" "$BUILD_PATH/lib/modules/" - # info "copying raspberry optionals files in opt" # /bin/rsync -rlptDH "$FIRMWARE_PATH/firmware-stable/opt/" "$BUILD_PATH/opt/" @@ -650,6 +661,9 @@ do --) shift break;; + *) + error "Parameter $1 does not exists " + exit 1;; esac done @@ -679,7 +693,7 @@ if [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then /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" - exit 1 + exit 2 fi fi else @@ -689,7 +703,7 @@ else /usr/bin/mkdir "$SOURCE_PATH/$CONFIG_PATH/" /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" - exit + exit 2 fi fi diff --git a/rpi/mageia4arm.cfg b/rpi/mageia4arm.cfg index 9167c28..f775126 100644 --- a/rpi/mageia4arm.cfg +++ b/rpi/mageia4arm.cfg @@ -25,7 +25,7 @@ TARGET="rpi" MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION" #MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION" # image will be created here -INSTALL_PATH="/miroirs/raspi" +INSTALL_PATH="/mnt/perso/raspi-test/" # Build directory will be created here BUILD_PATH="$INSTALL_PATH/build" diff --git a/xu4/second_stage_install.sh b/xu4/second_stage_install.sh index 78473aa..0ca646a 100644 --- a/xu4/second_stage_install.sh +++ b/xu4/second_stage_install.sh @@ -22,8 +22,8 @@ #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 --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 --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 /usr/bin/chown :chrony -R /etc/chrony.keys /var/log/chrony /usr/bin/chown :daemon /etc/wpa_supplicant.conf