Browse Source

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

Jybz 2 years ago
parent
commit
4c91542775
6 changed files with 57 additions and 214 deletions
  1. 3 0
      .gitignore
  2. 11 6
      README.md
  3. 10 3
      create_arm_img_urpmi.sh
  4. 11 195
      log/creation.log
  5. 11 6
      platforms/bananaPro/extlinux.conf
  6. 11 4
      platforms/bananaPro/second_stage_install.sh

+ 3 - 0
.gitignore

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

+ 11 - 6
README.md

@@ -119,15 +119,18 @@ menu title Welcome to Mageia-Minimal.
 
 label linux
   kernel /boot/vmlinuz
-  initrd /boot/initrd.img
   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
+- <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
 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 :  
 ```
-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"/>
@@ -155,7 +158,7 @@ dd if=./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaP
 ```  
 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.  
 
@@ -311,15 +314,17 @@ menu title Welcome to Mageia-Minimal.
 
 label linux
   kernel /boot/vmlinuz
-  initrd /boot/initrd.img
   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
+- <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
 
+
+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
 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.

+ 10 - 3
create_arm_img_urpmi.sh

@@ -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" -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-*)
             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 it is too large
+ 11 - 195
log/creation.log


+ 11 - 6
platforms/bananaPro/extlinux.conf

@@ -1,9 +1,14 @@
-default linux
+menu Welcome to Mageia-Minimal.
 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
-  kernel /boot/vmlinuz
-  initrd /boot/initrd.img
-  fdtdir /usr/lib/<FDTDIR>
-  append root=UUID=<UUID> <BOOT_ARGS>
+    kernel /boot/vmlinuz
+    fdtdir /usr/lib/<FDTDIR>
+    append root=/dev/mmcblk0p1 <BOOT_ARGS>

+ 11 - 4
platforms/bananaPro/second_stage_install.sh

@@ -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"
 
 

Some files were not shown because too many files changed in this diff