1
0

minor update

This commit is contained in:
Daniel Tartavel 2019-01-05 20:58:18 +01:00
parent a22918ebab
commit 8cdf11965a
4 changed files with 86 additions and 51 deletions

View File

@ -69,7 +69,7 @@ function help()
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, odroid)" echo "--target target system (for now rpi, odroid)"
echo "--target-version version of the taget (0, 1, 2, 3 for rpi, 3 or 4 for odroid)" echo "--target-version version of the taget (0, 1, 2, 3 for rpi, xu3 or xu4 for odroid)"
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)"
@ -279,12 +279,14 @@ EOF" >>"$BUILD_PATH/second_stage_install.sh"
case $TARGET in case $TARGET in
ODROID) odroid)
#TEMPORARY CODE #TEMPORARY CODE
#copying kernel odroid not existing in mageia repos #copying kernel odroid not existing in mageia repos
info "copying kernel-odroid rpm in $BUILD_PATH/root" info "copying kernel-odroid and u-boot rpms in $BUILD_PATH/root"
echo "/bin/cp $SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm $BUILD_PATH/root/" echo "/bin/cp $SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm $BUILD_PATH/root/"
/usr/bin/cp "$SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm" "$BUILD_PATH/root/" /usr/bin/cp "$SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm" "$BUILD_PATH/root/"
echo "/bin/cp $SOURCE_PATH/$CONFIG_PATH/u-boot-20180507-3.mga7.armv7hl.rpm $BUILD_PATH/root/"
/usr/bin/cp "$SOURCE_PATH/$CONFIG_PATH/u-boot-20180507-3.mga7.armv7hl.rpm" "$BUILD_PATH/root/"
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
error "line $LINENO error copying $SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm : exiting" error "line $LINENO error copying $SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm : exiting"
exit 1 exit 1
@ -426,8 +428,20 @@ createimage()
error "line $LINENO can't make image at $INSTALL_PATH/$IMAGE : exiting" error "line $LINENO can't make image at $INSTALL_PATH/$IMAGE : exiting"
exit 1 exit 1
fi fi
info "making partitions"
DEVICE=$(/sbin/losetup -f --show "$INSTALL_PATH/$IMAGE") DEVICE=$(/sbin/losetup -f --show "$INSTALL_PATH/$IMAGE")
if [ $TARGET = "odroid" ];then
info "installing blobs"
pushd "$SOURCE_PATH/$CONFIG_PATH/sd_fuse"
if [ $? -ne 0 ];then
error "line $LINENO error directory $SOURCE_PATH/$CONFIG_PATH/sd_fuse does not exists : exiting"
exit 1
else
./sd_fusing.sh "$DEVICE"
fi
pushd
fi
info "making partitions"
/sbin/fdisk "$DEVICE" << EOF /sbin/fdisk "$DEVICE" << EOF
n n
p p
@ -511,12 +525,12 @@ copyingsystem()
info "making /etc/fstab" info "making /etc/fstab"
echo "proc /proc proc defaults 0 0 echo "proc /proc proc defaults 0 0
UUID=$BOOT_UUID /mnt/rpi_boot vfat defaults 0 0 UUID=$BOOT_UUID /mnt/arm_boot vfat defaults 0 0
UUID=$ROOT_UUID / ext4 defaults 0 0" > "$BUILD_PATH"/etc/fstab UUID=$ROOT_UUID / ext4 defaults 0 0" > "$BUILD_PATH"/etc/fstab
info "making /boot/extlinux/extlinux.conf" info "making /boot/extlinux/extlinux.conf"
mkdir -p "$BUILD_PATH/boot/extlinux" mkdir -p "$BUILD_PATH/boot/extlinux"
sed -e s/\<UUID\>/$ROOT_UUID/g $SOURCE_PATH/$CONFIG_PATH/extlinux.conf >"$BUILD_PATH/boot/extlinux/extlinux.conf" sed 212!!;n**ù**:;ncq -e s/\<UUID\>/$ROOT_UUID/g $SOURCE_PATH/$CONFIG_PATH/extlinux.conf >"$BUILD_PATH/boot/extlinux/extlinux.conf"
KERNEL_ID=`basename $BUILD_PATH/usr/lib/linux-*` KERNEL_ID=`basename $BUILD_PATH/usr/lib/linux-*`
sed -i -e s/\<FDTDIR\>/$KERNEL_ID/g "$BUILD_PATH/boot/extlinux/extlinux.conf" sed -i -e s/\<FDTDIR\>/$KERNEL_ID/g "$BUILD_PATH/boot/extlinux/extlinux.conf"
@ -531,9 +545,9 @@ snd_bcm2835
vc4 vc4
brcmfmac" >> "$BUILD_PATH"/etc/modules brcmfmac" >> "$BUILD_PATH"/etc/modules
RPI_BOOT="$BUILD_PATH/mnt/rpi_boot" ARM_BOOT="$BUILD_PATH/mnt/arm_boot"
if ! [ -d "$RPI_BOOT" ];then if ! [ -d "$ARM_BOOT" ];then
mkdir -p "$RPI_BOOT" mkdir -p "$ARM_BOOT"
fi fi
info "copying modprobe.conf" info "copying modprobe.conf"
/bin/cp -a "$SOURCE_PATH/$CONFIG_PATH/modprobe.conf" "$BUILD_PATH/etc/" /bin/cp -a "$SOURCE_PATH/$CONFIG_PATH/modprobe.conf" "$BUILD_PATH/etc/"
@ -541,32 +555,32 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
info "copying firmware, overlays in rpi boot partition" info "copying firmware, overlays in rpi boot partition"
# cp -a "$BUILD_PATH/usr/lib/linux-"* "$BOOT/dtb" # cp -a "$BUILD_PATH/usr/lib/linux-"* "$BOOT/dtb"
cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/start"* "$RPI_BOOT/" cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/start"* "$ARM_BOOT/"
cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/fixup"* "$RPI_BOOT/" cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/fixup"* "$ARM_BOOT/"
cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/bootcode.bin"* "$RPI_BOOT/" cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/bootcode.bin"* "$ARM_BOOT/"
cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/overlays" "$RPI_BOOT/" cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/overlays" "$ARM_BOOT/"
info "copying u-boot binary to $RPI_BOOT" info "copying u-boot binary to $ARM_BOOT"
case $TARGET_VERSION in case $TARGET_VERSION in
2) 2)
info "copying u-boot for $TARGET 2" info "copying u-boot for $TARGET 2"
cp "$BUILD_PATH/usr/lib/u-boot/rpi_2/u-boot.bin" "$RPI_BOOT/kernel7.img" cp "$BUILD_PATH/usr/lib/u-boot/rpi_2/u-boot.bin" "$ARM_BOOT/kernel7"
;; ;;
0) 0)
info "copying u-boot for $TARGET 0" info "copying u-boot for $TARGET 0"
cp "$BUILD_PATH/usr/lib/u-boot/rpi_0_w/u-boot.bin" "$RPI_BOOT/kernel7.img" cp "$BUILD_PATH/usr/lib/u-boot/rpi_0_w/u-boot.bin" "$ARM_BOOT/kernel7"
;; ;;
1) 1)
info "copying u-boot for $TARGET 1" info "copying u-boot for $TARGET 1"
cp "$BUILD_PATH/usr/lib/u-boot/rpi/u-boot.bin" "$RPI_BOOT/kernel7.img" cp "$BUILD_PATH/usr/lib/u-boot/rpi/u-boot.bin" "$ARM_BOOT/kernel7"
;; ;;
3_32) 3_32)
info "copying u-boot for $TARGET 3 32 bits" info "copying u-boot for $TARGET 3 32 bits"
cp "$BUILD_PATH/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "$RPI_BOOT/kernel7.img" cp "$BUILD_PATH/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "$ARM_BOOT/kernel7"
;; ;;
3+) 3+)
info "copying u-boot for $TARGET 3b+ 32 bits" info "copying u-boot for $TARGET 3b+ 32 bits"
cp "$BUILD_PATH/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "$RPI_BOOT/kernel7.img" cp "$BUILD_PATH/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "$ARM_BOOT/kernel7"
;; ;;
esac esac
@ -586,30 +600,36 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
fi fi
info "copying Mageia image to root partition" info "copying Mageia image to root partition"
/bin/rsync -a --exclude "$RPI_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/" /bin/rsync -a --exclude "$ARM_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/"
/bin/rsync -a "$RPI_BOOT/" "$BOOT/" /bin/rsync -a "$ARM_BOOT/" "$BOOT/"
;; ;;
odroid) odroid)
ODROID_BOOT="$BUILD_PATH/mnt/odroid_boot" ODROID_BOOT="$BUILD_PATH/mnt/odroid_boot"
if ! [ -d "$ODROID_BOOT" ];then if ! [ -d "$ODROID_BOOT" ];then
mkdir -p "$ODROID_BOOT" mkdir -p "$ODROID_BOOT"
fi fi
case $TARGET_VERSION in
xu4)
info "copying u-boot for $TARGET $TARGET_VERSION"
cp "$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" info "Copying extlinux.conf on $ODROID_BOOT"
cp -R "$BUILD_PATH/boot/extlinux" "$ODROID_BOOT/" cp -R "$BUILD_PATH/boot/extlinux" "$ODROID_BOOT/"
info "copying u-boot to $ODROID_BOOT for $TARGET $TARGET_VERSION"
cp "$BUILD_PATH/usr/lib/u-boot/$TARGET-$TARGET_VERSION/u-boot.bin" "$ODROID_BOOT/"
info "copying Mageia image to root partition" info "copying Mageia image to root partition"
/bin/rsync -a --exclude "$ODROID_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/" /bin/rsync -a --exclude "$ODROID_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/"
/bin/rsync -a "$ODROID_BOOT/" "$BOOT/" /bin/rsync -a "$ODROID_BOOT/" "$BOOT/"
;; ;;
esac esac
info "copying tools in /usr/local/bin/" # info "copying tools in /usr/local/bin/"
/bin/cp -a "$SOURCE_PATH/tools/" "$BUILD_PATH/usr/local/bin/" # /bin/cp -a "$SOURCE_PATH/tools/" "$BUILD_PATH/usr/local/bin/"
if ! [ $? -eq 0 ];then # if ! [ $? -eq 0 ];then
error "line $LINENO error copying tools" # error "line $LINENO error copying tools"
ERRORN=$((ERRORN++)) # ERRORN=$((ERRORN++))
fi # fi
# /bin/mkdir "$ROOT/boot" # /bin/mkdir "$ROOT/boot"
copyingcommon copyingcommon
@ -636,7 +656,7 @@ copyingcommon()
{ {
title "Copying common files and configuration" title "Copying common files and configuration"
rsync -aP "$SOURCE_PATH/common/" "$ROOT/" rsync -aP "$SOURCE_PATH/common/" "$ROOT/"
rsync -aP "$SOURCE_PATH/tools/*.sh" "$ROOT/usr/local/bin/" rsync -aP "$SOURCE_PATH/tools/"*.sh "$ROOT/usr/local/bin/"
chown root:root "$ROOT/usr/local/bin/" chown root:root "$ROOT/usr/local/bin/"
} }
@ -669,11 +689,11 @@ do
shift shift
;; ;;
--size) --size)
IMAGE_SIZE=$2 IMAGE_SIZE_P=$2
shift 2 shift 2
;; ;;
--build-path) --build-path)
INSTALL_PATH="$2" INSTALL_PATH_P="$2"
shift 2 shift 2
;; ;;
--chroot) --chroot)
@ -714,11 +734,11 @@ do
shift shift
;; ;;
--target) --target)
TARGET=$2 TARGET_P=$2
shift 2 shift 2
;; ;;
--target-version) --target-version)
TARGET_VERSION=$2 TARGET_VERSION_P=$2
shift 2 shift 2
;; ;;
--config) --config)
@ -726,7 +746,7 @@ do
shift 2 shift 2
;; ;;
--bootfs) --bootfs)
BOOTFS=$2 BOOTFS_P=$2
shift 2 shift 2
;; ;;
--) --)
@ -739,19 +759,10 @@ do
done done
info "Option: "$OPT
IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET$TARGET_VERSION.img"
BOOT="/mnt/boot"
ROOT="/mnt/root"
BUILD_PATH="$INSTALL_PATH/build"
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 does not exists, defaulting to ./$TARGET" info " Config path does not exists, defaulting to ./$TARGET"
CONFIG_PATH="$SOURCE_PATH/$TARGET" CONFIG_PATH="$TARGET"
fi fi
if [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then if [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then
@ -778,6 +789,29 @@ else
fi fi
fi fi
if ! [ -z "$IMAGE_SIZE_P" ];then
IMAGE_SIZE=$IMAGE_SIZE_P
fi
if ! [ -z "$INSTALL_PATH_P" ];then
INSTALL_PATH=$INSTALL_PATH_P
fi
if ! [ -z "$TARGET_P" ];then
TARGET=$TARGET_P
fi
if ! [ -z "$TARGET_VERSION_P" ];then
TARGET_VERSION=$TARGET_VERSION_P
fi
if ! [ -z "$BOOTFS_P" ];then
BOOTFS=$BOOTFS_P
fi
info "Option: "$OPT
IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET$TARGET_VERSION.img"
BOOT="/mnt/boot"
ROOT="/mnt/root"
BUILD_PATH="$INSTALL_PATH/build"
ARM_VERSION="armv7hl"
# assign function for building image of TARGET ( rpi, odroid ) # assign function for building image of TARGET ( rpi, odroid )
case $TARGET in case $TARGET in
odroid) odroid)
@ -793,6 +827,7 @@ rpi)
esac esac
info "target : $TARGET" info "target : $TARGET"
info "target_version : $TARGET_VERSION"
info "source path: $SOURCE_PATH" info "source path: $SOURCE_PATH"
info "Install path: $INSTALL_PATH" info "Install path: $INSTALL_PATH"
info "Build path: $BUILD_PATH" info "Build path: $BUILD_PATH"

