aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJybz <j.biernacki@free.fr>2021-02-03 17:59:25 +0100
committerJybz <j.biernacki@free.fr>2021-02-03 17:59:25 +0100
commit104a612f0e03a4fc0045c23b7d41e0fd22336f91 (patch)
tree5d8d7cc1855570f09b2217fe6132b40bbf2216b1
parentc16e81d06ad1ac88d384dd8677d0d8fa2320c58f (diff)
downloadmageia4arm-104a612f0e03a4fc0045c23b7d41e0fd22336f91.tar
mageia4arm-104a612f0e03a4fc0045c23b7d41e0fd22336f91.tar.gz
mageia4arm-104a612f0e03a4fc0045c23b7d41e0fd22336f91.tar.bz2
mageia4arm-104a612f0e03a4fc0045c23b7d41e0fd22336f91.tar.xz
mageia4arm-104a612f0e03a4fc0045c23b7d41e0fd22336f91.zip
Update bananaPro with mageia's uboot, modify with mageia/armgrub.efi, reduced boot delay.
-rw-r--r--platforms/bananaPro/mageia4arm.cfg3
-rw-r--r--platforms/bananaPro/second_stage_install.sh58
-rwxr-xr-xplatforms/bananaPro/specialFunctions.sh65
3 files changed, 54 insertions, 72 deletions
diff --git a/platforms/bananaPro/mageia4arm.cfg b/platforms/bananaPro/mageia4arm.cfg
index 09ceb34..95b465b 100644
--- a/platforms/bananaPro/mageia4arm.cfg
+++ b/platforms/bananaPro/mageia4arm.cfg
@@ -29,6 +29,9 @@ TARGET_VERSION="1"
# URL of the Mageia mirror used to install ( see mirrors.mageia.org )
# MIRROR=${MIRROR:="http://ftp.free.fr/mirrors/mageia.org/distrib/${MAGEIA_VERSION}/${ARM_VERSION}"}
+MIRROR_ROOT=http://ftp.free.fr/mirrors/mageia.org/distrib
+MIRROR_REPO="${MIRROR_ROOT}/${MAGEIA_VERSION}/${ARM_VERSION}"
+MIRROR=${MIRROR:="${MIRROR_REPO}"}
# Default user
# If not set, no user will be defined.
diff --git a/platforms/bananaPro/second_stage_install.sh b/platforms/bananaPro/second_stage_install.sh
index ab7f8aa..27339bf 100644
--- a/platforms/bananaPro/second_stage_install.sh
+++ b/platforms/bananaPro/second_stage_install.sh
@@ -19,6 +19,8 @@
export ARCH=arm
+source /to_source.sh
+
/usr/bin/chown :shadow /etc/shadow /etc/gshadow /etc/login.defs /etc/pam.d/chage-chfn-chsh /etc/pam.d/chpasswd-newusers /etc/pam.d/system-auth /etc/pam.d/user-group-mod /bin/passwd /bin/chage
/usr/bin/chown :systemd-journal -R /var/log/journal
@@ -28,32 +30,55 @@ export ARCH=arm
# ####################################################
# #Set the list space separated of added modules and omitted modules :
# DRIVER_ADD_LIST="8250_dw"
-DRIVER_ADD_LIST="sunxi-mmc mmcblk"
+DRIVER_ADD_LIST="sunxi-mmc mmcblk 8250_dw"
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
+
+cat <<EOT >/etc/dracut.conf.d/30-bananapro.conf
+# Omiting drm as it failed for arm :
+omit_dracutmodules+=" ${DRIVER_OMI_LIST} "
+
+# Driver to add for banana Pro (serial) :
+add_drivers+=" ${DRIVER_ADD_LIST} "
+EOT
#Install all packages you need
-<INSTALL_EXEC> 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
+<INSTALL_EXEC> basesystem 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"
-<INSTALL_EXEC> --media "Nonfree Release" --media "Nonfree Updates" kernel-firmware-nonfree
+/sbin/urpmi.update "Nonfree Release" "Nonfree Updates"
+<INSTALL_EXEC> --media "Nonfree Release,Nonfree Updates" iwlwifi-firmware
+# kernel-firmware-nonfree
-# <INSTALL_EXEC> grub2-uboot
-<INSTALL_EXEC> --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
-<INSTALL_EXEC> --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
+<INSTALL_EXEC> --noscripts u-boot grub2-common grub2-efi grub2-mageia-theme u-boot-tools
-/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 :
-<INSTALL_EXEC> u-boot-tools mindi-busybox plymouth-scripts #systemd-bootchart libcap-utils keyutils lvm2 #dmsetup
+echo \
+"# Configuration file for fw_(printenv/setenv) utility.
+# Up to two entries are valid, in this case the redundant
+# environment sector is assumed present.
+# MTD device name Device offset Env. size Flash sector size
+/boot/EFI/uboot.env 0x0000 0x20000" > /etc/fw_env.config
+
+cp /usr/lib/u-boot/Bananapro/default_env.txt /boot/EFI/uboot.env.txt
+sed -i -e 's|preboot=.*$|preboot=|' \
+ -e 's|boot\/bootarm\.efi|mageia\/grubarm\.efi|g' \
+ -e "s|uuid_gpt_esp=.*$|uuid_gpt_esp=${BOOT_UUID}|" \
+ -e "s|uuid_gpt_system=.*$|uuid_gpt_system=${ROOT_UUID}|" \
+ /boot/EFI/uboot.env.txt
+cat /boot/EFI/uboot.env.txt | mkenvimage -s $((0x20000)) -o /boot/EFI/uboot.env -
+rm /boot/EFI/uboot.env.txt
+
+
+mv /etc/grub.d/30_os-prober /tmp
+/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 --force --force-file-id
+mv /tmp/30_os-prober /etc/grub.d/
# ############################
@@ -133,7 +158,7 @@ echo -e "# Omiting drm as it failed for arm :\nomit_dracutmodules+=\" ${DRIVER_O
# 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
+# 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
@@ -143,5 +168,6 @@ sed -e '/label[[:space:]]*$/d' -e '/[[:space:]]*kernel[[:space:]]*$/d' -i /boot/
/usr/bin/chown :bin /sbin/traceroute
/usr/bin/chown polkitd /etc/polkit-1/rules.d
+df -h
## 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 4a7d72b..2340356 100755
--- a/platforms/bananaPro/specialFunctions.sh
+++ b/platforms/bananaPro/specialFunctions.sh
@@ -18,48 +18,24 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#Fdisk partitionment commands :
-DEFAULT=""
-NEW_DOSTAB="o"
-NEW_PART="n"
-PRIMARY="p"
-CHANGE_TYPE="t"
-TYPE_FAT32LBA="c"
-CHANGE_BOOTFLAG="a"
-APPLY="w"
-
-# PART_BOOT=1
-# PART_BOOT_FIRST_SECTOR=${DEFAULT}
-# PART_BOOT_SIZE="+128M"
-#
-# PART_ROOT=2
-# PART_ROOT_FIRST_SECTOR=${DEFAULT}
-# PART_ROOT_SIZE=${DEFAULT}
-
-PART_BOOTandROOT="1"
-PART_BOOTandROOT_FIRST_SECTOR="${DEFAULT}"
-PART_BOOTandROOT_SIZE="${DEFAULT}"
-
-
-# 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 partitionment commands :
SFDISK_SCRIPT=",128M,U,*\n,,L,\nwrite\n"
function preImgCreation()
{
-# title "Creating Banana Pro image"
- #Nothing to download.
+ # Nothing to do.
return 0
}
function postPrepareChroot()
{
- #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}/
+ # Provide to chroot environment some variables via a file
+ cat <<EOT >${BUILD_PATH}/to_source.sh
+ROOT_UUID=${ROOT_UUID}
+BOOT_UUID=${BOOT_UUID}
+EOT
return 0
}
@@ -73,30 +49,7 @@ function bunrningBootloader()
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}"
-# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/boot.scr" "${BOOT}/"
-# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/uboot.env" "${BOOT}/"
-# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/uEnv.txt" "${BOOT}/"
-# /usr/bin/cp --preserve=mode -d "${CONFIG_PATH}/vmlinuz" "${BOOT}/"
-# cp --preserve=mode -R "${BUILD_PATH}/boot/extlinux" "${BOOT}/"
+ # Remove the file given environment variable in the chroot.
+ rm -f ${BUILD_PATH}/to_source.sh
return 0
}