Browse Source

added rpi 4 configuration
corrected bug in addmedia for cauldron
need updating u-boot package

Daniel Tartavel 2 years ago
parent
commit
a27de93bfe

+ 32 - 14
create_arm_image.sh

@@ -128,12 +128,21 @@ function genusemirroroptions()
128 128
 
129 129
     DNF_MIRROROPTS="--config=${DNF_CONFIGPATH} --forcearch=${ARM_VERSION} --nogpgcheck --releasever=${MAGEIA_VERSION}"
130 130
     if [ ! -z "${MIRROR}" ]; then
131
-        DNF_MIRROROPTS="${DNF_MIRROROPTS} --disablerepo=* --repofrompath=mgarel,${MIRROR}/media/core/release/ --repofrompath=mgaup,${MIRROR}/media/core/updates/ --enablerepo=mgarel --enablerepo=mgaup"
131
+        DNF_MIRROROPTS="${DNF_MIRROROPTS} --disablerepo=* --repofrompath=mgarel,${MIRROR}/media/core/release/ --enablerepo=mgarel"
132
+        if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
133
+			DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup,${MIRROR}/media/core/updates/ --enablerepo=mgaup"
134
+		fi
132 135
         if [ ${NONFREE} -eq 1 ]; then
133
-            DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-nonfree,${MIRROR}/media/nonfree/release/ --repofrompath=mgaup-nonfree,${MIRROR}/media/nonfree/updates/ --enablerepo=mgarel-nonfree --enablerepo=mgaup-nonfree"
136
+            DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-nonfree,${MIRROR}/media/nonfree/release/ --enablerepo=mgarel-nonfree "
137
+            if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
138
+				DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup-nonfree,${MIRROR}/media/nonfree/updates/ --enablerepo=mgaup-nonfree"
139
+			fi
134 140
         fi
135 141
         if [ ${TAINTED} -eq 1 ]; then
136
-            DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-tainted,${MIRROR}/media/tainted/release/ --repofrompath=mgaup-tainted,${MIRROR}/media/tainted/updates/ --enablerepo=mgarel-tainted --enablerepo=mgaup-tainted"
142
+            DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgarel-tainted,${MIRROR}/media/tainted/release/ --enablerepo=mgarel-tainted "
143
+            if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
144
+				DNF_MIRROROPTS="${DNF_MIRROROPTS} --repofrompath=mgaup-tainted,${MIRROR}/media/tainted/updates/ --enablerepo=mgaup-tainted"
145
+            fi
137 146
         fi
138 147
     fi
139 148
     export DNF_MIRROROPTS
@@ -143,16 +152,21 @@ function genusemirroroptions()
143 152
 # enabling extra Mageia repositories
144 153
 function enableextrarepos()
