1
0

Fixed extlinux for BananaPro, add initrd for root=UUID.

This commit is contained in:
Jybz 2019-12-30 13:12:45 +01:00
parent 68db69c9bf
commit 4c91542775
6 changed files with 709 additions and 630 deletions

3
.gitignore vendored
View File

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

View File

@ -119,15 +119,18 @@ menu title Welcome to Mageia-Minimal.
label linux label linux
kernel /boot/vmlinuz kernel /boot/vmlinuz
initrd /boot/initrd.img
fdtdir /usr/lib/<FDTDIR> fdtdir /usr/lib/<FDTDIR>
append root=UUID=<UUID> <BOOT_ARGS> append root=UUID=<UUID> <BOOT_ARGS>
``` ```
Les balises : Les balises :
- <FDTDIR> est automatiquement généré par le script ./mageia4arm/create_arm_img_urpmi.sh - <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 - <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 - <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"/> <a id="fr_file-others"/>
#### Autres #### Autres
Bien sûr, d'autres fichiers sont nécessaires. Il faut avoir l'arborescence du matériel (soit DTB/DTS, soit script.bin), le chargeur de démarrage spécifique à la plateforme ainsi qu'un noyau compatible avec l'architecture de la plateforme. Bien sûr, d'autres fichiers sont nécessaires. Il faut avoir l'arborescence du matériel (soit DTB/DTS, soit script.bin), le chargeur de démarrage spécifique à la plateforme ainsi qu'un noyau compatible avec l'architecture de la plateforme.
@ -144,7 +147,7 @@ dd if=./build/Mageia-7-bananaPro1.img of=/dev/mmcblkX
``` ```
On peut ajouter une barre de progression : 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"/> <a id="fr_compress"/>
@ -155,7 +158,7 @@ dd if=./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaP
``` ```
Avec une barre d'avancement : 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.gzip
``` ```
Il est possible d'utiliser d'autre logiciel de compression comme xz par exemple. Il est possible d'utiliser d'autre logiciel de compression comme xz par exemple.
@ -311,15 +314,17 @@ menu title Welcome to Mageia-Minimal.
label linux label linux
kernel /boot/vmlinuz kernel /boot/vmlinuz
initrd /boot/initrd.img
fdtdir /usr/lib/<FDTDIR> fdtdir /usr/lib/<FDTDIR>
append root=UUID=<UUID> <BOOT_ARGS> append root=UUID=<UUID> <BOOT_ARGS>
``` ```
The tags : The tags :
- <FDTDIR> is automatically generated by the script ./mageia4arm/create_arm_img_urpmi.sh - <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 - <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/<LaPlateforme>/mageia4arm.cfg - <BOOT_ARGS> is defined in the configuration file ./mageia4arm/platforms/<LaPlateforme>/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"/> <a id="en_file-others"/>
#### others #### others
Of course, other files are necessary. The device tree (DTB/DTS or script.bin) is necessary, a specific bootloader for the platform and a compatible kernel with that architecture. Of course, other files are necessary. The device tree (DTB/DTS or script.bin) is necessary, a specific bootloader for the platform and a compatible kernel with that architecture.

View File

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

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

View File

@ -32,6 +32,7 @@ export ARCH=arm
# ############################ # ############################
# ## For compiling a module ## # ## 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 # /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 : # #See if it is a Server or Desktop kernel :
# rpm -q kernel-serveur-latest # rpm -q kernel-serveur-latest
@ -57,13 +58,16 @@ export ARCH=arm
# #################################################### # ####################################################
# #Set the kernel name : # #Set the kernel name :
# KERNELVERSION="5.3.7-desktop-4.mga7" # 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 : # #Set the list of added modules and omitted modules :
# DRIVER_ADD_LIST="8250_dw" # DRIVER_ADD_LIST="8250_dw"
# DRIVER_OMI_LIST="drm" # DRIVER_OMI_LIST="drm"
# #Create a configuration file inside the FS, it will be used by dracut for all kernel update # #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 # 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 : # #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 : # #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/'.*$//" )" # 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. # #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 : #Get the vmlinuz file :
VMLINUZ=$(ls --sort=time -1 /boot/vmlinuz-[[:digit:]]* | head -n 1) VMLINUZ=$(ls --sort=time -1 /boot/vmlinuz-[[:digit:]]* | head -n 1)
rm -f /boot/uvmlinuz 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 ## ## Create the extlinux script ##
################################ ################################
# BUG : installkernel call bootloader-config which doesn't process inside a chroot.
# echo -e "\nTrying to generate extlinux script\n" # 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} # /sbin/installkernel %{kversion}-$kernel_flavour-%{buildrpmrel}
# bash -x /sbin/installkernel ${K_INST_VERSION} # bash -x /sbin/installkernel ${K_INST_VERSION}
# perl -d /usr/sbin/bootloader-config --kernel-version ${K_INST_VERSION} --initrd-options '' --action add-kernel # 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" # echo -e "\nEnd trying to generate extlinux script with errcode ${?}\n"