diff options
author | Jybz <j.biernacki@free.fr> | 2022-04-17 18:03:59 +0200 |
---|---|---|
committer | Jybz <j.biernacki@free.fr> | 2022-04-17 18:03:59 +0200 |
commit | 0c84dea5600232049a833c98ab0ea104e44d94bb (patch) | |
tree | c8d171d83eee18a3c4428df27f695ac441b0baef | |
parent | 5a055e6111fa8f31c987ecda06fb342e94e66916 (diff) | |
download | mageia4arm-0c84dea5600232049a833c98ab0ea104e44d94bb.tar mageia4arm-0c84dea5600232049a833c98ab0ea104e44d94bb.tar.gz mageia4arm-0c84dea5600232049a833c98ab0ea104e44d94bb.tar.bz2 mageia4arm-0c84dea5600232049a833c98ab0ea104e44d94bb.tar.xz mageia4arm-0c84dea5600232049a833c98ab0ea104e44d94bb.zip |
Add freebox-delta directory
-rw-r--r-- | platforms/freebox-delta/.specialFunctions.sh.kate-swp | bin | 0 -> 77 bytes | |||
-rw-r--r-- | platforms/freebox-delta/mageia4arm.cfg | 60 | ||||
-rw-r--r-- | platforms/freebox-delta/second_stage_install.sh | 173 | ||||
-rwxr-xr-x | platforms/freebox-delta/specialFunctions.sh | 55 |
4 files changed, 288 insertions, 0 deletions
diff --git a/platforms/freebox-delta/.specialFunctions.sh.kate-swp b/platforms/freebox-delta/.specialFunctions.sh.kate-swp Binary files differnew file mode 100644 index 0000000..f185d8c --- /dev/null +++ b/platforms/freebox-delta/.specialFunctions.sh.kate-swp diff --git a/platforms/freebox-delta/mageia4arm.cfg b/platforms/freebox-delta/mageia4arm.cfg new file mode 100644 index 0000000..b62e366 --- /dev/null +++ b/platforms/freebox-delta/mageia4arm.cfg @@ -0,0 +1,60 @@ + +# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com> +# Copyright (C) 2019-2022 Jean-Baptiste Biernacki <j.biernacki@free.fr> +# + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# Mageia version 7 or later, cauldron. +MAGEIA_VERSION=${MAGEIA_VERSION:="8"} +# Arm version armv7hl, aarch64 +ARM_VERSION="aarch64" + +# Target plateform (odroid or rpi) +TARGET="Delta" +# Target version (0,2,3 for raspi, 3 or 4 for odroid) +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. +# ID_USER="user" +# PASSWORD="user" + +#root password +#If not set, no root password, at the first login, the system will ask for a password. +# ROOT_PWD="root" + +#Hostname +#If not define, the default value will be "localhost.localdomain". +# HOSTNAME="${TARGET}" + +#Filesystem of boot partitions (default ext4 raspberry pi need vfat) +SEPARATE_BOOT_PARTITION=1 +BOOTFS="vfat" + +#kernel package to install +KERNEL="kernel-desktop" + +#Size of the image by default +IMAGE_SIZE=1 + +#The arguments for the Kernel +BOOT_ARGS='' diff --git a/platforms/freebox-delta/second_stage_install.sh b/platforms/freebox-delta/second_stage_install.sh new file mode 100644 index 0000000..27339bf --- /dev/null +++ b/platforms/freebox-delta/second_stage_install.sh @@ -0,0 +1,173 @@ +#!/bin/bash + +# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com> +# Copyright (C) 2019-2020 Jean-Baptiste Biernacki <j.biernacki@free.fr> +# + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +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 + +# #################################################### +# ## 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 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/ + +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 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" "Nonfree Updates" +<INSTALL_EXEC> --media "Nonfree Release,Nonfree Updates" iwlwifi-firmware +# kernel-firmware-nonfree + +<INSTALL_EXEC> --noscripts u-boot grub2-common grub2-efi grub2-mageia-theme u-boot-tools + + +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/ + + +# ############################ +# ## For compiling a module ## +# ############################ +# BUG : Make does not like to build inside chroot. It doesn't find tools. Impossible to build any module there. +# <INSTALL_EXEC> kernel-source-latest +# #See if it is a Server or Desktop kernel : +# rpm -q kernel-serveur-latest +# if [ 0 -ne ${?} ]; then +# K_INST_VERSION=$(rpm -q kernel-desktop-latest | sed -e 's/kernel-\([[:alnum:]]*\)-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\2-\1-\3/' ) +# else +# K_INST_VERSION=$(rpm -q kernel-serveur-latest | sed -e 's/kernel-\([[:alnum:]]*\)-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\2-\1-\3/' ) +# fi +# #Recover the kernel module path : +# K_MOD_PATH=$(urpmf "modules/${K_INST_VERSION}$" | cut -d ':' -f 2) +# #Recover the source version : +# K_SRC_VERSION=$(rpm -q kernel-source-latest | sed -e 's/kernel-source-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\1-\2/' ) +# #Recover the source path : +# K_SRC_PATH=$(urpmf "src/kernel-${K_SRC_VERSION}$" | cut -d ':' -f 2) +# #Set the default Mageia's configuration file into the source path : +# cp /boot/config-${K_INST_VERSION} ${K_SRC_PATH}/.config +# ## Can't go further... Make does not like to build inside chroot. It doesn't find tools. +# ## Impossible to build any module there. + + +# ########################### +# ## 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} + + +########################################### +## Install a package from testing repo : ## +########################################### +# urpmi.update Testing +# 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 : ## +############################################### + ## As long as the first installed kernel remains installed, the boot.scr script will continue to work, even if the extlinux.conf file is not working with uboot anymore. +# #Last rpm package : +# KERNELRPM=$(rpm -qa --last | grep "^kernel-[sd]e[[:alpha:]]*-[[:digit:]]" | head -n 1 | cut -d ' ' -f 1 | sed -e 's/\(kernel-[[:alnum:]]*-[\.[:digit:]]*-[\.[:alnum:]]*\)-.*/\1/' ) +# #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 +# Normally, /boot/vmlinuz is generated with the /sbin/installkernel script, but it is not generated with chroot. +# rm -f /boot/vmlinuz +# ln -r -s "${VMLINUZ}" /boot/vmlinuz #For extlinux.conf + + +################################ +## Create the extlinux script ## +################################ +# BUG : installkernel call bootloader-config which doesn't process inside a chroot. +# echo -e "\nTrying to generate extlinux script\n" +# K_INST_VERSION=$(rpm -q kernel-desktop-latest | sed -e 's/kernel-\([[:alnum:]]*\)-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\2-\1-\3/') +# /sbin/installkernel %{kversion}-$kernel_flavour-%{buildrpmrel} +# bash -x /sbin/installkernel ${K_INST_VERSION} +# 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 +/usr/bin/chown :daemon /etc/wpa_supplicant.conf +/usr/bin/chown :tty /bin/write /bin/wall +/usr/bin/chown :lock /sbin/lockdev +/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/freebox-delta/specialFunctions.sh b/platforms/freebox-delta/specialFunctions.sh new file mode 100755 index 0000000..2340356 --- /dev/null +++ b/platforms/freebox-delta/specialFunctions.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com> +# Copyright (C) 2019-2020 Jean-Baptiste Biernacki <j.biernacki@free.fr> +# + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# SFdisk partitionment commands : +SFDISK_SCRIPT=",128M,U,*\n,,L,\nwrite\n" + + +function preImgCreation() +{ + # Nothing to do. + return 0 +} + + +function postPrepareChroot() +{ + # 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 +} + +function bunrningBootloader() +{ + # DEVICE is set just before this function and looped. + title "Burning the bootloader..." + 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() +{ + # Remove the file given environment variable in the chroot. + rm -f ${BUILD_PATH}/to_source.sh + return 0 +} |