Browse Source

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

Jybz 2 years ago
parent
commit
4c91542775
6 changed files with 709 additions and 630 deletions
  1. 3 0
      .gitignore
  2. 11 6
      README.md
  3. 10 3
      create_arm_img_urpmi.sh
  4. 663 611
      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 @@
1 1
 /build
2 2
 /platforms/*/INFO/
3 3
 /log
4
+/log/
5
+/log/*
6
+

+ 11 - 6
README.md

@@ -119,15 +119,18 @@ menu title Welcome to Mageia-Minimal.
119 119
 
120 120
 label linux
121 121
   kernel /boot/vmlinuz
122
-  initrd /boot/initrd.img
123 122
   fdtdir /usr/lib/<FDTDIR>
124 123
   append root=UUID=<UUID> <BOOT_ARGS>
125 124
 ```
126 125
 Les balises :
127 126
 - <FDTDIR> est automatiquement généré par le script ./mageia4arm/create_arm_img_urpmi.sh
128
-- <UUID> est récupéré par le script ./mageia4arm/create_arm_img_urpmi.sh
127
+- <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 .
129 128
 - <BOOT_ARGS> est défini dans le fichier ./mageia4arm/platforms/<LaPlateforme>/mageia4arm.cfg
130 129
 
130
+
131
+Il est possible d'ajouter la ligne `initrd /boot/initrd.img` si un fichier initrd a été généré par dracut.
132
+
133
+
131 134
 <a id="fr_file-others"/>
132 135
 #### Autres
133 136
 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
144 147
 ```
145 148
 On peut ajouter une barre de progression :  
146 149
 ```
147
-dd if=./build/Mageia-7-bananaPro1.img | pv -s $(ls -l ./build/Mageia-7-bananaPro1.img | cut -d ' ' -f 5) | dd of=/dev/mmcblkX
150
+pv ./build/Mageia-7-bananaPro1.img | dd of=/dev/mmcblkX
148 151
 ```
149 152
 
150 153
 <a id="fr_compress"/>
@@ -155,7 +158,7 @@ dd if=./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaP
155 158
 ```  
156 159
 Avec une barre d'avancement :  
157 160
 ```
158
-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
161
+pv ./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaPro1.img.gzip
159 162
 ```  
160 163
 Il est possible d'utiliser d'autre logiciel de compression comme xz par exemple.  
161 164
 
@@ -311,15 +314,17 @@ menu title Welcome to Mageia-Minimal.
311 314
 
312 315
 label linux
313 316
   kernel /boot/vmlinuz
314
-  initrd /boot/initrd.img
315 317
   fdtdir /usr/lib/<FDTDIR>
316 318
   append root=UUID=<UUID> <BOOT_ARGS>
317 319
 ```
318 320
 The tags :
319 321
 - <FDTDIR> is automatically generated by the script ./mageia4arm/create_arm_img_urpmi.sh
320
-- <UUID> is automatically reused bu the script ./mageia4arm/create_arm_img_urpmi.sh
322
+- <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 .
321 323
 - <BOOT_ARGS> is defined in the configuration file ./mageia4arm/platforms/<LaPlateforme>/mageia4arm.cfg
322 324
 
325
+
326
+It is also possible to add the line `initrd /boot/initrd.img` if a initrd file has been generated by dracut.
327
+
323 328
 <a id="en_file-others"/>
324 329
 #### others
325 330
 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()
406 406
     return 0
407 407
 }
408 408
 
409
-
410
-function copyingsystem()
409
+function generateExtlinux()
411 410
 {
412 411
     info "Generate extlinux if extlinux.conf exists."
413 412
     if [ -e "${CONFIG_PATH}/extlinux.conf" ]; then
@@ -419,11 +418,19 @@ function copyingsystem()
419 418
         fi
420 419
         if [ ! -f "${BUILD_PATH}/boot/extlinux/extlinux.conf" ]; then
421 420
             info "\tTuning extlinux.conf"
422
-            sed -e "s/<UUID>/${ROOT_UUID}/g" -e "s/<BOOT_ARGS>/${BOOT_ARGS}/g" ${CONFIG_PATH}/extlinux.conf >"${BUILD_PATH}/boot/extlinux/extlinux.conf"
421
+            cp "${CONFIG_PATH}/extlinux.conf" "${BUILD_PATH}/boot/extlinux/extlinux.conf"
422
+            #In order to use the UUID, a initrd file is necessary.
423
+            sed -i -e "s/<UUID>/${ROOT_UUID}/g" "${BUILD_PATH}/boot/extlinux/extlinux.conf"
424
+            sed -i -e "s/<BOOT_ARGS>/${BOOT_ARGS}/g"  "${BUILD_PATH}/boot/extlinux/extlinux.conf"
423 425
             KERNEL_ID=$(basename ${BUILD_PATH}/usr/lib/linux-*)
424 426
             sed -i -e "s/<FDTDIR>/${KERNEL_ID}/g" "${BUILD_PATH}/boot/extlinux/extlinux.conf"
425 427
         fi
426 428
     fi
429
+}
430
+
431
+function copyingsystem()
432
+{
433
+    generateExtlinux
427 434
     
428 435
     info "Remove second_stage_install.sh"
429 436
     /bin/rm -f "${BUILD_PATH}/second_stage_install.sh"

File diff suppressed because it is too large
+ 663 - 611
log/creation.log


+ 11 - 6
platforms/bananaPro/extlinux.conf

@@ -1,9 +1,14 @@
1
-default linux
1
+menu Welcome to Mageia-Minimal.
2 2
 timeout 20
3
-menu title Welcome to Mageia-Minimal.
3
+default Mageia
4
+
5
+label Mageia
6
+    kernel /boot/vmlinuz
7
+    initrd /boot/initrd.img
8
+    fdtdir /usr/lib/<FDTDIR>
9
+    append root=UUID=<UUID> <BOOT_ARGS>
4 10
 
5 11
 label linux
6
-  kernel /boot/vmlinuz
7
-  initrd /boot/initrd.img
8
-  fdtdir /usr/lib/<FDTDIR>
9
-  append root=UUID=<UUID> <BOOT_ARGS>
12
+    kernel /boot/vmlinuz
13
+    fdtdir /usr/lib/<FDTDIR>
14
+    append root=/dev/mmcblk0p1 <BOOT_ARGS>

+ 11 - 4
platforms/bananaPro/second_stage_install.sh

@@ -32,6 +32,7 @@ export ARCH=arm
32 32
 # ############################
33 33
 # ## For compiling a module ##
34 34
 # ############################
35
+# BUG : Make does not like to build inside chroot. It doesn't find tools. Impossible to build any module there.
35 36
 # /usr/sbin/urpmi --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 0 kernel-source-latest
36 37
 # #See if it is a Server or Desktop kernel :
37 38
 # rpm -q kernel-serveur-latest
@@ -57,13 +58,16 @@ export ARCH=arm
57 58
 # ####################################################
58 59
 # #Set the kernel name :
59 60
 # KERNELVERSION="5.3.7-desktop-4.mga7"
61
+K_INST_VERSION=$(rpm -q kernel-desktop-latest | sed -e 's/kernel-\([[:alnum:]]*\)-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\2-\1-\3/')
60 62
 # #Set the list of added modules and omitted modules :
61 63
 # DRIVER_ADD_LIST="8250_dw"
62 64
 # DRIVER_OMI_LIST="drm"
63 65
 # #Create a configuration file inside the FS, it will be used by dracut for all kernel update
64 66
 # 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
65 67
 # #Generate the initrd :
66
-# 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 )
68
+# 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 )
69
+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}
70
+ln -r -s /boot/initrd-${K_INST_VERSION}.img /boot/initrd.img
67 71
 # #Add the uboot header to the initrd file, first, find the file :
68 72
 # INITRD_FILE="$(echo "${OUTPUT}" | grep "Creating initramfs image file" | sed -e "s/^[*:[:space:][:alnum:]]*'//" -e "s/'.*$//" )"
69 73
 # #Add the uboot header, the result file will contain a 'u' as prefix-name.
@@ -94,17 +98,20 @@ export ARCH=arm
94 98
 #Get the vmlinuz file :
95 99
 VMLINUZ=$(ls --sort=time -1 /boot/vmlinuz-[[:digit:]]* | head -n 1)
96 100
 rm -f /boot/uvmlinuz
97
-ln -r -s "${VMLINUZ}" /boot/uvmlinuz
101
+ln -r -s "${VMLINUZ}" /boot/uvmlinuz #For the uboot script
102
+# Normally, /boot/vmlinuz is generated with the /sbin/installkernel script, but it is not generated with chroot.
103
+ln -r -s "${VMLINUZ}" /boot/vmlinuz #For extlinux.conf
98 104
 
99 105
 ################################
100 106
 ## Create the extlinux script ##
101 107
 ################################
108
+# BUG : installkernel call bootloader-config which doesn't process inside a chroot.
102 109
 # echo -e "\nTrying to generate extlinux script\n"
103
-K_INST_VERSION=$(rpm -q kernel-desktop-latest | sed -e 's/kernel-\([[:alnum:]]*\)-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\2-\1-\3/')
110
+# K_INST_VERSION=$(rpm -q kernel-desktop-latest | sed -e 's/kernel-\([[:alnum:]]*\)-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\2-\1-\3/')
104 111
 # /sbin/installkernel %{kversion}-$kernel_flavour-%{buildrpmrel}
105 112
 # bash -x /sbin/installkernel ${K_INST_VERSION}
106 113
 # perl -d /usr/sbin/bootloader-config --kernel-version ${K_INST_VERSION} --initrd-options '' --action add-kernel
107
-/usr/sbin/bootloader-config --kernel-version ${K_INST_VERSION} --initrd-options '' --action add-kernel
114
+# /usr/sbin/bootloader-config --kernel-version ${K_INST_VERSION} --initrd-options '' --action add-kernel
108 115
 # echo -e "\nEnd trying to generate extlinux script with errcode ${?}\n"
109 116
 
110 117