diff options
-rwxr-xr-x | create_arm_image.sh | 46 | ||||
-rw-r--r-- | platforms/mageia4arm.cfg | 66 | ||||
-rw-r--r-- | platforms/rpi4/10-vchiq-permissions.rules | 1 | ||||
-rw-r--r-- | platforms/rpi4/bcm2711-rpi-4-b.dtb | bin | 0 -> 40988 bytes | |||
-rw-r--r-- | platforms/rpi4/brcmfmac43430-sdio.txt | 66 | ||||
-rw-r--r-- | platforms/rpi4/brcmfmac43455-sdio.clm_blob | bin | 0 -> 11231 bytes | |||
-rw-r--r-- | platforms/rpi4/brcmfmac43455-sdio.txt | 92 | ||||
-rw-r--r-- | platforms/rpi4/extlinux.conf | 10 | ||||
-rw-r--r-- | platforms/rpi4/mageia4arm.cfg | 101 | ||||
-rw-r--r-- | platforms/rpi4/mageia4arm.cfg.original | 56 | ||||
-rw-r--r-- | platforms/rpi4/modprobe.conf | 3 | ||||
-rw-r--r-- | platforms/rpi4/second_stage_install.sh | 55 | ||||
-rwxr-xr-x | platforms/rpi4/specialFunctions.sh | 159 |
13 files changed, 641 insertions, 14 deletions
diff --git a/create_arm_image.sh b/create_arm_image.sh index 2754368..28ef4fe 100755 --- a/create_arm_image.sh +++ b/create_arm_image.sh @@ -128,12 +128,21 @@ function genusemirroroptions() DNF_MIRROROPTS="--config=${DNF_CONFIGPATH} --forcearch=${ARM_VERSION} --nogpgcheck --releasever=${MAGEIA_VERSION}" if [ ! -z "${MIRROR}" ]; then - DNF_MIRROROPTS="${DNF_MIRROROPTS} --disablerepo=* --repofrompath=mgarel,${MIRROR}/media/core/release/ --repofrompath=mgaup,${MIRROR}/media/core/updates/ --enablerepo=mgarel --enablerepo=mgaup" + DNF_MIRROROPTS="${DNF_MIRROROPTS} --disablerepo=* --repofrompath=mgarel,${MIRROR}/media/core/release/ --enablerepo=mgarel" + if [ "${MAGEIA_VERSION}" != "cauldron" ]; then + DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup,${MIRROR}/media/core/updates/ --enablerepo=mgaup" + fi if [ ${NONFREE} -eq 1 ]; then - DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-nonfree,${MIRROR}/media/nonfree/release/ --repofrompath=mgaup-nonfree,${MIRROR}/media/nonfree/updates/ --enablerepo=mgarel-nonfree --enablerepo=mgaup-nonfree" + DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-nonfree,${MIRROR}/media/nonfree/release/ --enablerepo=mgarel-nonfree " + if [ "${MAGEIA_VERSION}" != "cauldron" ]; then + DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup-nonfree,${MIRROR}/media/nonfree/updates/ --enablerepo=mgaup-nonfree" + fi fi if [ ${TAINTED} -eq 1 ]; then - DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-tainted,${MIRROR}/media/tainted/release/ --repofrompath=mgaup-tainted,${MIRROR}/media/tainted/updates/ --enablerepo=mgarel-tainted --enablerepo=mgaup-tainted" + DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-tainted,${MIRROR}/media/tainted/release/ --enablerepo=mgarel-tainted " + if [ "${MAGEIA_VERSION}" != "cauldron" ]; then + DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup-tainted,${MIRROR}/media/tainted/updates/ --enablerepo=mgaup-tainted" + fi fi fi export DNF_MIRROROPTS @@ -143,16 +152,21 @@ function genusemirroroptions() # enabling extra Mageia repositories function enableextrarepos() { - if [ "${MAGEIA_VERSION}" = "cauldron" ]; then - extrasect_baseprefix="cauldron" - extrasect_updatesprefix="cauldron-updates" - else - extrasect_baseprefix="mageia" - extrasect_updatesprefix="updates" - fi + extrasect_baseprefix="mageia" + # if [ "${MAGEIA_VERSION}" = "cauldron" ]; then + # extrasect_baseprefix="cauldron" + # extrasect_updatesprefix="" + # else + # extrasect_baseprefix="mageia" + extrasect_updatesprefix="updates" + # fi if [ ${NONFREE} -eq 1 ]; then title "activating non-free repos" - /usr/bin/dnf --installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-nonfree" --set-enabled "${extrasect_updatesprefix}-${ARM_VERSION}-nonfree" + DNFPARAM=--installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-nonfree" + if [ "${MAGEIA_VERSION}" != "cauldron" ]; then + DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-nonfree" + fi + /usr/bin/dnf $DNFPARAM; err=${?} if [ ${err} -ne 0 ]; then error "line ${LINENO} error ${err} - can't activate nonfree repositories : exiting" @@ -161,7 +175,11 @@ function enableextrarepos() fi if [ ${TAINTED} -eq 1 ]; then title "activating tainted repos" - /usr/bin/dnf --installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-tainted" --set-enabled "${extrasect_updatesprefix}-${ARM_VERSION}-tainted" + DNFPARAM=--installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-tainted" + if [ "${MAGEIA_VERSION}" != "cauldron" ]; then + DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-tainted" + fi + /usr/bin/dnf $DNFPARAM² err=${?} if [ ${err} -ne 0 ]; then error "line ${LINENO} error ${err} - can't activate tainted repositories : exiting" @@ -992,7 +1010,7 @@ case ${OPT} in genusemirroroptions #Generate mirror options, if needed installbasesystem #Generate the rootfs, rootfiles, ... enableextrarepos - addurpmimedia +# addurpmimedia mkfstab preparechroot jumpchroot @@ -1001,7 +1019,7 @@ case ${OPT} in MIRROR= genusemirroroptions enableextrarepos - addurpmimedia +# addurpmimedia mountPartitions copyingsystem unmountingPartitions diff --git a/platforms/mageia4arm.cfg b/platforms/mageia4arm.cfg new file mode 100644 index 0000000..78e2698 --- /dev/null +++ b/platforms/mageia4arm.cfg @@ -0,0 +1,66 @@ + +# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Mageia version 7 or later, cauldron. +# TO MODIFY +MAGEIA_VERSION="" +# Arm version armv7hl, aarch64 +# TO MODIFY +ARM_VERSION="" + +# Target plateform (odroid or rpi) +# TO MODIFY +TARGET="" +# Target version (0,2,3 for raspi, 3 or 4 for odroid) +#TO MODIFY +TARGET_VERSION="" + +# URL of the Mageia mirror used to install ( see mirrors.mageia.org ) +MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION" + +# image will be created here +# TO MODIFY +INSTALL_PATH="/path/to/$TARGET" + +# Build directory will be created here +BUILD_PATH="$INSTALL_PATH/build" + +#name of the image +IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET.img" + +#Mount point of image's partitions +BOOT="/mnt/boot" +ROOT="/mnt/root" + +# Default user +# TO MODIFY +ID_USER="user login" +PASSWORD="user password" + +#root password +ROOT_PWD="root password" + +#Hostname +HOSTNAME="$TARGET.$ID_USER" + +#Filesystem of boot partitions (default ext4 raspberry pi need vfat) +#BOOTFS=ext4 + +#kernel package to install (just needed for odroid) +#KERNEL=kernel-odroid + +#Path where the raspberry pi firmware is/will be installed ( just needed for raspberry pi ) +FIRMWARE_PATH="$INSTALL_PATH/" diff --git a/platforms/rpi4/10-vchiq-permissions.rules b/platforms/rpi4/10-vchiq-permissions.rules new file mode 100644 index 0000000..bacea0e --- /dev/null +++ b/platforms/rpi4/10-vchiq-permissions.rules @@ -0,0 +1 @@ +SUBSYSTEM=="vchiq",GROUP="video",MODE="0660" diff --git a/platforms/rpi4/bcm2711-rpi-4-b.dtb b/platforms/rpi4/bcm2711-rpi-4-b.dtb Binary files differnew file mode 100644 index 0000000..f078295 --- /dev/null +++ b/platforms/rpi4/bcm2711-rpi-4-b.dtb diff --git a/platforms/rpi4/brcmfmac43430-sdio.txt b/platforms/rpi4/brcmfmac43430-sdio.txt new file mode 100644 index 0000000..ea4f648 --- /dev/null +++ b/platforms/rpi4/brcmfmac43430-sdio.txt @@ -0,0 +1,66 @@ +# NVRAM file for BCM943430WLPTH +# 2.4 GHz, 20 MHz BW mode + +# The following parameter values are just placeholders, need to be updated. +manfid=0x2d0 +prodid=0x0727 +vendid=0x14e4 +devid=0x43e2 +boardtype=0x0727 +boardrev=0x1101 +boardnum=22 +macaddr=00:90:4c:c5:12:38 +sromrev=11 +boardflags=0x00404201 +boardflags3=0x08000000 +xtalfreq=37400 +nocrc=1 +ag0=255 +aa2g=1 +ccode=ALL + +pa0itssit=0x20 +extpagain2g=0 +#PA parameters for 2.4GHz, measured at CHIP OUTPUT +pa2ga0=-168,7161,-820 +AvVmid_c0=0x0,0xc8 +cckpwroffset0=5 + +# PPR params +maxp2ga0=84 +txpwrbckof=6 +cckbw202gpo=0 +legofdmbw202gpo=0x66111111 +mcsbw202gpo=0x77711111 +propbw202gpo=0xdd + +# OFDM IIR : +ofdmdigfilttype=18 +ofdmdigfilttypebe=18 +# PAPD mode: +papdmode=1 +papdvalidtest=1 +pacalidx2g=42 +papdepsoffset=-22 +papdendidx=58 + +# LTECX flags +ltecxmux=0 +ltecxpadnum=0x0102 +ltecxfnsel=0x44 +ltecxgcigpio=0x01 + +il0macaddr=00:90:4c:c5:12:38 +wl0id=0x431b + +deadman_to=0xffffffff +# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG +muxenab=0x1 +# CLDO PWM voltage settings - 0x4 - 1.1 volt +#cldo_pwm=0x4 + +#VCO freq 326.4MHz +spurconfig=0x3 + +edonthd20l=-75 +edoffthd20ul=-80 diff --git a/platforms/rpi4/brcmfmac43455-sdio.clm_blob b/platforms/rpi4/brcmfmac43455-sdio.clm_blob Binary files differnew file mode 100644 index 0000000..09b930b --- /dev/null +++ b/platforms/rpi4/brcmfmac43455-sdio.clm_blob diff --git a/platforms/rpi4/brcmfmac43455-sdio.txt b/platforms/rpi4/brcmfmac43455-sdio.txt new file mode 100644 index 0000000..260c929 --- /dev/null +++ b/platforms/rpi4/brcmfmac43455-sdio.txt @@ -0,0 +1,92 @@ +# Cloned from bcm94345wlpagb_p2xx.txt +NVRAMRev=$Rev: 498373 $ +sromrev=11 +vendid=0x14e4 +devid=0x43ab +manfid=0x2d0 +prodid=0x06e4 +#macaddr=00:90:4c:c5:12:38 +macaddr=b8:27:eb:74:f2:6c +nocrc=1 +boardtype=0x6e4 +boardrev=0x1304 + +#XTAL 37.4MHz +xtalfreq=37400 + +btc_mode=1 +#------------------------------------------------------ +#boardflags: 5GHz eTR switch by default +# 2.4GHz eTR switch by default +# bit1 for btcoex +boardflags=0x00480201 +boardflags2=0x40800000 +boardflags3=0x48200100 +phycal_tempdelta=15 +rxchain=1 +txchain=1 +aa2g=1 +aa5g=1 +tssipos5g=1 +tssipos2g=1 +femctrl=0 +AvVmid_c0=1,165,2,100,2,100,2,100,2,100 +pa2ga0=-129,6525,-718 +pa2ga1=-149,4408,-601 +pa5ga0=-185,6836,-815,-186,6838,-815,-184,6859,-815,-184,6882,-818 +pa5ga1=-202,4285,-574,-201,4312,-578,-196,4391,-586,-201,4294,-575 +itrsw=1 +pdoffsetcckma0=2 +pdoffset2gperchan=0,-2,1,0,1,0,1,1,1,0,0,-1,-1,0 +pdoffset2g40ma0=16 +pdoffset40ma0=0x8888 +pdoffset80ma0=0x8888 +extpagain5g=2 +extpagain2g=2 +tworangetssi2g=1 +tworangetssi5g=1 +# LTECX flags +# WCI2 +ltecxmux=0 +ltecxpadnum=0x0504 +ltecxfnsel=0x22 +ltecxgcigpio=0x32 + +maxp2ga0=80 +ofdmlrbw202gpo=0x0022 +dot11agofdmhrbw202gpo=0x4442 +mcsbw202gpo=0x98444422 +mcsbw402gpo=0x98444422 +maxp5ga0=82,82,82,82 +mcsbw205glpo=0xb9555000 +mcsbw205gmpo=0xb9555000 +mcsbw205ghpo=0xb9555000 +mcsbw405glpo=0xb9555000 +mcsbw405gmpo=0xb9555000 +mcsbw405ghpo=0xb9555000 +mcsbw805glpo=0xb9555000 +mcsbw805gmpo=0xb9555000 +mcsbw805ghpo=0xb9555000 + +swctrlmap_2g=0x00000000,0x00000000,0x00000000,0x010000,0x3ff +swctrlmap_5g=0x00100010,0x00200020,0x00200020,0x010000,0x3fe +swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x3 +swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x3 + +vcodivmode=1 +deadman_to=481500000 + +ed_thresh2g=-54 +ed_thresh5g=-54 +eu_edthresh2g=-54 +eu_edthresh5g=-54 +ldo1=4 +rawtempsense=0x1ff +cckPwrIdxCorr=3 +cckTssiDelay=150 +ofdmTssiDelay=150 +txpwr2gAdcScale=1 +txpwr5gAdcScale=1 +dot11b_opts=0x3aa85 +cbfilttype=1 +fdsslevel_ch11=6 diff --git a/platforms/rpi4/extlinux.conf b/platforms/rpi4/extlinux.conf new file mode 100644 index 0000000..bd8b64e --- /dev/null +++ b/platforms/rpi4/extlinux.conf @@ -0,0 +1,10 @@ +menu Welcome to Mageia-Minimal. +timeout 20 +default linux + +label linux + kernel /boot/vmlinuz + append root=UUID=<UUID> <BOOT_ARGS> + fdtdir /usr/lib/<FDTDIR> + initrd /boot/initrd + diff --git a/platforms/rpi4/mageia4arm.cfg b/platforms/rpi4/mageia4arm.cfg new file mode 100644 index 0000000..e1b3d24 --- /dev/null +++ b/platforms/rpi4/mageia4arm.cfg @@ -0,0 +1,101 @@ + +# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +MAGEIA_VERSION="cauldron" +ARM_VERSION="aarch64" +# ARM_VERSION="armv7hl" + +#target plateform (xu3-4 or rpi) +TARGET="rpi" +#version of the target +# 0, 1, 2 ,3_32 for rpi and 3 or 4 for odroid +TARGET_VERSION="4" + +# URL of the Mageia mirror used to install ( see mirrors.mageia.org ) +MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/${MAGEIA_VERSION}/${ARM_VERSION}" +#MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION" + +# image will be created here +# INSTALL_PATH="/mnt/perso/raspi-test" + +# Build directory will be created here +BUILD_PATH="${INSTALL_PATH}/build" + +#name of the image +IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}.img" + +#Default user +# ID_USER="pi" +# PASSWORD="raspberry" + +#root password +# ROOT_PWD="piroot" + +#Hostname +HOSTNAME="${TARGET}" + +#Mount point of image's partitions +BOOT="/mnt/boot" +ROOT="/mnt/root" + +#Filesystem of boot partitions (default ext4 raspberry pi need vfat) +SEPARATE_BOOT_PARTITION=1 +BOOTFS="vfat" + +#The arguments for the Kernel +BOOT_ARGS='dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 rootwait fsck.repair=1 8250.nr_uarts=1 elevator=deadline cma=256M\@512M audit=0' + +#Path where the raspberry pi firmware is/will be installed +FIRMWARE_PATH="$INSTALL_PATH" +FIRMWARE_DIR="firmware-stable" +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/bcm2711-rpi-4-b.dtb +https://github.com/raspberrypi/firmware/raw/master/boot/fixup4.dat +https://github.com/raspberrypi/firmware/raw/master/boot/start4.elf +https://github.com/raspberrypi/firmware/raw/master/boot/fixup4x.dat +https://github.com/raspberrypi/firmware/raw/master/boot/start4x.elf +" diff --git a/platforms/rpi4/mageia4arm.cfg.original b/platforms/rpi4/mageia4arm.cfg.original new file mode 100644 index 0000000..e1b78d9 --- /dev/null +++ b/platforms/rpi4/mageia4arm.cfg.original @@ -0,0 +1,56 @@ + +# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <dtux@free.fr> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +MAGEIA_VERSION="7" +ARM_VERSION="armv7hl" + +#target plateform (xu3-4 or rpi) +TARGET="rpi" + +# URL of the Mageia mirror used to install ( see mirrors.mageia.org ) +MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION" +# image will be created here +INSTALL_PATH="<change this>" + +# Build directory will be created here +BUILD_PATH="$INSTALL_PATH/build" + +#name of the image +IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET.img" + +#Mount point of image's partitions +#no need to be changed +BOOT="/mnt/boot" +ROOT="/mnt/root" + +#Default user +ID_USER="pi" +PASSWORD="raspberry" + +#root password +ROOT_PWD="piroot" + +#Hostname +HOSTNAME="$TARGET.$ID_USER" + +#Filesystem of boot partitions (default ext4 raspberry pi need vfat) +#DO NOT CHANGE THIS +BOOTFS="vfat" + +#Path where the raspberry pi firmware is/will be downloaded +FIRMWARE_PATH="$INSTALL_PATH" +FIRMWARE_DIR="firmware-stable" diff --git a/platforms/rpi4/modprobe.conf b/platforms/rpi4/modprobe.conf new file mode 100644 index 0000000..7725dae --- /dev/null +++ b/platforms/rpi4/modprobe.conf @@ -0,0 +1,3 @@ +alias wlan0 brcmfmac +alias eth0 smsc95xx +alias usb0 rndis_host diff --git a/platforms/rpi4/second_stage_install.sh b/platforms/rpi4/second_stage_install.sh new file mode 100644 index 0000000..aee1d53 --- /dev/null +++ b/platforms/rpi4/second_stage_install.sh @@ -0,0 +1,55 @@ +#!/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 +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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 + +#Install all packages you need +# No verifying rpm due to a bug in packages, some are not signed + +/usr/bin/dnf --nogpgcheck --assumeyes install basesystem chrony rng-tools man openssh-server rfkill wireless-tools bluez wpa_supplicant make binutils dracut u-boot rsync kernel-desktop-latest mlocate drakx-kbd-mouse-x11 glibc-i18ndata + + +/usr/bin/chown :chrony -R /etc/chrony.keys /var/log/chrony +/usr/bin/chown :daemon /etc/wpa_supplicant.conf +/usr/bin/chown :tty /bin/write /bin/wall +/usr/bin/chown :lock /sbin/lockdev +/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 + +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 diff --git a/platforms/rpi4/specialFunctions.sh b/platforms/rpi4/specialFunctions.sh new file mode 100755 index 0000000..ada30a4 --- /dev/null +++ b/platforms/rpi4/specialFunctions.sh @@ -0,0 +1,159 @@ +#!/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 +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +#RPI partitionning : +DEFAULT="" +NEW_PART=n +PRIMARY=p +CHANGE_TYPE=t +CHANGE_BOOTFLAG=a +APPLY=w + +PART_BOOT=1 +PART_BOOT_FIRST_SECTOR=${DEFAULT} +PART_BOOT_SIZE="+128M" + +PART_ROOT=2 +PART_ROOT_FIRST_SECTOR=${DEFAULT} +PART_ROOT_SIZE=${DEFAULT} + +TYPE_FAT32LBA=c + +FDISK_SCRIPT="${NEW_PART}\n${PRIMARY}\n${PART_BOOT}\n${PART_BOOT_FIRST_SECTOR}\n${PART_BOOT_SIZE}\n${CHANGE_TYPE}\n${TYPE_FAT32LBA}\n${NEW_PART}\n${PRIMARY}\n${PART_ROOT}\n${PART_ROOT_FIRST_SECTOR}\n${PART_ROOT_SIZE}\n${CHANGE_BOOTFLAG}\n${PART_BOOT}\n${CHANGE_BOOTFLAG}\n${PART_ROOT}\n${APPLY}\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" + title "Making raspberry pi image" + return 0 +} + +function postPrepareChroot() +{ + #Nothing to do. (Except replacing default function.) + return 0 +} + + +function bunrningBootloader() +{ + #Nothing to do. (Except replacing default function.) + return 0 +} + + +function copyingCustomSystem() +{ + info "copying 10-vchiq-permissions.rules" + cp --preserve=mode "${CONFIG_PATH}/10-vchiq-permissions.rules" "${BUILD_PATH}/etc/udev/rules.d/" + info "Making /etc/modules" + echo -e "vchiq\nsnd_bcm2835\nvc4\nbrcmfmac" >> "${BUILD_PATH}"/etc/modules + + ARM_BOOT="${BUILD_PATH}/mnt/arm_boot" + if ! [ -d "${ARM_BOOT}" ]; then + mkdir -p "${ARM_BOOT}" + fi + info "copying modprobe.conf" + /usr/bin/cp -v --preserve=mode "${CONFIG_PATH}/modprobe.conf" "${BUILD_PATH}/etc/" + chown root:root "${BUILD_PATH}/etc/modprobe.conf" + + info "copying firmware, overlays in rpi boot partition" +# cp -v --preserve=mode "${BUILD_PATH}/usr/lib/linux-"* "${BOOT}/dtb" + cp -v --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/start"* "${ARM_BOOT}/" + cp -v --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/fixup"* "${ARM_BOOT}/" + cp -v --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/bootcode.bin"* "${ARM_BOOT}/" + cp -vR --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/overlays" "${ARM_BOOT}/" + + info "copying u-boot binary to ${ARM_BOOT}" + case ${TARGET_VERSION} in + "0") + info "copying u-boot for ${TARGET} 0" + cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_0_w/u-boot.bin" "${ARM_BOOT}/kernel.img" + ;; + "1") + info "copying u-boot for ${TARGET} 1" + cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi/u-boot.bin" "${ARM_BOOT}/kernel.img" + ;; + "2") + info "copying u-boot for ${TARGET} 2" + cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_2/u-boot.bin" "${ARM_BOOT}/kernel.img" + ;; + "3_32") + info "copying u-boot for ${TARGET} 3 32 bits" + cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "${ARM_BOOT}/kernel.img" + ;; + "3+") + info "copying u-boot for ${TARGET} 3b+ 32 bits" + cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "${ARM_BOOT}/kernel.img" + ;; + "4") + info "copying u-boot for ${TARGET} 4 64 bits" + cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_4/u-boot.bin" "${ARM_BOOT}/kernel.img" + ;; + esac + +# info "copying raspberry optionals files in opt" +# /bin/rsync -rlptDH "${FIRMWARE_PATH}/${FIRMWARE_DIR}/opt/" "${BUILD_PATH}/opt/" + + info "copying wifi firmware file missing in kernel-firmware-nonfree" + if ! [ -d "${ROOT}/usr/lib/firmware/brcm/" ]; then + /bin/mkdir -p "${ROOT}/usr/lib/firmware/brcm/" + fi + if ! [[ -f "${ROOT}/usr/lib/firmware/brcm/brcmfmac434"* ]]; then + /bin/cp --preserve=mode "${CONFIG_PATH}/brcmfmac434"* "${ROOT}/usr/lib/firmware/brcm/" + if [ ${?} -ne 0 ]; then + error "line ${LINENO} error copying wifi firmware in ${ROOTP}/usr/lib/firmware/brcm/ : exiting" + exit ${ERR_1} + fi + fi + + info "copying Mageia image to root partition" + /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/" + return 0 +} |