1
0

rpi3b+64b

This commit is contained in:
Jybz 2020-01-05 12:26:18 +01:00 committed by Neal Gompa
parent e52a9a4871
commit 86a52fa755
6 changed files with 92 additions and 38 deletions

View File

@ -274,27 +274,27 @@ function preparechroot()
info "Preparation for setting root and user account"
if [ -n "${ROOT_PWD}" ]; then #If root password defined, it will be setted at the end of the chroot of the second_stage_install.sh script
echo -e " /bin/passwd << EOF\n${ROOT_PWD}\n${ROOT_PWD}\nEOF\n" >>"${BUILD_PATH}/second_stage_install.sh"
echo -e "/bin/passwd << EOF\n${ROOT_PWD}\n${ROOT_PWD}\nEOF\n" >>"${BUILD_PATH}/second_stage_install.sh"
else
info "No root password... One password will be set at the first login."
echo -e " /bin/passwd -d root\n /bin/passwd -e root\n" >>"${BUILD_PATH}/second_stage_install.sh"
echo -e "/bin/passwd -d root\n/bin/passwd -e root\n" >>"${BUILD_PATH}/second_stage_install.sh"
fi
if [ -n "${ID_USER}" ]; then #If user ID defined, it will be setted at the end of the chroot of the second_stage_install.sh script
echo -e " /sbin/useradd ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
if [ -n "${PASSWORD}" ]; then
echo -e " /bin/passwd ${ID_USER} << EOF\n${PASSWORD}\n${PASSWORD}\nEOF" >>"${BUILD_PATH}/second_stage_install.sh"
echo -e "/bin/passwd ${ID_USER} << EOF\n${PASSWORD}\n${PASSWORD}\nEOF" >>"${BUILD_PATH}/second_stage_install.sh"
else
echo -e " /bin/passwd -d ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
echo -e "/bin/passwd -d ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
fi
else
info "No user defined, no user account created."
fi
# BUG: This line break the default .bashrc file from the package "rootfiles" and the values as PATH (and /usr/sbin programs).
# info "Copying skel in root directory"
# /bin/rsync -rlptH "${BUILD_PATH}/etc/skel/" "${BUILD_PATH}/root/"
#This line break the default .bashrc file from the package "rootfiles" and the values as PATH (and /usr/sbin programs).
postPrepareChroot
if [ ${?} -ne 0 ]; then
@ -907,7 +907,7 @@ IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}${TARGET_VERSION}.img"
BOOT="/mnt/boot"
ROOT="/mnt/root"
BUILD_PATH="${INSTALL_PATH}/build-${TARGET}${TARGET_VERSION}"
ARM_VERSION="armv7hl"
# ARM_VERSION="armv7hl"
# Assigne a script for creating a particular target image (rpi, odroid, ...)
if [ -e "${CONFIG_PATH}/specialFunctions.sh" ]; then

View File

@ -17,6 +17,7 @@
MAGEIA_VERSION="7"
ARM_VERSION="aarch64"
# ARM_VERSION="armv7hl"
#target plateform (xu3-4 or rpi)
TARGET="rpi"
@ -38,11 +39,11 @@ BUILD_PATH="${INSTALL_PATH}/build"
IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}.img"
#Default user
ID_USER="pi"
PASSWORD="raspberry"
# ID_USER="pi"
# PASSWORD="raspberry"
#root password
ROOT_PWD="piroot"
# ROOT_PWD="piroot"
#Hostname
HOSTNAME="${TARGET}"
@ -61,5 +62,40 @@ BOOT_ARGS='dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console
#Path where the raspberry pi firmware is/will be installed
FIRMWARE_PATH="$INSTALL_PATH"
FIRMWARE_DIR="firmware-stable"
FIRMWARE_DOWNLOAD_URL="https://github.com/raspberrypi/firmware/archive/stable.zip"
INFORMATION="
https://elinux.org/RPi_Software
https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md
https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin
https://github.com/raspberrypi/firmware/blob/master/boot/bcm2710-rpi-3-b-plus.dtb
https://github.com/raspberrypi/firmware/blob/master/boot/fixup.dat
https://github.com/raspberrypi/firmware/blob/master/boot/start.elf
https://github.com/raspberrypi/firmware/blob/master/boot/fixup4.dat #Rpi4
https://github.com/raspberrypi/firmware/blob/master/boot/start4.elf #Rpi4
#Debug (implicitly used with start_debug=1)
https://github.com/raspberrypi/firmware/blob/master/boot/fixup_db.dat
https://github.com/raspberrypi/firmware/blob/master/boot/start_db.elf
https://github.com/raspberrypi/firmware/blob/master/boot/start4db.elf #Rpi4
https://github.com/raspberrypi/firmware/blob/master/boot/fixup4db.dat #Rpi4
#Low GPU Memory (=16MB)
https://github.com/raspberrypi/firmware/blob/master/boot/fixup_cd.dat
https://github.com/raspberrypi/firmware/blob/master/boot/start_cd.elf
https://github.com/raspberrypi/firmware/blob/master/boot/start4cd.elf #Rpi4
https://github.com/raspberrypi/firmware/blob/master/boot/fixup4cd.dat #Rpi4
#Testing versions (eXtra features) (like camera module) (implicitly used with start_x=1 ) :
https://github.com/raspberrypi/firmware/blob/master/boot/fixup_x.dat
https://github.com/raspberrypi/firmware/blob/master/boot/start_x.elf
https://github.com/raspberrypi/firmware/blob/master/boot/start4x.elf #Rpi4
https://github.com/raspberrypi/firmware/blob/master/boot/fixup4x.dat #Rpi4
"
FIRMWARE_DOWNLOAD_URL="https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin
https://github.com/raspberrypi/firmware/raw/master/boot/bcm2710-rpi-3-b-plus.dtb
https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat
https://github.com/raspberrypi/firmware/raw/master/boot/start.elf
https://github.com/raspberrypi/firmware/raw/master/boot/fixup_x.dat
https://github.com/raspberrypi/firmware/raw/master/boot/start_x.elf
"

