diff --git a/create_arm_img_urpmi.sh b/create_arm_img_urpmi.sh index 5fcae93..f50e9ac 100755 --- a/create_arm_img_urpmi.sh +++ b/create_arm_img_urpmi.sh @@ -69,7 +69,7 @@ function help() 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, 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 "--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)" @@ -279,12 +279,14 @@ EOF" >>"$BUILD_PATH/second_stage_install.sh" case $TARGET in - ODROID) + odroid) #TEMPORARY CODE #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/" /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 error "line $LINENO error copying $SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm : exiting" exit 1 @@ -426,8 +428,20 @@ createimage() error "line $LINENO can't make image at $INSTALL_PATH/$IMAGE : exiting" exit 1 fi - info "making partitions" 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 n p @@ -511,12 +525,12 @@ copyingsystem() info "making /etc/fstab" 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 info "making /boot/extlinux/extlinux.conf" mkdir -p "$BUILD_PATH/boot/extlinux" -sed -e s/\/$ROOT_UUID/g $SOURCE_PATH/$CONFIG_PATH/extlinux.conf >"$BUILD_PATH/boot/extlinux/extlinux.conf" +sed 212!!;n**รน**:;ncq -e s/\/$ROOT_UUID/g $SOURCE_PATH/$CONFIG_PATH/extlinux.conf >"$BUILD_PATH/boot/extlinux/extlinux.conf" KERNEL_ID=`basename $BUILD_PATH/usr/lib/linux-*` sed -i -e s/\/$KERNEL_ID/g "$BUILD_PATH/boot/extlinux/extlinux.conf" @@ -531,9 +545,9 @@ snd_bcm2835 vc4 brcmfmac" >> "$BUILD_PATH"/etc/modules - RPI_BOOT="$BUILD_PATH/mnt/rpi_boot" - if ! [ -d "$RPI_BOOT" ];then - mkdir -p "$RPI_BOOT" + ARM_BOOT="$BUILD_PATH/mnt/arm_boot" + if ! [ -d "$ARM_BOOT" ];then + mkdir -p "$ARM_BOOT" fi info "copying modprobe.conf" /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" # 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/fixup"* "$RPI_BOOT/" - cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/bootcode.bin"* "$RPI_BOOT/" - cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/overlays" "$RPI_BOOT/" + cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/start"* "$ARM_BOOT/" + cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/fixup"* "$ARM_BOOT/" + cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/bootcode.bin"* "$ARM_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 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) 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) 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) 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+) 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 @@ -586,30 +600,36 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules fi info "copying Mageia image to root partition" - /bin/rsync -a --exclude "$RPI_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/" - /bin/rsync -a "$RPI_BOOT/" "$BOOT/" + /bin/rsync -a --exclude "$ARM_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/" + /bin/rsync -a "$ARM_BOOT/" "$BOOT/" ;; odroid) ODROID_BOOT="$BUILD_PATH/mnt/odroid_boot" if ! [ -d "$ODROID_BOOT" ];then mkdir -p "$ODROID_BOOT" 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" 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" /bin/rsync -a --exclude "$ODROID_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/" /bin/rsync -a "$ODROID_BOOT/" "$BOOT/" ;; esac - info "copying tools in /usr/local/bin/" - /bin/cp -a "$SOURCE_PATH/tools/" "$BUILD_PATH/usr/local/bin/" - if ! [ $? -eq 0 ];then - error "line $LINENO error copying tools" - ERRORN=$((ERRORN++)) - fi +# info "copying tools in /usr/local/bin/" +# /bin/cp -a "$SOURCE_PATH/tools/" "$BUILD_PATH/usr/local/bin/" +# if ! [ $? -eq 0 ];then +# error "line $LINENO error copying tools" +# ERRORN=$((ERRORN++)) +# fi # /bin/mkdir "$ROOT/boot" copyingcommon @@ -636,7 +656,7 @@ copyingcommon() { title "Copying common files and configuration" 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/" } @@ -669,11 +689,11 @@ do shift ;; --size) - IMAGE_SIZE=$2 + IMAGE_SIZE_P=$2 shift 2 ;; --build-path) - INSTALL_PATH="$2" + INSTALL_PATH_P="$2" shift 2 ;; --chroot) @@ -714,11 +734,11 @@ do shift ;; --target) - TARGET=$2 + TARGET_P=$2 shift 2 ;; --target-version) - TARGET_VERSION=$2 + TARGET_VERSION_P=$2 shift 2 ;; --config) @@ -726,7 +746,7 @@ do shift 2 ;; --bootfs) - BOOTFS=$2 + BOOTFS_P=$2 shift 2 ;; --) @@ -739,19 +759,10 @@ do 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 if ! [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then info " Config path does not exists, defaulting to ./$TARGET" - CONFIG_PATH="$SOURCE_PATH/$TARGET" + CONFIG_PATH="$TARGET" fi if [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then @@ -778,6 +789,29 @@ else 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 ) case $TARGET in odroid) @@ -793,6 +827,7 @@ rpi) esac info "target : $TARGET" +info "target_version : $TARGET_VERSION" info "source path: $SOURCE_PATH" info "Install path: $INSTALL_PATH" info "Build path: $BUILD_PATH" diff --git a/mageia4arm.cfg.template b/mageia4arm.cfg.template index 1aaafdd..7db5677 100644 --- a/mageia4arm.cfg.template +++ b/mageia4arm.cfg.template @@ -21,10 +21,10 @@ MAGEIA_VERSION="" # TO MODIFY ARM_VERSION="" -# Target plateform (xu or rpi) +# Target plateform (odroid or rpi) # TO MODIFY 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 TARGET_VERSION="" @@ -53,8 +53,8 @@ PASSWORD="user password" #root password ROOT_PWD="root password" -#Hostname -HOSTNAME="$TARGET.$ID_USER" +#Hostname +HOSTNAME="$TARGET.$ID_USER" #Filesystem of boot partitions (default ext4 raspberry pi need vfat) #BOOTFS=ext4 @@ -62,5 +62,5 @@ HOSTNAME="$TARGET.$ID_USER" #kernel package to install (just needed for 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/" diff --git a/xu4/second_stage_install.sh b/xu4/second_stage_install.sh index 9fc451c..c9f023f 100644 --- a/xu4/second_stage_install.sh +++ b/xu4/second_stage_install.sh @@ -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 --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 :daemon /etc/wpa_supplicant.conf /usr/bin/chown :tty /bin/write /bin/wall diff --git a/xu4/u-boot-20180507-3.mga7.armv7hl.rpm b/xu4/u-boot-20180507-3.mga7.armv7hl.rpm new file mode 100644 index 0000000..4711e39 Binary files /dev/null and b/xu4/u-boot-20180507-3.mga7.armv7hl.rpm differ