145 154
 {
146
-    if [ "${MAGEIA_VERSION}" = "cauldron" ]; then
147
-        extrasect_baseprefix="cauldron"
148
-        extrasect_updatesprefix="cauldron-updates"
149
-    else
150
-        extrasect_baseprefix="mageia"
151
-        extrasect_updatesprefix="updates"
152
-    fi
155
+	extrasect_baseprefix="mageia"
156
+ #   if [ "${MAGEIA_VERSION}" = "cauldron" ]; then
157
+ #       extrasect_baseprefix="cauldron"
158
+ #       extrasect_updatesprefix=""
159
+ #   else
160
+ #       extrasect_baseprefix="mageia"
161
+	extrasect_updatesprefix="updates"
162
+ #   fi
153 163
     if [ ${NONFREE} -eq 1 ]; then
154 164
         title "activating non-free repos"
155
-        /usr/bin/dnf --installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-nonfree" --set-enabled "${extrasect_updatesprefix}-${ARM_VERSION}-nonfree"
165
+        DNFPARAM=--installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-nonfree"
166
+        if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
167
+			DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-nonfree"
168
+		fi
169
+        /usr/bin/dnf $DNFPARAM;
156 170
         err=${?}
157 171
         if [ ${err} -ne 0 ]; then
158 172
             error "line ${LINENO} error ${err} - can't activate nonfree repositories : exiting"
@@ -161,7 +175,11 @@ function enableextrarepos()
161 175
     fi
162 176
     if [ ${TAINTED} -eq 1 ]; then
163 177
         title "activating tainted repos"
164
-        /usr/bin/dnf --installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-tainted" --set-enabled "${extrasect_updatesprefix}-${ARM_VERSION}-tainted"
178
+        DNFPARAM=--installroot="${BUILD_PATH}" config-manager --set-enabled "${extrasect_baseprefix}-${ARM_VERSION}-tainted"
179
+        if [ "${MAGEIA_VERSION}" != "cauldron" ]; then
180
+			DNFPARAM=$DNFPARAM" --set-enabled ${extrasect_updatesprefix}-${ARM_VERSION}-tainted"
181
+		fi
182
+        /usr/bin/dnf $DNFPARAM²
165 183
         err=${?}
166 184
         if [ ${err} -ne 0 ]; then
167 185
             error "line ${LINENO} error ${err} - can't activate tainted repositories : exiting"
@@ -992,7 +1010,7 @@ case ${OPT} in
992 1010
         genusemirroroptions #Generate mirror options, if needed
993 1011
         installbasesystem #Generate the rootfs, rootfiles, ...
994 1012
         enableextrarepos
995
-        addurpmimedia
1013
+#        addurpmimedia
996 1014
         mkfstab
997 1015
         preparechroot
998 1016
         jumpchroot
@@ -1001,7 +1019,7 @@ case ${OPT} in
1001 1019
             MIRROR=
1002 1020
             genusemirroroptions
1003 1021
             enableextrarepos
1004
-            addurpmimedia
1022
+#            addurpmimedia
1005 1023
         mountPartitions
1006 1024
         copyingsystem
1007 1025
         unmountingPartitions

+ 66 - 0
platforms/mageia4arm.cfg

@@ -0,0 +1,66 @@
1
+
2
+# Copyright (C) 2017-2018 Daniel Tartavel-jeannot   <contact@librepc.com>
3
+#
4
+# This program is free software; you can redistribute it and/or modify
5
+# it under the terms of the GNU General Public License as published by
6
+# the Free Software Foundation; either version 2 of the License, or
7
+# (at your option) any later version.
8
+#
9
+# This program is distributed in the hope that it will be useful,
10
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
+# GNU General Public License for more details.
13
+#
14
+# You should have received a copy of the GNU General Public License
15
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+# Mageia version 7 or later, cauldron.
18
+# TO MODIFY
19
+MAGEIA_VERSION=""
20
+# Arm version armv7hl, aarch64
21
+# TO MODIFY
22
+ARM_VERSION=""
23
+
24
+# Target plateform (odroid or rpi)
25
+# TO MODIFY
26
+TARGET=""
27
+# Target version (0,2,3 for raspi, 3 or 4 for odroid)
28
+#TO MODIFY
29
+TARGET_VERSION=""
30
+
31
+# URL of the Mageia mirror used to install ( see mirrors.mageia.org )
32
+MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION"
33
+
34
+# image will be created here
35
+# TO MODIFY
36
+INSTALL_PATH="/path/to/$TARGET"
37
+
38
+# Build directory will be created here
39
+BUILD_PATH="$INSTALL_PATH/build"
40
+
41
+#name of the image
42
+IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET.img"
43
+
44
+#Mount point of image's partitions
45
+BOOT="/mnt/boot"
46
+ROOT="/mnt/root"
47
+
48
+# Default user
49
+# TO MODIFY
50
+ID_USER="user login"
51
+PASSWORD="user password"
52
+
53
+#root password
54
+ROOT_PWD="root password"
55
+
56
+#Hostname
57
+HOSTNAME="$TARGET.$ID_USER"
58
+
59
+#Filesystem of boot partitions (default ext4 raspberry pi need vfat)
60
+#BOOTFS=ext4
61
+
62
+#kernel package to install (just needed for odroid)
63
+#KERNEL=kernel-odroid
64
+
65
+#Path where the raspberry pi firmware is/will be installed ( just needed for raspberry pi )
66
+FIRMWARE_PATH="$INSTALL_PATH/"

+ 1 - 0
platforms/rpi4/10-vchiq-permissions.rules

@@ -0,0 +1 @@
1
+SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"

BIN
platforms/rpi4/bcm2711-rpi-4-b.dtb


+ 66 - 0
platforms/rpi4/brcmfmac43430-sdio.txt

@@ -0,0 +1,66 @@
1
+# NVRAM file for BCM943430WLPTH
2
+# 2.4 GHz, 20 MHz BW mode
3
+
4
+# The following parameter values are just placeholders, need to be updated.
5
+manfid=0x2d0
6
+prodid=0x0727
7
+vendid=0x14e4
8
+devid=0x43e2
9
+boardtype=0x0727
10
+boardrev=0x1101
11
+boardnum=22
12
+macaddr=00:90:4c:c5:12:38
13
+sromrev=11
14
+boardflags=0x00404201
15
+boardflags3=0x08000000
16
+xtalfreq=37400
17
+nocrc=1
18
+ag0=255
19
+aa2g=1
20
+ccode=ALL
21
+
22
+pa0itssit=0x20
23
+extpagain2g=0
24
+#PA parameters for 2.4GHz, measured at CHIP OUTPUT
25
+pa2ga0=-168,7161,-820
26
+AvVmid_c0=0x0,0xc8
27
+cckpwroffset0=5
28
+
29
+# PPR params
30
+maxp2ga0=84
31
+txpwrbckof=6
32
+cckbw202gpo=0
33
+legofdmbw202gpo=0x66111111
34
+mcsbw202gpo=0x77711111
35
+propbw202gpo=0xdd
36
+
37
+# OFDM IIR :
38
+ofdmdigfilttype=18
39
+ofdmdigfilttypebe=18
40
+# PAPD mode:
41
+papdmode=1
42
+papdvalidtest=1
43
+pacalidx2g=42
44
+papdepsoffset=-22
45
+papdendidx=58
46
+
47
+# LTECX flags
48
+ltecxmux=0
49
+ltecxpadnum=0x0102
50
+ltecxfnsel=0x44
51
+ltecxgcigpio=0x01
52
+
53
+il0macaddr=00:90:4c:c5:12:38
54
+wl0id=0x431b
55
+
56
+deadman_to=0xffffffff
57
+# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG
58
+muxenab=0x1
59
+# CLDO PWM voltage settings - 0x4 - 1.1 volt
60
+#cldo_pwm=0x4
61
+
62
+#VCO freq 326.4MHz
63
+spurconfig=0x3 
64
+
65
+edonthd20l=-75
66
+edoffthd20ul=-80

BIN
platforms/rpi4/brcmfmac43455-sdio.clm_blob


+ 92 - 0
platforms/rpi4/brcmfmac43455-sdio.txt

@@ -0,0 +1,92 @@
1
+# Cloned from bcm94345wlpagb_p2xx.txt 
2
+NVRAMRev=$Rev: 498373 $
3
+sromrev=11
4
+vendid=0x14e4
5
+devid=0x43ab
6
+manfid=0x2d0
7
+prodid=0x06e4
8
+#macaddr=00:90:4c:c5:12:38
9
+macaddr=b8:27:eb:74:f2:6c
10
+nocrc=1
11
+boardtype=0x6e4
12
+boardrev=0x1304
13
+
14
+#XTAL 37.4MHz
15
+xtalfreq=37400
16
+
17
+btc_mode=1
18
+#------------------------------------------------------
19
+#boardflags: 5GHz eTR switch by default
20
+#            2.4GHz eTR switch by default
21
+#            bit1 for btcoex
22
+boardflags=0x00480201
23
+boardflags2=0x40800000
24
+boardflags3=0x48200100
25
+phycal_tempdelta=15
26
+rxchain=1
27
+txchain=1
28
+aa2g=1
29
+aa5g=1
30
+tssipos5g=1
31
+tssipos2g=1
32
+femctrl=0
33
+AvVmid_c0=1,165,2,100,2,100,2,100,2,100
34
+pa2ga0=-129,6525,-718
35
+pa2ga1=-149,4408,-601
36
+pa5ga0=-185,6836,-815,-186,6838,-815,-184,6859,-815,-184,6882,-818
37
+pa5ga1=-202,4285,-574,-201,4312,-578,-196,4391,-586,-201,4294,-575
38
+itrsw=1
39
+pdoffsetcckma0=2
40
+pdoffset2gperchan=0,-2,1,0,1,0,1,1,1,0,0,-1,-1,0
41
+pdoffset2g40ma0=16
42
+pdoffset40ma0=0x8888
43
+pdoffset80ma0=0x8888
44
+extpagain5g=2
45
+extpagain2g=2
46
+tworangetssi2g=1
47
+tworangetssi5g=1
48
+# LTECX flags
49
+# WCI2
50
+ltecxmux=0
51
+ltecxpadnum=0x0504
52
+ltecxfnsel=0x22
53
+ltecxgcigpio=0x32
54
+
55
+maxp2ga0=80
56
+ofdmlrbw202gpo=0x0022
57
+dot11agofdmhrbw202gpo=0x4442
58
+mcsbw202gpo=0x98444422
59
+mcsbw402gpo=0x98444422
60
+maxp5ga0=82,82,82,82
61
+mcsbw205glpo=0xb9555000
62
+mcsbw205gmpo=0xb9555000
63
+mcsbw205ghpo=0xb9555000
64
+mcsbw405glpo=0xb9555000
65
+mcsbw405gmpo=0xb9555000
66
+mcsbw405ghpo=0xb9555000
67
+mcsbw805glpo=0xb9555000
68
+mcsbw805gmpo=0xb9555000
69
+mcsbw805ghpo=0xb9555000
70
+
71
+swctrlmap_2g=0x00000000,0x00000000,0x00000000,0x010000,0x3ff
72
+swctrlmap_5g=0x00100010,0x00200020,0x00200020,0x010000,0x3fe
73
+swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x3
74
+swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x3
75
+
76
+vcodivmode=1
77
+deadman_to=481500000
78
+
79
+ed_thresh2g=-54
80
+ed_thresh5g=-54
81
+eu_edthresh2g=-54
82
+eu_edthresh5g=-54
83
+ldo1=4
84
+rawtempsense=0x1ff
85
+cckPwrIdxCorr=3
86
+cckTssiDelay=150
87
+ofdmTssiDelay=150
88
+txpwr2gAdcScale=1
89
+txpwr5gAdcScale=1
90
+dot11b_opts=0x3aa85
91
+cbfilttype=1
92
+fdsslevel_ch11=6

+ 10 - 0
platforms/rpi4/extlinux.conf

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

+ 101 - 0
platforms/rpi4/mageia4arm.cfg

@@ -0,0 +1,101 @@
1
+
2
+# Copyright (C) 2017-2018 Daniel Tartavel-jeannot   <contact@librepc.com>
3
+#
4
+# This program is free software; you can redistribute it and/or modify
5
+# it under the terms of the GNU General Public License as published by
6
+# the Free Software Foundation; either version 2 of the License, or
7
+# (at your option) any later version.
8
+#
9
+# This program is distributed in the hope that it will be useful,
10
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
+# GNU General Public License for more details.
13
+#
14
+# You should have received a copy of the GNU General Public License
15
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+
18
+MAGEIA_VERSION="cauldron"
19
+ARM_VERSION="aarch64"
20
+# ARM_VERSION="armv7hl"
21
+
22
+#target plateform (xu3-4 or rpi)
23
+TARGET="rpi"
24
+#version of the target
25
+# 0, 1, 2 ,3_32 for rpi and 3 or 4 for odroid
26
+TARGET_VERSION="4"
27
+
28
+# URL of the Mageia mirror used to install ( see mirrors.mageia.org )
29
+MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/${MAGEIA_VERSION}/${ARM_VERSION}"
30
+#MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION"
31
+
32
+# image will be created here
33
+# INSTALL_PATH="/mnt/perso/raspi-test"
34
+
35
+# Build directory will be created here
36
+BUILD_PATH="${INSTALL_PATH}/build"
37
+
38
+#name of the image
39
+IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}.img"
40
+
41
+#Default user
42
+# ID_USER="pi"
43
+# PASSWORD="raspberry"
44
+
45
+#root password
46
+# ROOT_PWD="piroot"
47
+
48
+#Hostname
49
+HOSTNAME="${TARGET}"
50
+
51
+#Mount point of image's partitions
52
+BOOT="/mnt/boot"
53
+ROOT="/mnt/root"
54
+
55
+#Filesystem of boot partitions (default ext4 raspberry pi need vfat)
56
+SEPARATE_BOOT_PARTITION=1
57
+BOOTFS="vfat"
58
+
59
+#The arguments for the Kernel
60
+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'
61
+
62
+#Path where the raspberry pi firmware is/will be installed
63
+FIRMWARE_PATH="$INSTALL_PATH"
64
+FIRMWARE_DIR="firmware-stable"
65
+INFORMATION="
66
+https://elinux.org/RPi_Software
67
+https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md
68
+
69
+https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin
70
+https://github.com/raspberrypi/firmware/blob/master/boot/bcm2710-rpi-3-b-plus.dtb
71
+
72
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup.dat
73
+https://github.com/raspberrypi/firmware/blob/master/boot/start.elf
74
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup4.dat #Rpi4
75
+https://github.com/raspberrypi/firmware/blob/master/boot/start4.elf #Rpi4
76
+
77
+#Debug (implicitly used with start_debug=1)
78
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup_db.dat
79
+https://github.com/raspberrypi/firmware/blob/master/boot/start_db.elf
80
+https://github.com/raspberrypi/firmware/blob/master/boot/start4db.elf #Rpi4
81
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup4db.dat #Rpi4
82
+
83
+#Low GPU Memory (=16MB)
84
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup_cd.dat
85
+https://github.com/raspberrypi/firmware/blob/master/boot/start_cd.elf
86
+https://github.com/raspberrypi/firmware/blob/master/boot/start4cd.elf #Rpi4
87
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup4cd.dat #Rpi4
88
+
89
+#Testing versions (eXtra features) (like camera module) (implicitly used with start_x=1 ) :
90
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup_x.dat
91
+https://github.com/raspberrypi/firmware/blob/master/boot/start_x.elf
92
+https://github.com/raspberrypi/firmware/blob/master/boot/start4x.elf #Rpi4
93
+https://github.com/raspberrypi/firmware/blob/master/boot/fixup4x.dat #Rpi4
94
+"
95
+FIRMWARE_DOWNLOAD_URL="https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin
96
+https://github.com/raspberrypi/firmware/raw/master/boot/bcm2711-rpi-4-b.dtb
97
+https://github.com/raspberrypi/firmware/raw/master/boot/fixup4.dat
98
+https://github.com/raspberrypi/firmware/raw/master/boot/start4.elf
99
+https://github.com/raspberrypi/firmware/raw/master/boot/fixup4x.dat
100
+https://github.com/raspberrypi/firmware/raw/master/boot/start4x.elf
101
+"