View File

@ -1,6 +1,7 @@
#!/bin/bash
# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com>
# Copyright (C) 2019-2020 Jean-Baptiste Biernacki <j.biernacki@free.fr>
#
# This program is free software; you can redistribute it and/or modify
@ -16,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
export ARCH=arm
/usr/bin/chown :shadow /etc/shadow /etc/gshadow /etc/login.defs /etc/pam.d/chage-chfn-chsh /etc/pam.d/chpasswd-newusers /etc/pam.d/system-auth /etc/pam.d/user-group-mod /bin/passwd /bin/chage
/usr/bin/chown :systemd-journal -R /var/log/journal
@ -33,11 +36,20 @@
/usr/bin/chown :bin /sbin/traceroute
/usr/bin/chown polkitd /etc/polkit-1/rules.d
KV=`basename /boot/vmlinuz-*`
KV=${KV#vmlinuz-}
dracut --kver $KV
rm -f $0
cp /boot/vmlinuz-* /boot/vmlinuz
cp /boot/initrd-* /boot/initrd
# KV=$(basename /boot/vmlinuz-*)
# KV=${KV#vmlinuz-}
# dracut --kver $KV
VMLINUZ=$(ls --sort=time -1 /boot/vmlinuz-[[:digit:]]* | head -n 1)
# Normally, /boot/vmlinuz is generated with the /sbin/installkernel script, but it is not generated with chroot.
rm -f /boot/vmlinuz
ln -r -s "${VMLINUZ}" /boot/vmlinuz #For extlinux.conf
rm -f ${0}
K_INST_VERSION=$(rpm -q kernel-desktop-latest | sed -e 's/kernel-\([[:alnum:]]*\)-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\2-\1-\3/')
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
echo "Dracut done."
alternatives --set soundprofile /etc/sound/profiles/alsa

View File

@ -40,29 +40,35 @@ FDISK_SCRIPT="${NEW_PART}\n${PRIMARY}\n${PART_BOOT}\n${PART_BOOT_FIRST_SECTOR}\n
function preImgCreation()
{
title "Download binary blob for Rpi"
for i in ${FIRMWARE_DOWNLOAD_URL}; do
info "Download ${i}"
curl -L -O -J ${i} -s
done
# if ! [ -d "${FIRMWARE_PATH}/${FIRMWARE_DIR}" ]; then # the firmware directory does not exists
# echo "$(ls *.zip| wc -l)"
# if [ "$(ls *.zip| wc -l)" -eq 0 ]; then # the firmware archive does not exists
# warning "The raspberry pi firmware need to be downloaded"
# info "Downloading FIRMWARE_FILENAME"
# wget ${FIRMWARE_DOWNLOAD_URL}
# # curl -L -O -J ${FIRMWARE_DOWNLOAD_URL}
# # curl -L ${FIRMWARE_DOWNLOAD_URL} -o firmware-stable.zip
# if [ ${?} -ne 0 ]; then
# error "line ${LINENO} error downloading raspberry firmware at ${FIRMWARE_DOWNLOAD_URL}: exiting"
# exit 1
# fi
# fi
# info "extracting firmware"
# unzip -d "${FIRMWARE_PATH}" *.zip
# if [ ${?} -ne 0 ]; then
# error "line ${LINENO} error unzipping ${FIRMWARE_PATH} : exiting"
# exit 1
# fi
# fi
title "Creating Pi image"
if ! [ -d "${FIRMWARE_PATH}/${FIRMWARE_DIR}" ]; then # the firmware directory does not exists
echo "$(ls *.zip| wc -l)"
if [ "$(ls *.zip| wc -l)" -eq 0 ]; then # the firmware archive does not exists
warning "The raspberry pi firmware need to be downloaded"
info "Downloading FIRMWARE_FILENAME"
wget ${FIRMWARE_DOWNLOAD_URL}
# curl -L -O -J ${FIRMWARE_DOWNLOAD_URL}
# curl -L ${FIRMWARE_DOWNLOAD_URL} -o firmware-stable.zip
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error downloading raspberry firmware at ${FIRMWARE_DOWNLOAD_URL}: exiting"
exit 1
fi
fi
info "extracting firmware"
unzip -d "${FIRMWARE_PATH}" *.zip
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error unzipping ${FIRMWARE_PATH} : exiting"
exit 1
fi
fi
title "Making raspberry pi image"
return 0
}

Binary file not shown.