1
0

Merge branch 'master' of Jybz/mageia4arm into master

This commit is contained in:
DTux 2020-01-02 11:49:15 +00:00 committed by Gogs
commit 2c8c706aca
17 changed files with 111 additions and 1037 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
/build
/platforms/*/INFO/
/log
/log/
/log/*

View File

@ -108,8 +108,28 @@ Si l'une de ces fonctions ne retourne pas 0, la création de l'image échoue.
<a id="fr_file-extlinux"/>
#### extlinux.conf
Extlinux.conf est un script utilisé par le chargeur de démarrage (s'il est capable de le gérer, uboot le peut), pour spécifier le noyau à démarrer. Le script est normalement généré automatiquement par les outils de Mageia à chaque installation/mise à jour d'un noyau. Malheureusement, lors de la création d'une image de Mageia, l'outil refuse de générer ce fichier dans un chroot. For cette image, soit le fichier peut être omit, soit écrit par vous même.
TODO : Comment spécifier la ligne de commande pour un matériel spécifique ?
Extlinux.conf est un script utilisé par le chargeur de démarrage (s'il est capable de le gérer, uboot le peut), pour spécifier la version du noyau à démarrer. Le script est normalement généré automatiquement par les outils de Mageia à chaque installation/mise à jour d'un noyau. Malheureusement, lors de la création d'une image de Mageia en chroot, l'outil refuse de générer ce fichier, de plus si le fichier est manquant, lors de la mise à jour du noyau, l'outil de Mageia génère un fichier erroné avec des entrées vides que u-boot refuse.
Il vaut mieux créer ce fichier, même s'il n'est pas primordiale. D'autant plus que lors de la mise à jour d'un noyau, l'outil de Mageia reprends les arguments de la commande de démarrage pour les nouvelles versions.
La structure basique du fichier est :
```
default linux
timeout 20
menu title Welcome to Mageia-Minimal.
label linux
kernel /boot/vmlinuz
fdtdir /usr/lib/<FDTDIR>
append root=UUID=<UUID> <BOOT_ARGS>
```
Les balises :
- \<FDTDIR\> est automatiquement généré par le script ./mageia4arm/create_arm_img_urpmi.sh
- \<UUID\> est récupéré par le script ./mageia4arm/create_arm_img_urpmi.sh , il peut être nécessaire d'ajouter une initrd pour utiliser l'UUID, autrement il faut spécifier /dev/mmcblkXpY .
- \<BOOT_ARGS\> est défini dans le fichier ./mageia4arm/platforms/\<LaPlateforme\>/mageia4arm.cfg .
Il est possible d'ajouter la ligne `initrd /boot/initrd.img` si un fichier initrd a été généré par dracut.
<a id="fr_file-others"/>
#### Autres
@ -127,18 +147,18 @@ dd if=./build/Mageia-7-bananaPro1.img of=/dev/mmcblkX
```
On peut ajouter une barre de progression :
```
dd if=./build/Mageia-7-bananaPro1.img | pv -s $(ls -l ./build/Mageia-7-bananaPro1.img | cut -d ' ' -f 5) | dd of=/dev/mmcblkX
pv ./build/Mageia-7-bananaPro1.img | dd of=/dev/mmcblkX
```
<a id="fr_compress"/>
#### Compresser une image
Pour compresser l'image, de plusieurs Go en quelques centaines de Mo pour la mettre en ligne par exemple, il est possible d'exécuter la commande suivante :
```
dd if=./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaPro1.img.gzip
dd if=./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaPro1.img.gz
```
Avec une barre d'avancement :
```
dd if=./build/Mageia-7-bananaPro1.img | pv -s $(ls -l ./build/Mageia-7-bananaPro1.img | cut -d ' ' -f 5) | gzip -9 | dd of=./build/Mageia-7-bananaPro1.img.gzip
pv ./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaPro1.img.gz
```
Il est possible d'utiliser d'autre logiciel de compression comme xz par exemple.
@ -283,8 +303,27 @@ If one of this functions does not return 0, the process is stoped.
<a id="en_file-extlinux"/>
#### extlinux.conf
extlinux.conf is a script used by the bootloader (if it is able to handel, uboot does) in order to select specific kernel to start. This script is normaly automatically generated by Mageia's tools at each kernel installation/update. Unfortunately, when creating the image of Mageia, the tool refuse to generate the file in chroot. For the image, either the file can be omited, or write by yourself.
TODO : How to specify the command line specific for an hardware ?
extlinux.conf is a script used by the bootloader (if it is able to manage it, uboot does) in order to select specific kernel version to start with boot arguments. This script is normaly automatically generated by Mageia's tools at each kernel installation/update. Unfortunately, when creating the image of Mageia in chroot, the tool refuses to generate the file, moreover, if the file is missing, at the first kernel update, the tool will create it with empty entries which makes uboot failing to parse it.
It is better to generate this file, even if it isn't mandatory. It is even better as the tool take into account the boot arguments of previous kernel and add it for the new one and regenerate automatically the file.
The basic file is:
```
default linux
timeout 20
menu title Welcome to Mageia-Minimal.
label linux
kernel /boot/vmlinuz
fdtdir /usr/lib/<FDTDIR>
append root=UUID=<UUID> <BOOT_ARGS>
```
The tags :
- \<FDTDIR\> is automatically generated by the script ./mageia4arm/create_arm_img_urpmi.sh
- \<UUID\> is automatically reused bu the script ./mageia4arm/create_arm_img_urpmi.sh , it might be necessary to add an initrd in order to user the UUID, otherwise it should be specify /dev/mmcblkXpY .
- \<BOOT_ARGS\> is defined in the configuration file ./mageia4arm/platforms/\<ThePlatform\>/mageia4arm.cfg
It is also possible to add the line `initrd /boot/initrd.img` if a initrd file has been generated by dracut.
<a id="en_file-others"/>
#### others

View File

@ -406,8 +406,7 @@ function formatpartitions()
return 0
}
function copyingsystem()
function generateExtlinux()
{
info "Generate extlinux if extlinux.conf exists."
if [ -e "${CONFIG_PATH}/extlinux.conf" ]; then
@ -419,11 +418,19 @@ function copyingsystem()
fi
if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then
info "\tTuning extlinux.conf"
sed -e s/\<UUID\>/${ROOT_UUID}/g ${CONFIG_PATH}/extlinux.conf >"${BUILD_PATH}/boot/extlinux/extlinux.conf"
cp "${CONFIG_PATH}/extlinux.conf" "${BUILD_PATH}/boot/extlinux/extlinux.conf"
#In order to use the UUID, a initrd file is necessary.
sed -i -e "s/<UUID>/${ROOT_UUID}/g" "${BUILD_PATH}/boot/extlinux/extlinux.conf"
sed -i -e "s/<BOOT_ARGS>/${BOOT_ARGS}/g" "${BUILD_PATH}/boot/extlinux/extlinux.conf"
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"
fi
fi
}
function copyingsystem()
{
generateExtlinux
info "Remove second_stage_install.sh"
/bin/rm -f "${BUILD_PATH}/second_stage_install.sh"

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
menu Welcome to Mageia-Minimal.
timeout 20
default Mageia
label Mageia
kernel /boot/vmlinuz
initrd /boot/initrd.img
fdtdir /usr/lib/<FDTDIR>
append root=UUID=<UUID> <BOOT_ARGS>
label linux
kernel /boot/vmlinuz
fdtdir /usr/lib/<FDTDIR>
append root=/dev/mmcblk0p1 <BOOT_ARGS>

View File

@ -71,7 +71,10 @@ BOOTFS="ext4"
#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'
#Path where the raspberry pi firmware is/will be installed ( just needed for raspberry pi )
FIRMWARE_PATH="${INSTALL_PATH}/"
# FIRMWARE_PATH="${INSTALL_PATH}/"
#FIRMWARE_DIR="firmware-stable"
#FIRMWARE_DOWNLOAD_URL="https://github.com/raspberrypi/firmware/archive/stable.zip"

View File

@ -32,6 +32,7 @@ export ARCH=arm
# ############################
# ## For compiling a module ##
# ############################
# BUG : Make does not like to build inside chroot. It doesn't find tools. Impossible to build any module there.
# /usr/sbin/urpmi --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 0 kernel-source-latest
# #See if it is a Server or Desktop kernel :
# rpm -q kernel-serveur-latest
@ -57,13 +58,16 @@ export ARCH=arm
# ####################################################
# #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
# #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/${KERNELVERSION}" --xz --printsize --kernel-image /boot/vmlinuz --fstab initrd-${KERNELVERSION}.img ${KERNELVERSION} 2>&1 | tee /dev/tty )
# 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.
@ -94,17 +98,20 @@ export ARCH=arm
#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
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
################################
## 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/')
# 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
# /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"

View File

@ -4,7 +4,7 @@ default linux
label linux
kernel /boot/vmlinuz
append root=UUID=<UUID> dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0
append root=UUID=<UUID> <BOOT_ARGS>
fdtdir /usr/lib/<FDTDIR>
initrd /boot/initrd

View File

@ -54,6 +54,9 @@ HOSTNAME="$TARGET.$ID_USER"
#Filesystem of boot partitions (default ext4 raspberry pi need vfat)
BOOTFS="vfat"
#The arguments for the Kernel
BOOT_ARGS='dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0'
#Path where the raspberry pi firmware is/will be installed
FIRMWARE_PATH="$INSTALL_PATH"
FIRMWARE_DIR="firmware-stable"

View File

@ -4,7 +4,7 @@ default linux
label linux
kernel /boot/vmlinuz
append root=UUID=<UUID> dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0
append root=UUID=<UUID> <BOOT_ARGS>
fdtdir /usr/lib/<FDTDIR>
initrd /boot/initrd

View File

@ -54,6 +54,10 @@ HOSTNAME="$TARGET.$ID_USER"
#Filesystem of boot partitions (default ext4 raspberry pi need vfat)
BOOTFS="vfat"
#The arguments for the Kernel
BOOT_ARGS='dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0'
#Path where the raspberry pi firmware is/will be installed
FIRMWARE_PATH="$INSTALL_PATH"
FIRMWARE_DIR="firmware-stable"

View File

@ -4,7 +4,7 @@ default linux
label linux
kernel /boot/vmlinuz
append root=UUID=<UUID> dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0
append root=UUID=<UUID> <BOOT_ARGS>
fdtdir /usr/lib/<FDTDIR>
initrd /boot/initrd

View File

@ -54,6 +54,9 @@ HOSTNAME="$TARGET.$ID_USER"
#Filesystem of boot partitions (default ext4 raspberry pi need vfat)
BOOTFS="vfat"
#The arguments for the Kernel
BOOT_ARGS='dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0'
#Path where the raspberry pi firmware is/will be installed
FIRMWARE_PATH="$INSTALL_PATH"
FIRMWARE_DIR="firmware-stable"

View File

@ -4,7 +4,7 @@ default linux
label linux
kernel /boot/vmlinuz
append root=UUID=<UUID> dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0
append root=UUID=<UUID> <BOOT_ARGS>
fdtdir /usr/lib/<FDTDIR>
initrd /boot/initrd

View File

@ -58,6 +58,10 @@ HOSTNAME="$TARGET.$ID_USER"
#Filesystem of boot partitions (default ext4 raspberry pi need vfat)
BOOTFS="vfat"
#The arguments for the Kernel
BOOT_ARGS='dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0'
#Path where the raspberry pi firmware is/will be installed
FIRMWARE_PATH="$INSTALL_PATH"
FIRMWARE_DIR="firmware-stable"

View File

@ -4,7 +4,7 @@ default Mageia
label Mageia
kernel /boot/vmlinuz
append root=UUID=<UUID> dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0
append root=UUID=<UUID> <BOOT_ARGS>
fdtdir /usr/lib/<FDTDIR>
initrd /boot/initrd

View File

@ -49,5 +49,8 @@ HOSTNAME="xu4.odroid"
#Filesystem of boot partitions (default ext4)
BOOTFS=ext4
#The arguments for the Kernel
BOOT_ARGS='dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0'
#kernel package to install
KERNEL=kernel-odroid