View File

@ -21,10 +21,10 @@ MAGEIA_VERSION=""
# TO MODIFY # TO MODIFY
ARM_VERSION="" ARM_VERSION=""
# Target plateform (xu or rpi) # Target plateform (odroid or rpi)
# TO MODIFY # TO MODIFY
TARGET="" TARGET=""
# Target version (0,2,3 for raspi, 3or 4 for odroid) # Target version (0,2,3 for raspi, 3 or 4 for odroid)
#TO MODIFY #TO MODIFY
TARGET_VERSION="" TARGET_VERSION=""
@ -62,5 +62,5 @@ HOSTNAME="$TARGET.$ID_USER"
#kernel package to install (just needed for odroid) #kernel package to install (just needed for odroid)
#KERNEL=kernel-odroid #KERNEL=kernel-odroid
#Path where the raspberry pi firmware is/will be installed #Path where the raspberry pi firmware is/will be installed ( just needed for raspberry pi )
FIRMWARE_PATH="$INSTALL_PATH/" FIRMWARE_PATH="$INSTALL_PATH/"

View File

@ -24,7 +24,7 @@
/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 kernel-desktop-latest /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 kernel-desktop-latest
#/usr/sbin/urpmi --urpmi-root "$BUILD_PATH" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200 #/usr/sbin/urpmi --urpmi-root "$BUILD_PATH" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200
/usr/sbin/urpmi --auto --no-verify-rpm /root/u-boot-20180507-3.mga7.armv7hl.rpm
/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
/usr/bin/chown :tty /bin/write /bin/wall /usr/bin/chown :tty /bin/write /bin/wall

Binary file not shown.