From 017adfd7b45f347c4d7243d75e7dccd117734191 Mon Sep 17 00:00:00 2001 From: Jybz Date: Mon, 2 Nov 2020 22:29:21 +0100 Subject: update bananaPro using formating file instead formating device --- platforms/bananaPro/mageia4arm.cfg | 8 +-- platforms/bananaPro/patch/bananapro_ | 11 ---- .../patch/bananapro_1_Disable_default_distro.patch | 2 +- .../bananapro_5_Switch_ENV_From_Fat_to_Ext4.patch | 4 +- platforms/bananaPro/second_stage_install.sh | 69 +++++++++++++-------- platforms/bananaPro/specialFunctions.sh | 40 +++++++----- .../u-boot-bananapro-20200706-2.mga7.armv7hl.rpm | Bin 0 -> 252576 bytes .../u-boot-tools-20200706-2.mga7.armv7hl.rpm | Bin 0 -> 321468 bytes 8 files changed, 77 insertions(+), 57 deletions(-) delete mode 100644 platforms/bananaPro/patch/bananapro_ create mode 100644 platforms/bananaPro/u-boot-bananapro-20200706-2.mga7.armv7hl.rpm create mode 100644 platforms/bananaPro/u-boot-tools-20200706-2.mga7.armv7hl.rpm diff --git a/platforms/bananaPro/mageia4arm.cfg b/platforms/bananaPro/mageia4arm.cfg index 963386c..f5730fd 100644 --- a/platforms/bananaPro/mageia4arm.cfg +++ b/platforms/bananaPro/mageia4arm.cfg @@ -18,7 +18,7 @@ # Mageia version 7 or later, cauldron. -MAGEIA_VERSION="7" +MAGEIA_VERSION=${MAGEIA_VERSION:="7"} # Arm version armv7hl, aarch64 ARM_VERSION="armv7hl" @@ -47,11 +47,11 @@ IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}.img" # HOSTNAME="${TARGET}" #Filesystem of boot partitions (default ext4 raspberry pi need vfat) -SEPARATE_BOOT_PARTITION=0 -BOOTFS="ext4" +SEPARATE_BOOT_PARTITION=1 +BOOTFS="vfat" #kernel package to install KERNEL="kernel-desktop" #The arguments for the Kernel -BOOT_ARGS='console=ttyS0,115200 disp.screen0_output_mode=EDID:1024x768p50 hdmi.audio=EDID:0' +BOOT_ARGS='console=ttyS0,115200 disp.screen0_output_mode=EDID:1024x768p50 hdmi.audio=EDID:0 audit=0' diff --git a/platforms/bananaPro/patch/bananapro_ b/platforms/bananaPro/patch/bananapro_ deleted file mode 100644 index 835770b..0000000 --- a/platforms/bananaPro/patch/bananapro_ +++ /dev/null @@ -1,11 +0,0 @@ ---- ./.config 2020-09-08 13:37:29.571109115 +0200 -+++ ./.config 2020-09-08 13:37:45.608244905 +0200 -@@ -377,7 +377,7 @@ - # CONFIG_SATA_BOOT is not set - # CONFIG_SD_BOOT is not set - # CONFIG_SPI_BOOT is not set --CONFIG_BOOTDELAY=2 -+CONFIG_BOOTDELAY=1 - # CONFIG_USE_BOOTARGS is not set - CONFIG_USE_BOOTCOMMAND=y - CONFIG_BOOTCOMMAND="run distro_bootcmd" diff --git a/platforms/bananaPro/patch/bananapro_1_Disable_default_distro.patch b/platforms/bananaPro/patch/bananapro_1_Disable_default_distro.patch index b3ec429..d4ea349 100644 --- a/platforms/bananaPro/patch/bananapro_1_Disable_default_distro.patch +++ b/platforms/bananaPro/patch/bananapro_1_Disable_default_distro.patch @@ -1,5 +1,5 @@ --- ./.config 2020-09-08 12:42:04.281817323 +0000 -+++ ./.config2 2020-09-08 12:46:12.305263098 +0000 ++++ ./.config 2020-09-08 12:46:12.305263098 +0000 @@ -297,7 +297,7 @@ CONFIG_LOCALVERSION="" CONFIG_LOCALVERSION_AUTO=y diff --git a/platforms/bananaPro/patch/bananapro_5_Switch_ENV_From_Fat_to_Ext4.patch b/platforms/bananaPro/patch/bananapro_5_Switch_ENV_From_Fat_to_Ext4.patch index 5a953a1..eb9af02 100644 --- a/platforms/bananaPro/patch/bananapro_5_Switch_ENV_From_Fat_to_Ext4.patch +++ b/platforms/bananaPro/patch/bananapro_5_Switch_ENV_From_Fat_to_Ext4.patch @@ -1,5 +1,5 @@ --- ./.config 2020-09-08 13:05:48.256808776 +0000 -+++ ./.config2 2020-09-08 13:31:43.994905698 +0000 ++++ ./.config 2020-09-08 13:31:43.994905698 +0000 @@ -799,2 +799,2 @@ -CONFIG_ENV_IS_IN_FAT=y -# CONFIG_ENV_IS_IN_EXT4 is not set @@ -11,4 +11,4 @@ -CONFIG_ENV_FAT_FILE="uboot.env" +CONFIG_ENV_EXT4_INTERFACE="mmc" +CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto" -+CONFIG_ENV_EXT4_FILE="/boot/uboot.env" ++CONFIG_ENV_EXT4_FILE="/boot/u-boot.env" diff --git a/platforms/bananaPro/second_stage_install.sh b/platforms/bananaPro/second_stage_install.sh index 2143364..ab7f8aa 100644 --- a/platforms/bananaPro/second_stage_install.sh +++ b/platforms/bananaPro/second_stage_install.sh @@ -23,12 +23,39 @@ export ARCH=arm /usr/bin/chown :systemd-journal -R /var/log/journal +# #################################################### +# ## To embed a module inside the early boot initrd ## +# #################################################### +# #Set the list space separated of added modules and omitted modules : +# DRIVER_ADD_LIST="8250_dw" +DRIVER_ADD_LIST="sunxi-mmc mmcblk" +DRIVER_OMI_LIST="drm" +# #Create a configuration file inside the FS, it will be used by dracut for all kernel update +mkdir -p /etc/dracut.conf.d/ +echo -e "# Omiting drm as it failed for arm :\nomit_dracutmodules+=\" ${DRIVER_OMI_LIST} \"\n\n# Driver to add for banana Pro (serial) :\nadd_drivers+=\" ${DRIVER_ADD_LIST} \"\n" > /etc/dracut.conf.d/30-bananapro.conf + + #Install all packages you need basesystem u-boot chrony polkit lockdev rng-tools man openssh-server rfkill wireless-tools bluez wpa_supplicant make rsync binutils ldetect usbutils #kernel-desktop-latest # systemd-bootchart libcap-utils keyutils mindi-busybox plymouth-scripts lvm2 #dmsetup +#For the wifi : +/sbin/urpmi.update "Nonfree Release" +/sbin/urpmi.update "Nonfree Updates" + --media "Nonfree Release" --media "Nonfree Updates" kernel-firmware-nonfree + +# grub2-uboot + --noscripts ./grub2-common-2.02.0-16.mga7.armv7hl.rpm ./grub2-efi-2.02.0-16.mga7.armv7hl.rpm ./grub2-mageia-theme-2.02.0-16.mga7.noarch.rpm + --noscripts efibootmgr util-linux +/usr/bin/sed -i -e 's/GRUB_CMDLINE_LINUX_DEFAULT="\(.*\)"/GRUB_CMDLINE_LINUX_DEFAULT="\1 audit=0"/' /etc/default/grub +/usr/bin/sed -i -e 's/GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=1/' /etc/default/grub + +/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg +/usr/sbin/grub2-install --skip-fs-probe --target=arm-efi --efi-directory=/boot/EFI + #For dracut : u-boot-tools mindi-busybox plymouth-scripts #systemd-bootchart libcap-utils keyutils lvm2 #dmsetup + # ############################ # ## For compiling a module ## # ############################ @@ -53,28 +80,13 @@ export ARCH=arm # ## Impossible to build any module there. -# #################################################### -# ## To embed a module inside the early boot initrd ## -# #################################################### -# #Set the kernel name : -# KERNELVERSION="5.3.7-desktop-4.mga7" -K_INST_VERSION=$(rpm -q kernel-desktop-latest | sed -e 's/kernel-\([[:alnum:]]*\)-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\2-\1-\3/') -# #Set the list of added modules and omitted modules : -# DRIVER_ADD_LIST="8250_dw" -# DRIVER_OMI_LIST="drm" -# #Create a configuration file inside the FS, it will be used by dracut for all kernel update -# echo -e "# Omiting drm as it failed for arm :\nomit_dracutmodules+=\" ${DRIVER_OMI_LIST} \"\n\n# Driver to add for banana Pro (serial) :\nadd_drivers+=\" ${DRIVER_ADD_LIST} \"\n" > /etc/dracut.conf.d/30-bananapro.conf +# ########################### +# ## Regenerate the initrd ## +# ########################### # #Generate the initrd : # OUTPUT=$(ARCH=arm CROSS_COMPILE=arm-linux-gnu- dracut --no-compress --force --no-hostonly --local --no-early-microcode --confdir "/etc/dracut.conf.d" --kmoddir="/lib/modules/${K_INST_VERSION}" --xz --printsize --kernel-image /boot/vmlinuz --fstab initrd-${K_INST_VERSION}.img ${K_INST_VERSION} 2>&1 | tee /dev/tty ) -dracut --no-compress --force --no-hostonly --local --no-early-microcode --confdir "/etc/dracut.conf.d" --kmoddir="/lib/modules/${K_INST_VERSION}" --xz --printsize --kernel-image /boot/vmlinuz --fstab /boot/initrd-${K_INST_VERSION}.img ${K_INST_VERSION} -ln -r -s /boot/initrd-${K_INST_VERSION}.img /boot/initrd.img -# #Add the uboot header to the initrd file, first, find the file : -# INITRD_FILE="$(echo "${OUTPUT}" | grep "Creating initramfs image file" | sed -e "s/^[*:[:space:][:alnum:]]*'//" -e "s/'.*$//" )" -# #Add the uboot header, the result file will contain a 'u' as prefix-name. -# mkimage -A arm -T ramdisk -C lzma -n initrd -d ${INITRD_FILE} "$(dirname "${INITRD_FILE}")/u$(basename "${INITRD_FILE}")" -# #generate a symlink relative r and symbolic s : -# rm -f /boot/initrd -# ln -r -s "$(dirname "${INITRD_FILE}")/u$(basename "${INITRD_FILE}")" /boot/initrd +# dracut --no-compress --force --no-hostonly --local --no-early-microcode --confdir "/etc/dracut.conf.d" --kmoddir="/lib/modules/${K_INST_VERSION}" --xz --printsize --kernel-image /boot/vmlinuz --fstab /boot/initrd-${K_INST_VERSION}.img ${K_INST_VERSION} + ########################################### ## Install a package from testing repo : ## @@ -83,12 +95,14 @@ ln -r -s /boot/initrd-${K_INST_VERSION}.img /boot/initrd.img # urpmi --auto --media Testing kernel-desktop-latest # dnf --refresh --enablerepo=updates_testing-\* --assumeyes install kernel-desktop-latest + ############################################ ## Installing the kernel (not on testing) ## ############################################ # urpmi --auto kernel-desktop-latest # dnf --refresh --assumeyes install kernel-desktop-latest + ############################################### ## Create a symlink for the lastest kernel : ## ############################################### @@ -98,11 +112,13 @@ ln -r -s /boot/initrd-${K_INST_VERSION}.img /boot/initrd.img # #Get the vmlinuz file : # VMLINUZ=$(urpmf ${KERNELRPM} | grep "boot/vmlinuz" | cut -d ':' -f 2) #Get the vmlinuz file : -VMLINUZ=$(ls --sort=time -1 /boot/vmlinuz-[[:digit:]]* | head -n 1) -rm -f /boot/uvmlinuz -ln -r -s "${VMLINUZ}" /boot/uvmlinuz #For the uboot script +# VMLINUZ=$(ls --sort=time -1 /boot/vmlinuz-[[:digit:]]* | head -n 1) +# rm -f /boot/uvmlinuz +# ln -r -s "${VMLINUZ}" /boot/uvmlinuz #For the uboot script # Normally, /boot/vmlinuz is generated with the /sbin/installkernel script, but it is not generated with chroot. -ln -r -s "${VMLINUZ}" /boot/vmlinuz #For extlinux.conf +# rm -f /boot/vmlinuz +# ln -r -s "${VMLINUZ}" /boot/vmlinuz #For extlinux.conf + ################################ ## Create the extlinux script ## @@ -115,6 +131,9 @@ ln -r -s "${VMLINUZ}" /boot/vmlinuz #For extlinux.conf # perl -d /usr/sbin/bootloader-config --kernel-version ${K_INST_VERSION} --initrd-options '' --action add-kernel # /usr/sbin/bootloader-config --kernel-version ${K_INST_VERSION} --initrd-options '' --action add-kernel # echo -e "\nEnd trying to generate extlinux script with errcode ${?}\n" +# In a x86_64 chroot for armv7, the bootloader-config script fails to find the /etc/fstab and add an empty entry. See BUG 25879 +#Removing empty entries : +sed -e '/label[[:space:]]*$/d' -e '/[[:space:]]*kernel[[:space:]]*$/d' -i /boot/extlinux/extlinux.conf /usr/bin/chown :chrony -R /etc/chrony.keys /var/log/chrony @@ -125,4 +144,4 @@ ln -r -s "${VMLINUZ}" /boot/vmlinuz #For extlinux.conf /usr/bin/chown polkitd /etc/polkit-1/rules.d - ## DO NOT EXIT THE SCRIPT. A second part is automatically added in this script during the process in order to create the default user and set root password. +## DO NOT EXIT THE SCRIPT. A second part is automatically added in this script during the process in order to create the default user and set root password. diff --git a/platforms/bananaPro/specialFunctions.sh b/platforms/bananaPro/specialFunctions.sh index 24c9bf8..4a7d72b 100755 --- a/platforms/bananaPro/specialFunctions.sh +++ b/platforms/bananaPro/specialFunctions.sh @@ -41,13 +41,13 @@ PART_BOOTandROOT_FIRST_SECTOR="${DEFAULT}" PART_BOOTandROOT_SIZE="${DEFAULT}" -FDISK_SCRIPT="${NEW_PART}\n${PRIMARY}\n${PART_BOOTandROOT}\n${PART_BOOT_FIRST_SECTOR}\n${PART_BOOTandROOT_SIZE}\n${CHANGE_BOOTFLAG}\n${APPLY}\n" -# FDISK_SCRIPT="${NEW_PART}\n${PRIMARY}\n${PART_BOOT}\n${PART_BOOT_FIRST_SECTOR}\n${PART_BOOT_SIZE}\n${CHANGE_TYPE}\n${TYPE_FAT32LBA}\n${NEW_PART}\n${PRIMARY}\n${PART_ROOT}\n${PART_ROOT_FIRST_SECTOR}\n${PART_ROOT_SIZE}\n${CHANGE_BOOTFLAG}\n${PART_BOOT}\n${CHANGE_BOOTFLAG}\n${PART_ROOT}\n${APPLY}\n" +# FDISK_SCRIPT="${NEW_PART}\n${PRIMARY}\n${PART_BOOTandROOT}\n${PART_BOOTandROOT_FIRST_SECTOR}\n${PART_BOOTandROOT_SIZE}\n${CHANGE_BOOTFLAG}\n${APPLY}\n" +SFDISK_SCRIPT=",128M,U,*\n,,L,\nwrite\n" function preImgCreation() { - title "Creating Banana Pro image" +# title "Creating Banana Pro image" #Nothing to download. return 0 } @@ -55,16 +55,11 @@ function preImgCreation() function postPrepareChroot() { -# info "copying kernel-desktop, dtb, boot.scr and vmlinuz symlink in ${BUILD_PATH}/boot" - info "copying dtb and boot.scr in ${BUILD_PATH}/boot" - #Generating uboot autoboot script : -# mkimage -C none -A arm -T script -d "${CONFIG_PATH}/boot.cmd" "${BUILD_PATH}/boot/boot.scr" - /usr/bin/cp --preserve=mode "${BUILD_PATH}/usr/lib/u-booot/bananapro/u-boot.dtb" "${BUILD_PATH}/boot/" - /usr/bin/cp --preserve=mode "${BUILD_PATH}/usr/lib/u-booot/bananapro/u-boot.env" "${BUILD_PATH}/boot/" -# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/sun7i-a20-bananapro.dtb" "${BUILD_PATH}/boot/" -# /usr/bin/cp --preserve=mode -d "${CONFIG_PATH}/vmlinuz" "${BUILD_PATH}/boot/" -# /usr/bin/cp --preserve=mode -r "${CONFIG_PATH}/lib" "${BUILD_PATH}/" - + #Nothing to do. + warning "copie rpm" + cp ${SOURCE_PATH}/rpm/grub2-common-2.02.0-16.mga7.armv7hl.rpm ${BUILD_PATH}/ + cp ${SOURCE_PATH}/rpm/grub2-efi-2.02.0-16.mga7.armv7hl.rpm ${BUILD_PATH}/ + cp ${SOURCE_PATH}/rpm/grub2-mageia-theme-2.02.0-16.mga7.noarch.rpm ${BUILD_PATH}/ return 0 } @@ -72,12 +67,29 @@ function bunrningBootloader() { # DEVICE is set just before this function and looped. title "Burning the bootloader..." - dd if=${BUILD_PATH}/usr/lib/u-booot/bananapro/u-boot-sunxi-with-spl.bin of=${DEVICE} bs=1024 seek=8 + dd if=${BUILD_PATH}/usr/lib/u-boot/Bananapro/u-boot-sunxi-with-spl.bin of=${DEVICE} bs=1024 seek=8 return 0 } function copyingCustomSystem() { +# LIST_OF_UBOOT="$(ls -1 ${SOURCE_PATH}/rpm/ | grep u-boot | tr '\n' ' ')" +# echo ${LIST_OF_UBOOT} +# pushd ${SOURCE_PATH}/rpm/ +# installpkg ${LIST_OF_UBOOT} + installpkg ${CONFIG_PATH}/u-boot-bananapro-20200706-2.mga7.armv7hl.rpm + installpkg ${CONFIG_PATH}/u-boot-tools-20200706-2.mga7.armv7hl.rpm +# installpkg ${SOURCE_PATH}/rpm/grub2-common-2.02.0-15.mga7.armv7hl.rpm ${SOURCE_PATH}/rpm/grub2-efi-2.02.0-15.mga7.armv7hl.rpm ${SOURCE_PATH}/rpm/grub2-mageia-theme-2.02.0-15.mga7.noarch.rpm +# echo -e "# Configuration file for fw_(printenv/setenv) utility.\n# Up to two entries are valid, in this case the redundant\n# environment sector is assumed present.\n# MTD device name Device offset Env. size Flash sector size\n/boot/u-boot.env 0x0000 0x20000" > "${BUILD_PATH}/etc/fw_env.config" +# popd +# info "copying kernel-desktop, dtb, boot.scr and vmlinuz symlink in ${BUILD_PATH}/boot" + info "copying dtb and boot.scr in ${BUILD_PATH}/boot" + #Generating uboot autoboot script : +# mkimage -C none -A arm -T script -d "${CONFIG_PATH}/boot.cmd" "${BUILD_PATH}/boot/boot.scr" + /usr/bin/cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/Bananapro/u-boot.dtb" "${BUILD_PATH}/boot/" + /usr/bin/cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/Bananapro/u-boot.env" "${BUILD_PATH}/boot/" +# /usr/bin/cp --preserve=mode "${BUILD_PATH}/usr/lib/linux/sun7i-a20-bananapro.dtb" "${BUILD_PATH}/boot/u-boot.dtb" + #${BOOT} defined to the path to the mounted boot partition. # /usr/bin/cp --preserve=mode "${CONFIG_PATH}/vmlinuz-5.3.1-desktop-2.mga7" "${BOOT}" # /usr/bin/cp --preserve=mode "${CONFIG_PATH}/sun7i-a20-bananapro.dtb" "${BOOT}" diff --git a/platforms/bananaPro/u-boot-bananapro-20200706-2.mga7.armv7hl.rpm b/platforms/bananaPro/u-boot-bananapro-20200706-2.mga7.armv7hl.rpm new file mode 100644 index 0000000..fabb448 Binary files /dev/null and b/platforms/bananaPro/u-boot-bananapro-20200706-2.mga7.armv7hl.rpm differ diff --git a/platforms/bananaPro/u-boot-tools-20200706-2.mga7.armv7hl.rpm b/platforms/bananaPro/u-boot-tools-20200706-2.mga7.armv7hl.rpm new file mode 100644 index 0000000..d138206 Binary files /dev/null and b/platforms/bananaPro/u-boot-tools-20200706-2.mga7.armv7hl.rpm differ -- cgit v1.2.1