+ 56 - 0
platforms/rpi4/mageia4arm.cfg.original

@@ -0,0 +1,56 @@
1
+
2
+# Copyright (C) 2017-2018 Daniel Tartavel-jeannot   <dtux@free.fr>
3
+#
4
+# This program is free software; you can redistribute it and/or modify
5
+# it under the terms of the GNU General Public License as published by
6
+# the Free Software Foundation; either version 2 of the License, or
7
+# (at your option) any later version.
8
+#
9
+# This program is distributed in the hope that it will be useful,
10
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
+# GNU General Public License for more details.
13
+#
14
+# You should have received a copy of the GNU General Public License
15
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+
18
+MAGEIA_VERSION="7"
19
+ARM_VERSION="armv7hl"
20
+
21
+#target plateform (xu3-4 or rpi)
22
+TARGET="rpi" 
23
+
24
+# URL of the Mageia mirror used to install ( see mirrors.mageia.org )
25
+MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION"
26
+# image will be created here
27
+INSTALL_PATH="<change this>"
28
+
29
+# Build directory will be created here
30
+BUILD_PATH="$INSTALL_PATH/build"
31
+
32
+#name of the image
33
+IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET.img"
34
+
35
+#Mount point of image's partitions
36
+#no need to be changed
37
+BOOT="/mnt/boot"
38
+ROOT="/mnt/root"
39
+
40
+#Default user
41
+ID_USER="pi"
42
+PASSWORD="raspberry"
43
+
44
+#root password
45
+ROOT_PWD="piroot"
46
+
47
+#Hostname 
48
+HOSTNAME="$TARGET.$ID_USER" 
49
+
50
+#Filesystem of boot partitions (default ext4 raspberry pi need vfat)
51
+#DO NOT CHANGE THIS
52
+BOOTFS="vfat"
53
+
54
+#Path where the raspberry pi firmware is/will be downloaded
55
+FIRMWARE_PATH="$INSTALL_PATH"
56
+FIRMWARE_DIR="firmware-stable"

