From 95c26b0ce4b38d4a656c1274f53f1af72a38c3a8 Mon Sep 17 00:00:00 2001 From: Jybz Date: Sat, 9 Nov 2019 18:39:37 +0000 Subject: [PATCH] Update --- platforms/bananaPro/boot.cmd | 19 ++--- platforms/bananaPro/second_stage_install.sh | 79 +++++++++++++-------- platforms/bananaPro/specialFunctions.sh | 12 ++-- 3 files changed, 62 insertions(+), 48 deletions(-) diff --git a/platforms/bananaPro/boot.cmd b/platforms/bananaPro/boot.cmd index daeeb63..c91cefb 100644 --- a/platforms/bananaPro/boot.cmd +++ b/platforms/bananaPro/boot.cmd @@ -1,24 +1,17 @@ -setenv KERNEL_FILE /boot/vmlinuz -setenv INIT_FILE /boot/initrd.img +setenv KERNEL_FILE /boot/uvmlinuz setenv DTB_FILE /boot/u-boot.dtb -#setenv DTB_FILE /boot/sun7i-a20-bananapro.dtb +setenv INIT_FILE /boot/initrd setenv KERNEL_ADDR 0x40008000 -setenv DTB_ADDR 0x48000000 -setenv INIT_ADDR 0x45000000 -#setenv INIT_ADDR - +setenv DTB_ADDR 0x45000000 +setenv INIT_ADDR 0x48000000 +setenv INIT_ADDR - ext4load mmc 0:1 ${KERNEL_ADDR} ${KERNEL_FILE} ext4load mmc 0:1 ${DTB_ADDR} ${DTB_FILE} -ext4load mmc 0:1 ${INIT_ADDR} ${INIT_FILE} +#ext4load mmc 0:1 ${INIT_ADDR} ${INIT_FILE} setenv bootargs console=ttyS0,115200 disp.screen0_output_mode=EDID:1024x768p50 hdmi.audio=EDID:0 root=/dev/mmcblk0p1 rootfstype=ext4 elevator=deadline rootwait #printenv bootz ${KERNEL_ADDR} ${INIT_ADDR} ${DTB_ADDR} - -#Compile boot.scr : mkimage -C none -A arm -T script -d "${CONFIG_PATH}/boot.cmd" "${CONFIG_PATH}/boot.scr" - -# ext4load mmc 0:1 0x40008000 /boot/vmlinuz -# ext4load mmc 0:1 0x48000000 /boot/u-boot.dtb -# bootz 0x40008000 - 0x48000000 diff --git a/platforms/bananaPro/second_stage_install.sh b/platforms/bananaPro/second_stage_install.sh index 7724014..b949eca 100644 --- a/platforms/bananaPro/second_stage_install.sh +++ b/platforms/bananaPro/second_stage_install.sh @@ -24,42 +24,62 @@ export ARCH=arm #Install all packages you need /usr/sbin/urpmi --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 0 basesystem chrony polkit lockdev rng-tools man openssh-server rfkill wireless-tools bluez wpa_supplicant make rsync kernel-desktop-latest binutils # systemd-bootchart libcap-utils keyutils mindi-busybox plymouth-scripts lvm2 #dmsetup + #For dracut : /usr/sbin/urpmi --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 0 u-boot-tools mindi-busybox plymouth-scripts #systemd-bootchart libcap-utils keyutils lvm2 #dmsetup +# ############################ +# ## For compiling a module ## +# ############################ +# /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 +# 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. -# echo "Install kernel from testing :" -# /usr/sbin/urpmi.update Testing -# /usr/sbin/urpmi --media Testing kernel-desktop-5.3.2-1.mga7 -# /usr/sbin/urpme kernel-desktop-5.2.13-2.mga7-1-1.mga7.armv7hl -# echo "Urpmi finished." -# dracut --no-compress --force 2>&1 -cd /boot -# -H, --hostonly -# Host-Only mode: Install only what is needed for booting the local host instead of a generic host and generate host-specific configuration. -# -# Warning -# If chrooted to another root other than the real root device, use "--fstab" and provide a valid /etc/fstab. +# #################################################### +# ## To embed a module inside the early boot initrd ## +# #################################################### +# #Set the kernel name : +# KERNELVERSION="5.3.7-desktop-4.mga7" +# #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 ) +# #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. +# mkimage -A arm -T ramdisk -C lzma -n initrd -d ${INITRD_FILE} "$(dirname "${INITRD_FILE}")/u$(basename "${INITRD_FILE}")" +# #generate a symlink relative r and symbolic s : +# rm -f /boot/initrd +# ln -r -s "$(dirname "${INITRD_FILE}")/u$(basename "${INITRD_FILE}")" /boot/initrd -#The FSTAB is not yet created... It is created only after the image creation... +############################################### +## Create a symlink for the lastest kernel : ## +############################################### +#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) +ln -r -s "${VMLINUZ}" /boot/uvmlinuz -# --fstab -# Use /etc/fstab instead of /proc/self/mountinfo. - -ARCH=arm CROSS_COMPILE=arm-linux-gnu- dracut --no-hostonly --local --no-early-microcode --add systemd --xz --printsize --kernel-image /boot/vmlinuz --fstab - -# ls -v1r /boot/vmlinuz* -# echo "--" -# ls -v1r /boot/vmlinuz-[[:digit:]]* -# rm -f /boot/vmlinuz -# ln -r -s $(ls -v1r /boot/vmlinuz-[[:digit:]]* | grep -m 1 "vmlinuz") ./boot/vmlinuz -# ls -v1r /boot/initrd-[[:digit:]]* -# rm -f /boot/initrd.img -cd /boot/ -# ln -r -s $(ls /initrd-* ) ./initrd.img -# echo "--" -# dracut --print-cmdline /usr/bin/chown :chrony -R /etc/chrony.keys /var/log/chrony /usr/bin/chown :daemon /etc/wpa_supplicant.conf @@ -68,4 +88,5 @@ cd /boot/ /usr/bin/chown :bin /sbin/traceroute /usr/bin/chown polkitd /etc/polkit-1/rules.d +# sleep 5s #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/bananaPro/specialFunctions.sh b/platforms/bananaPro/specialFunctions.sh index a26bc53..dfa67c9 100644 --- a/platforms/bananaPro/specialFunctions.sh +++ b/platforms/bananaPro/specialFunctions.sh @@ -37,14 +37,14 @@ function preImgCreation() function postPrepareChroot() { - info "copying kernel-desktop, dtb, boot.scr and vmlinuz symlink in ${BUILD_PATH}/boot" -# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/kernel-desktop-5.3.1-2.mga7-1-1.mga7.armv7hl.rpm" "${BUILD_PATH}/root/" +# info "copying kernel-desktop, dtb, boot.scr and vmlinuz symlink in ${BUILD_PATH}/boot" + info "copying dtb and boot.scr in ${BUILD_PATH}/boot" + #Generating uboot autoboot script : mkimage -C none -A arm -T script -d "${CONFIG_PATH}/boot.cmd" "${BUILD_PATH}/boot/boot.scr" - /usr/bin/cp --preserve=mode "${CONFIG_PATH}/sun7i-a20-bananapro.dtb" "${BUILD_PATH}/boot/" /usr/bin/cp --preserve=mode "${CONFIG_PATH}/u-boot.dtb" "${BUILD_PATH}/boot/" -# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/uboot.env" "${BUILD_PATH}/boot/" - /usr/bin/cp --preserve=mode -d "${CONFIG_PATH}/vmlinuz" "${BUILD_PATH}/boot/" - /usr/bin/cp --preserve=mode -r "${CONFIG_PATH}/lib" "${BUILD_PATH}/" +# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/sun7i-a20-bananapro.dtb" "${BUILD_PATH}/boot/" +# /usr/bin/cp --preserve=mode -d "${CONFIG_PATH}/vmlinuz" "${BUILD_PATH}/boot/" +# /usr/bin/cp --preserve=mode -r "${CONFIG_PATH}/lib" "${BUILD_PATH}/" return 0 }