+ 3 - 0
platforms/rpi4/modprobe.conf

@@ -0,0 +1,3 @@
1
+alias wlan0 brcmfmac
2
+alias eth0 smsc95xx
3
+alias usb0 rndis_host

+ 55 - 0
platforms/rpi4/second_stage_install.sh

@@ -0,0 +1,55 @@
1
+#!/bin/bash
2
+
3
+# Copyright (C) 2017-2018 Daniel Tartavel-jeannot   <contact@librepc.com>
4
+# Copyright (C) 2019-2020 Jean-Baptiste Biernacki   <j.biernacki@free.fr>
5
+#
6
+
7
+# This program is free software; you can redistribute it and/or modify
8
+# it under the terms of the GNU General Public License as published by
9
+# the Free Software Foundation; either version 2 of the License, or
10
+# (at your option) any later version.
11
+#
12
+# This program is distributed in the hope that it will be useful,
13
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+# GNU General Public License for more details.
16
+#
17
+# You should have received a copy of the GNU General Public License
18
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+export ARCH=arm
21
+
22
+/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
23
+
24
+/usr/bin/chown :systemd-journal -R /var/log/journal
25
+
26
+#Install all packages you need
27
+# No verifying rpm due to a bug in packages, some are not signed
28
+
29
+/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
30
+
31
+
32
+/usr/bin/chown :chrony -R /etc/chrony.keys /var/log/chrony
33
+/usr/bin/chown :daemon /etc/wpa_supplicant.conf
34
+/usr/bin/chown :tty /bin/write /bin/wall
35
+/usr/bin/chown :lock /sbin/lockdev
36
+/usr/bin/chown :bin /sbin/traceroute
37
+/usr/bin/chown polkitd /etc/polkit-1/rules.d
38
+
39
+# KV=$(basename /boot/vmlinuz-*)
40
+# KV=${KV#vmlinuz-}
41
+# dracut --kver $KV
42
+
43
+VMLINUZ=$(ls --sort=time -1 /boot/vmlinuz-[[:digit:]]* | head -n 1)
44
+# Normally, /boot/vmlinuz is generated with the /sbin/installkernel script, but it is not generated with chroot.
45
+rm -f /boot/vmlinuz
46
+ln -r -s "${VMLINUZ}" /boot/vmlinuz #For extlinux.conf
47
+
48
+rm -f ${0}
49
+
50
+K_INST_VERSION=$(rpm -q kernel-desktop-latest | sed -e 's/kernel-\([[:alnum:]]*\)-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\2-\1-\3/')
51
+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}
52
+ln -r -s /boot/initrd-${K_INST_VERSION}.img /boot/initrd.img
53
+echo "Dracut done."
54
+
55
+alternatives --set soundprofile /etc/sound/profiles/alsa

+ 159 - 0
platforms/rpi4/specialFunctions.sh

@@ -0,0 +1,159 @@
1
+#!/bin/bash
2
+
3
+# Copyright (C) 2017-2018 Daniel Tartavel-jeannot   <contact@librepc.com>
4
+# Copyright (C) 2019-2020 Jean-Baptiste Biernacki   <j.biernacki@free.fr>
5
+#
6
+
7
+# This program is free software; you can redistribute it and/or modify
8
+# it under the terms of the GNU General Public License as published by
9
+# the Free Software Foundation; either version 2 of the License, or
10
+# (at your option) any later version.
11
+#
12
+# This program is distributed in the hope that it will be useful,
13
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+# GNU General Public License for more details.
16
+#
17
+# You should have received a copy of the GNU General Public License
18
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+#RPI partitionning :
21
+DEFAULT=""
22
+NEW_PART=n
23
+PRIMARY=p
24
+CHANGE_TYPE=t
25
+CHANGE_BOOTFLAG=a
26
+APPLY=w
27
+
28
+PART_BOOT=1
29
+PART_BOOT_FIRST_SECTOR=${DEFAULT}
30
+PART_BOOT_SIZE="+128M"
31
+
32
+PART_ROOT=2
33
+PART_ROOT_FIRST_SECTOR=${DEFAULT}
34
+PART_ROOT_SIZE=${DEFAULT}
35
+
36
+TYPE_FAT32LBA=c
37
+
38
+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"
39
+
40
+
41
+function preImgCreation()
42
+{
43
+    
44
+    title "Download binary blob for Rpi"
45
+    for i in ${FIRMWARE_DOWNLOAD_URL}; do
46
+        info "Download ${i}"
47
+        curl -L -O -J ${i} -s
48
+    done
49
+
50
+#     if ! [ -d "${FIRMWARE_PATH}/${FIRMWARE_DIR}" ]; then                    # the firmware directory does not exists
51
+#         echo "$(ls *.zip| wc -l)"
52
+#         if [ "$(ls *.zip| wc -l)" -eq 0 ]; then             # the firmware archive does not exists
53
+#             warning "The raspberry pi firmware need to be downloaded"
54
+#             info "Downloading FIRMWARE_FILENAME"
55
+#             wget ${FIRMWARE_DOWNLOAD_URL}
56
+# #             curl -L -O -J ${FIRMWARE_DOWNLOAD_URL}
57
+# #             curl -L ${FIRMWARE_DOWNLOAD_URL} -o firmware-stable.zip
58
+#             if [ ${?} -ne 0 ]; then
59
+#                 error "line ${LINENO} error downloading raspberry firmware at ${FIRMWARE_DOWNLOAD_URL}: exiting"
60
+#                 exit 1
61
+#             fi
62
+#         fi
63
+#         info "extracting firmware"
64
+#         unzip -d "${FIRMWARE_PATH}" *.zip
65
+#         if [ ${?} -ne 0 ]; then
66
+#             error "line ${LINENO} error unzipping ${FIRMWARE_PATH} : exiting"
67
+#             exit 1
68
+#         fi
69
+#     fi
70
+    
71
+    title "Creating Pi image"
72
+    title "Making raspberry pi image"
73
+    return 0
74
+}
75
+
76
+function postPrepareChroot()
77
+{
78
+    #Nothing to do. (Except replacing default function.)
79
+    return 0
80
+}
81
+
82
+
83
+function bunrningBootloader()
84
+{
85
+    #Nothing to do. (Except replacing default function.)
86
+    return 0
87
+}
88
+
89
+
90
+function copyingCustomSystem()
91
+{
92
+    info "copying 10-vchiq-permissions.rules"
93
+    cp --preserve=mode "${CONFIG_PATH}/10-vchiq-permissions.rules" "${BUILD_PATH}/etc/udev/rules.d/"
94
+    info "Making /etc/modules"
95
+    echo -e "vchiq\nsnd_bcm2835\nvc4\nbrcmfmac" >> "${BUILD_PATH}"/etc/modules
96
+
97
+    ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
98
+    if ! [ -d "${ARM_BOOT}" ]; then
99
+        mkdir -p "${ARM_BOOT}"
100
+    fi
101
+    info "copying modprobe.conf"
102
+    /usr/bin/cp -v --preserve=mode "${CONFIG_PATH}/modprobe.conf" "${BUILD_PATH}/etc/"
103
+    chown root:root "${BUILD_PATH}/etc/modprobe.conf"
104
+
105
+    info "copying firmware, overlays in rpi boot partition"
106
+#   cp -v --preserve=mode "${BUILD_PATH}/usr/lib/linux-"* "${BOOT}/dtb"
107
+    cp -v --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/start"* "${ARM_BOOT}/"
108
+    cp -v --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/fixup"* "${ARM_BOOT}/"
109
+    cp -v --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/bootcode.bin"* "${ARM_BOOT}/"
110
+    cp -vR --preserve=mode "${FIRMWARE_PATH}/${FIRMWARE_DIR}/boot/overlays" "${ARM_BOOT}/"
111
+
112
+    info "copying u-boot binary to ${ARM_BOOT}"
113
+    case ${TARGET_VERSION} in
114
+        "0")
115
+            info "copying u-boot for ${TARGET} 0"
116
+            cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_0_w/u-boot.bin" "${ARM_BOOT}/kernel.img"
117
+            ;;
118
+        "1")
119
+            info "copying u-boot for ${TARGET} 1"
120
+            cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi/u-boot.bin" "${ARM_BOOT}/kernel.img"
121
+            ;;
122
+        "2")
123
+            info "copying u-boot for ${TARGET} 2"
124
+            cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_2/u-boot.bin" "${ARM_BOOT}/kernel.img"
125
+            ;;
126
+        "3_32")
127
+            info "copying u-boot for ${TARGET} 3 32 bits"
128
+            cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "${ARM_BOOT}/kernel.img"
129
+            ;;
130
+        "3+")
131
+            info "copying u-boot for ${TARGET} 3b+ 32 bits"
132
+            cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "${ARM_BOOT}/kernel.img"
133
+            ;;
134
+		"4")
135
+			info "copying u-boot for ${TARGET} 4 64 bits"
136
+            cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/rpi_4/u-boot.bin" "${ARM_BOOT}/kernel.img"
137
+            ;;
138
+    esac
139
+
140
+#   info "copying raspberry optionals files in opt"
141
+#   /bin/rsync -rlptDH "${FIRMWARE_PATH}/${FIRMWARE_DIR}/opt/" "${BUILD_PATH}/opt/"
142
+
143
+    info "copying wifi firmware file missing in kernel-firmware-nonfree"
144
+    if ! [ -d "${ROOT}/usr/lib/firmware/brcm/" ]; then
145
+        /bin/mkdir -p "${ROOT}/usr/lib/firmware/brcm/"
146
+    fi
147
+    if ! [[ -f "${ROOT}/usr/lib/firmware/brcm/brcmfmac434"* ]]; then
148
+        /bin/cp --preserve=mode "${CONFIG_PATH}/brcmfmac434"* "${ROOT}/usr/lib/firmware/brcm/"
149
+        if [ ${?} -ne 0 ]; then
150
+            error "line ${LINENO} error copying wifi firmware in ${ROOTP}/usr/lib/firmware/brcm/ : exiting"
151
+            exit ${ERR_1}
152
+        fi
153
+    fi
154
+
155
+    info "copying Mageia image to root partition"
156
+    /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
157
+    /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/"
158
+    return 0
159
+}