1
0

Merge branch 'master' of Jybz/mageia4arm into master

This commit is contained in:
DTux 2019-12-06 12:35:40 +00:00 committed by Gogs
commit efe8057ee0
25 changed files with 5182 additions and 1181 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/build
/platforms/*/INFO/
/log/

286
README.md
View File

@ -1,44 +1,300 @@
# mageia4arm mageia4arm
==========
Short :
-------
* [Français](#francais)
* [English](#english)
<a id="francais"/>
Français
--------
* [Description](#fr_desc)
* [Rapidement](#fr_quick)
* [Créer une image](#fr_creatimg)
* [Aide](#fr_help)
* [Premier démarrage](#fr_1stStart)
* [Nouvelle plateforme](#fr_newPlat)
* [Fichier de configuration](#fr_file-conf)
* [Fichier chroot](#fr_file-second)
* [Fichier de fonctions personnalisées](#fr_file-spe)
* [Fichier extlinux](#fr_file-extlinux)
* [Autres fichiers](#fr_file_others)
* [Extras](#fr_extras)
* [Graver l'image](#fr_burn)
* [Compresser l'image](#fr_compress)
* [Générer une checksum](#fr_gen_chksum)
* [Signer la checksum](#fr_sign)
* [Vérifier une signature](#fr_verify)
* [Étendre la partition](#fr_extend)
<a id="fr_desc"></a>
### Description :
Outils servant à générer une image Mageia pour systèmes à base de processeurs arm Outils servant à générer une image Mageia pour systèmes à base de processeurs arm
Démarrage rapide: <a id="fr_quick"/>
### Démarrage rapide :
Avoir une copie de ce dépot :
```
git clone https://git.labolyon.fr/DTux/mageia4arm
```
Choisissez le dossier de configuration adapté à votre besoin (rpi ou xu4), sinon créez un nouveau dossier de configuration, copiez le fichier "mageia4arm.cfg.template" à l'interieur et modifiez le selon vos besoins. Choisissez le dossier de configuration adapté à votre besoin (rpi ou xu4), sinon créez un nouveau dossier de configuration, copiez le fichier "mageia4arm.cfg.template" à l'interieur et modifiez le selon vos besoins.
Par défaut l'utilisateur est "pi" avec le mot de passe "raspberry", et l'administrateur "root" avec le mot de passe "piroot". Par défaut l'utilisateur est "pi" avec le mot de passe "raspberry", et l'administrateur "root" avec le mot de passe "piroot".
Créer l'image: <a id="fr_creatimg"/>
create_arm_img_urpmi.sh --all --config <dossier de configuration\> ### Créer l'image :
create_arm_img_urpmi.sh --all --config \<dossier de configuration\>
Par exemple :
```
su -
<mot de passe root>
cd /home/user/workspace/mageia4arm/
./create_arm_img_urpmi.sh --all --target bananaPro --size 4 --tainted --nonfree --build-path ./build --config bananaPro 2>&1 | tee -a ./build.log
```
Avec cette commande, toutes les étapes (--all) du processus de création pour (--target) la bananaPro sont exécuter. L'image final tiendra sur une carte de (--size) 4Go. Les dépots tainted et nonfree seront activé. Le chemin de construction (--build-path) sera ./build. Finalement, la configuration (--config) sera bananaPro. La suite de la commande, 2>&1 redirige la sortie d'erreur dans la sortie standart et le tout est dupliqué (| tee -a) dans le fichier build.log pour le déboguage.
Aide: <a id="fr_help"/>
### Aide :
create_arm_img_urpmi.sh -h|--help create_arm_img_urpmi.sh -h|--help
Vous pouvez adapter le script "second_stage_install.sh" afin de compléter l'installation. Vous pouvez adapter le script "second_stage_install.sh" afin de compléter l'installation.
Des scripts sont disponibles dans le dossier "tools", ils sont copié dans /usr/local/bin/ dans l'image. Des scripts sont disponibles dans le dossier "tools", ils sont copié dans /usr/local/bin/ dans l'image.
Premier lancement de l'image sur le raspberry pi: <a id="fr_1stStart"/>
- lancer drakkeyboard afin de configurer le clavier ### Premier lancement de l'image sur le raspberry pi :
- si vous avez besoin d'un gestionnaire graphique, lancer le script: - lancer drakkeyboard afin de configurer le clavier
install_graphical.sh <gestionnaire-graphique\>( xfce, lxqt, plasma, ...) voir les métapaquetages disponibles dans "Environnement graphique" dans le gestionnaire de logiciels. - si vous avez besoin d'un gestionnaire graphique, lancer le script :<br/>install_graphical.sh \<gestionnaire-graphique\>( xfce, lxqt, plasma, ...) voir les métapaquetages disponibles dans "Environnement graphique" dans le gestionnaire de logiciels.
<a id="fr_newPlat"/>
### Ajouter une nouvelle plateforme :
Pour ajouter une nouvelle plateforme, il faut le dossier au nom du matériel dans le dossier platforms contenant le fichier mageia4arm.cfg comprennant les informations relatif à la distribution Mageia, le fichier second_stage_install.sh qui vient installer le système, le fichier specialFunctions.sh qui implémentes les fonctions pour affiner l'installation à la plateforme et extlinux.conf.
<a id="fr_file-conf"/>
#### mageia4arm.cfg
Un modèle est présent à la source de ce projet. Il contient les variables nécessaire à l'installation de Mageia, comme la version, l'architecture, le mirroir, les mots de passes etc.
<a id="fr_file-second"/>
#### second_stage_install.sh
Ce script est lancé avec chroot, ainsi nous pouvons exécuter des opérations personnalisées comme l'installation de paquets non présents des dépots de Mageia. Ce script vient aussi définir les groupes de fichiers.
<a id="fr_file-spe"/>
#### specialFunctions.sh
Ce script complémente le processus d'installation pour des éléments spécifiques à la plateformes, comme le partitionnement, la manière de mettre en place le chargeur de démarrage, le téléchargements de fichiers externe, etc.
Le script doit implémenter ces quatres fonctions :
```
function preImgCreation() {
#Possibilité de télécharger des éléments supplémentaires ici.
return 0
}
function postPrepareChroot() {
#Possibilité de copier des fichiers spécifique à la plateforme avant de lancer le script second_stage_install.sh.
return 0
}
function burningBootloader() {
#Plusieurs méthodes sont possibles pour flasher le chargeur de démarrage, et dépendent de la plateforme.
return 0
}
function copyingCustomSystem() {
#Possibilité de copier des fichiers dans le système monté.
return 0
}
```
Si l'une de ces fonctions ne retourne pas 0, la création de l'image échoue.
<a id="fr_file-extlinux"/>
#### extlinux.conf
???
<a id="fr_file-others"/>
#### Autres
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.
<a id="fr_extras"/>
### Extras :
Diverses informations complémentaires.
<a id="fr_burn"/>
#### Graver une image
Il est possible de graver l'image avec dd, souvent les cartes SD sont disponibles sous le nom mmcblkX avec X leurs numéros.
```
dd if=./build/Mageia-7-bananaPro1.img of=/dev/mmcblkX
```
On peut ajouter une barre de progression :
```
dd if=./build/Mageia-7-bananaPro1.img | pv -s $(ls -l ./build/Mageia-7-bananaPro1.img | cut -d ' ' -f 5) | dd of=/dev/mmcblkX
```
<a id="fr_compress"/>
#### Compresser une image
Pour compresser l'image, de plusieurs Go en quelques centaines de Mo pour la mettre en ligne par exemple, il est possible d'exécuter la commande suivante :
```
dd if=./build/Mageia-7-bananaPro1.img | gzip -9 | dd of=./build/Mageia-7-bananaPro1.img.gzip
```
Avec une barre d'avancement :
```
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
```
Il est possible d'utiliser d'autre logiciel de compression comme xz par exemple.
<a id="fr_gen_chksum"/>
#### Calculer les sommes de contrôles
Pour s'assurer qu'un fichier a été bien téléchargé, pour vérifier son intégrité, il est d'usage de comparer la somme de contrôle. On peut la calculer avec l'algorithme MD5, SHA1, SHA256, SHA512. Par exemple :
```
cd /home/user/workspace/mageia4arm/build
md5sum Mageia-7-bananaPro1.img > Mageia-7-bananaPro1.img.md5
```
Il est possible de remplacer la commande md5sum par sha1sum ou sha256sum ou encore sha512sum.
<a id="fr_sign"/>
#### Signer les sommes de contrôles
Pour assurer les utilisateurs que le fichier téléchargé vient bien de vous et non d'un tiers malveillant, il est possible de signer la somme de contrôle avec votre clef.
```
cd /home/user/workspace/mageia4arm/build
gpg --sign Mageia-7-bananaPro1.img.md5
```
La commande génère automatiquement le fichier de signature reprenant le nom du fichier à l'identique et ajoutant l'extension .gpg.
<a id="fr_verify"/>
#### Vérifier les sommes de contrôles
Pour vérifier une somme de contrôle, il faut joindre le créateur de l'image, lui faire confiance, ajouter sa clef à son trousseau de clef. Ensuite, il est possible d'exécuter la commande suivante :
```
cd /home/user/Téléchargements/
gpg --verify Mageia-7-bananaPro1.img.md5
```
<a id="fr_extend"/>
#### Étendre la partition
L'image créé peut contenir une partition root très réduite. Ceci permet d'économiser de la place pour la construction, le stockage de l'image et sûrtout un temps réduit pour graver l'image sur une carte sd.
Il est possible d'étendre cette partition pour profiter pleinement de l'entièreté de la carte SD. Le plus simple est avec l'utilitaire growpart dans le paquet cloud-utils-growpart.
Les valeurs X et Y sont à remplacer par le périphérique et la dernière partition du périphérique à étendre.
```
#Vérifier la partition, il peut être demandé pour l'étape suivante.
e2fsck -f /dev/mmcblkXpY
#Défini la nouvelle taille. (Change de langue avec LC_ALL car growpart ne supporte pas 'octet'.
LC_ALL=C growpart /dev/mmcblkX partitionNumber
#Change la taille
resize2fs /dev/mmcblkXpY
#Synchronise, vide le cache USB et assure que les données sont sur la clef.
sync
```
<a id="english"/>
English
-------
* [Description](#en_desc)
* [Quickly](#en_quick)
* [Create an image](#en_creatimg)
* [Help](#en_help)
* [First boot](#en_1stStart)
* [New Platform](#en_newPlat)
* [Configuration File](#en_file-conf)
* [chroot Filechroot](#en_file-second)
* [Custom function File](#en_file-spe)
* [extlinux File](#en_file-extlinux)
* [Other Files](#en_file-others)
* [Extras](#en_extras)
* [Burn the image](#en_burn)
* [Compress the Image](#en_compress)
* [Generate the Checksum](#en_gen_chksum)
* [Sign the Checksum](#en_sign)
* [Verify the Signature](#en_verify)
* [extending the partition](#en_extend)
<a id="en_desc"/>
### Description:
This repository contains script to make image for arm based systems from Mageia repositories. This repository contains script to make image for arm based systems from Mageia repositories.
Quick start: <a id="en_quick"/>
<a id="en_creatimg"/>
### Quick start:
Choose the config dir you need (rpi or xu4), else create a new config directory with "mageia4arm.cfg.template" in and modify it as you need. Choose the config dir you need (rpi or xu4), else create a new config directory with "mageia4arm.cfg.template" in and modify it as you need.
By default username is "pi" with password "raspberry" and root password is "piroot". By default username is "pi" with password "raspberry" and root password is "piroot".
create_arm_img_urpmi.sh --all --config <your config dir\> create_arm_img_urpmi.sh --all --config <your config dir\>
Example given :
```
su -
<root password>
cd /home/user/workspace/mageia4arm/
./create_arm_img_urpmi.sh --all --target bananaPro --size 4 --tainted --nonfree --build-path ./build --config bananaPro 2>&1 | tee -a ./build.log
```
With such command, all steps of the build process for the bananaPro will be executed. The final image will fit into a 4 GB SD card. The nonfree and tainted repositories will be activated. The build path will be the directory ./build. Finaly, the configuration is for bananaPro. The rest of the command, 2>&1 redirect the stderr stream into the stdout and it will be duplicated inside the build.log file for debug purpose.
Help: <a id="en_help"/>
### Help:
create_arm_img_urpmi.sh -h|--help create_arm_img_urpmi.sh -h|--help
you can adapt the script "second_stage_install.sh" to complete the installation. you can adapt the script "second_stage_install.sh" to complete the installation.
Some scripts are available in directory "tools". they are copied in /usr/local/bin/ in the image. Some scripts are available in directory "tools". they are copied in /usr/local/bin/ in the image.
First launch of the image on raspberry pi: <a id="en_1stStart"/>
- launch drakkeyboard to configure keyboard layout. ### First launch of the image on raspberry pi:
- if you need a graphical environment, launch the script : - launch drakkeyboard to configure keyboard layout.
install_graphical.sh <graphical environment\> ( xfce, lxqt, plasma, ...), see "Graphical environment" in the Mageia application manager meta packages. - if you need a graphical environment, launch the script :<br/>install_graphical.sh \<graphical environment\> ( xfce, lxqt, plasma, ...), see "Graphical environment" in the Mageia application manager meta packages.
<a id="en_newPlat"/>
### Adding a new platform:
To add a new platform, a new folder needs to be created in the platforms directory with the name of the platform containing the mageia4arm.cfg configuration file about the Mageia distribution itself, the second_stage_install.sh script which install the system, the specialFunctions.sh script which implements functions in order to fit the platform and the extlinux.conf file.
<a id="en_file-conf"/>
#### mageia4arm.cfg
A template file is located in the root of the project. It contains all necessary variables for the installation of Mageia, as the version, architecture, mirroir, password etc.
<a id="en_file-second"/>
#### second_stage_install.sh
This script is launched with chroot, then we can execute custom operation as installing packages that are not from Mageia.org. This script also defines some files groups.
<a id="en_file-spe"/>
#### specialFunctions.sh
This script add into the installation process some elements specific to the platform, as the partitionning, the fashon to set the bootloader, downloading external files, etc.
It must implement the four next functons :
```
function preImgCreation() {
#Here it is possible to download external file.
return 0
}
function postPrepareChroot() {
#Possibility to copy/paste platform related files before to launch the second_stage_install.sh script.
return 0
}
function burningBootloader() {
#There are several methods to flash the bootloader and depend on the platform.
return 0
}
function copyingCustomSystem() {
#It is possible to copy files into the mounted system.=
return 0
}
```
If one of this functions does not return 0, the process is stoped.
<a id="en_file-extlinux"/>
#### extlinux.conf
???
<a id="en_file-others"/>
#### others
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.
<a id="en_extras"/>
<a id="en_burn"/>
<a id="en_compress"/>
<a id="en_gen_chksum"/>
<a id="en_sign"/>
<a id="en_verify"/>
<a id="en_extend"/>
### extras:
Not translated.

View File

@ -1 +0,0 @@
pi.raspberry

File diff suppressed because it is too large Load Diff

1563
log/creation.log Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,120 @@
Banana Pro SBC
==========
Short
-----
* [Board Informations](#SBC_INFO)
* [U-Boot](#UBOOT_INFO)
* [Kernel](#KERNEL_INFO)
<a id="SBC_INFO"/>
# About the Banana Pro SBC from LeMaker
## External links
http://wiki.lemaker.org/BananaPro/Pi:Building_u-boot,_script.bin_and_linux-kernel#Building_the_kernel
http://wiki.lemaker.org/BananaPro/Pi:Setting_up_the_bootable_SD_card
https://sites.google.com/site/manisbutareed/bringing-my-beagles-to-heel/selected-annotated-u-boot-commands
https://linux-sunxi.org/Mainline_Kernel_Howto
https://linux-sunxi.org/Manual_build_howto#Setting_up_the_boot_partition
https://stackoverflow.com/questions/28891221/uenv-txt-vs-boot-scr
https://github.com/linux-sunxi/u-boot-sunxi/wiki
## LeMaker BPS (board package support)
git clone --recursive https://github.com/LeMaker/lemaker-bsp.git
./fex2bin ../sunxi-boards/sys_config/a20/BananaPro.fex ../../mageia4arm/bananaPro/script.bin
<a id="UBOOT_INFO"/>
# About U-Boot
The mainline U-Boot is used for this port.
## Mainline
```
CONFIG_PATH=~/workspaces/mageia4arm/platforms/bananaPro
git clone https://gitlab.denx.de/u-boot/u-boot
cd u-boot
make CROSS_COMPILE=arm-linux-gnu- Bananapro_defconfig
cp ${CONFIG_PATH}/UBOOT.config ./.config
#Just modify few unimportant things, like prompt, name, ...
make ARCH=arm CROSS_COMPILE=arm-linux-gnu- -j8
make ARCH=arm CROSS_COMPILE=arm-linux-gnu-
#cp ./u-boot.dtb ${CONFIG_PATH}/sun7i-a20-bananapro.dtb
cp -f ./u-boot.dtb ${CONFIG_PATH}/u-boot.dtb
cp -f ./arch/arm/dts/sun7i-a20-bananapro.dtb ${CONFIG_PATH}/sun7i-a20-bananapro.dtb
cp -f ./u-boot-sunxi-with-spl.bin ${CONFIG_PATH}/u-boot-sunxi-with-spl.bin
#Inside "specialFunctions.sh"
#dd if=${CONFIG_PATH}/u-boot-sunxi-with-spl.bin of=${DEVICE} bs=1024 seek=8
echo '
setenv KERNEL_FILE /boot/vmlinuz
setenv INIT_FILE /boot/initrd.img
#setenv DTB_FILE /boot/sun7i-a20-bananapro.dtb
setenv DTB_FILE /boot/u-boot.dtb
setenv KERNEL_ADDR 0x40008000
#setenv INIT_ADDR 0x45000000
setenv INIT_ADDR -
setenv DTB_ADDR 0x48000000
ext4load mmc 0:1 ${KERNEL_ADDR} ${KERNEL_FILE}
#ext4load mmc 0:1 ${INIT_ADDR} ${INIT_FILE}
ext4load mmc 0:1 ${DTB_ADDR} ${DTB_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"
' >${CONFIG_PATH}/boot.cmd
```
mkimage -C none -A arm -T script -d ${CONFIG_PATH}/boot.cmd ${CONFIG_PATH}/boot.scr
## UBoot Sunxi From LeMaker
Obsolet, see 'LeMaker BPS (board package support)'.
## UBoot Sunxi
Generic u-boot for sunxi
```
git clone https://github.com/linux-sunxi/u-boot-sunxi
make CROSS_COMPILE=arm-linux-gnu- Bananapro_config
make CROSS_COMPILE=arm-linux-gnu- -j8
make CROSS_COMPILE=arm-linux-gnu-
#Need network support to give the MAC address.
#Do not activate boot timing.
#Default conf use bootz and dtb tree.
```
## Default LeMaker script
```
setenv bootargs console=ttyS0,115200 noinitrd
disp.screen0_output_mode=EDID:1280x720p50 init=/init
root=/dev/mmcblk0p2 rootwait panic=10 ${extra}
fatload mmc 0 0x43000000 script.bin
fatload mmc 0 0x48000000 uImage
bootm 0x48000000
```
## DTB from Linux Mainline
```
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git --depth=1
make ARCH=arm CROSS_COMPILE=arm-linux-gnu- sunxi_defconfig
ARCH=arm CROSS_COMPILE=arm-linux-gnu- make -j8 dtbs
cp ./arch/arm/boot/dts/sun7i-a20-bananapro.dtb ./sun7i-a20-bananapro.dtb
```
<a id="KERNEL_INFO"/>
# About the Kernel
Not Written.
## Generate symlink
```
#Generating a symbolic relative link to the "last" kernel :
ln -r -s ./vmlinuz-5.2.13-desktop-2.mga7 ./vmlinuz
rm -f ./vmlinuz && ln -r -s ./vmlinuz-5.3.1-desktop-2.mga7 ./vmlinuz
```
## Commands used :
./create_arm_img_urpmi.sh --clean --config bananaPro --build-path ./build
./create_arm_img_urpmi.sh --all --target bananaPro --size 2 --tainted --nonfree --build-path ./build --config bananaPro 2>&1 | tee -a ./log/creation.log
dd if=./build/Mageia-7-bananaPro1.img | pv | dd of=/dev/mmcblk0 ; sync

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
setenv KERNEL_FILE /boot/uvmlinuz
setenv DTB_FILE /boot/u-boot.dtb
setenv INIT_FILE /boot/initrd
setenv KERNEL_ADDR 0x40008000
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}
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}

View File

@ -0,0 +1,75 @@
# 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/>.
#BananaPro informations : http://wiki.lemaker.org/BananaPro/Pi:Building_u-boot,_script.bin_and_linux-kernel#Installation
#BananaPro sources : https://github.com/LeMaker/lemaker-bsp
# Kernel : https://github.com/LeMaker/linux-sunxi
# FEX (DTS) : https://github.com/LeMaker/sunxi-boards
# Mageia version 7 or later, cauldron.
# TO MODIFY
MAGEIA_VERSION="7"
# Arm version armv7hl, aarch64
# TO MODIFY
ARM_VERSION="armv7hl"
# Target plateform (odroid or rpi)
# TO MODIFY
TARGET="bananaPro"
# Target version (0,2,3 for raspi, 3 or 4 for odroid)
#TO MODIFY
TARGET_VERSION="1"
# 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="./${TARGET}"
# Should not be in this configuration file, it isn't related to the configuration but to the build platform.
# 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="banana"
PASSWORD="bananaPro"
#root password
ROOT_PWD="ProR00t"
#Hostname
HOSTNAME="${TARGET}.${ID_USER}"
#Filesystem of boot partitions (default ext4 raspberry pi need vfat)
SEPARATE_BOOT_PARTITION=0
BOOTFS="ext4"
#kernel package to install
KERNEL="kernel-desktop"
#Path where the raspberry pi firmware is/will be installed ( just needed for raspberry pi )
FIRMWARE_PATH="${INSTALL_PATH}/"
#FIRMWARE_DIR="firmware-stable"
#FIRMWARE_DOWNLOAD_URL="https://github.com/raspberrypi/firmware/archive/stable.zip"

View File

@ -0,0 +1,101 @@
#!/bin/bash -x
# 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/>.
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
/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 binutils ldetect usbutils #kernel-desktop-latest # 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.
# ####################################################
# ## 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
###########################################
## Install a package from testing repo : ##
###########################################
urpmi.update Testing
urpmi --auto --media Testing kernel-desktop-latest
###############################################
## 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)
#Get the vmlinuz file :
VMLINUZ=$(ls --sort=time -1 /boot/vmlinuz-[[:digit:]]* | head -n 1)
rm -f /boot/uvmlinuz
ln -r -s "${VMLINUZ}" /boot/uvmlinuz
/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
# 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.

View File

@ -0,0 +1,70 @@
#!/bin/bash
#Fdisk partitionment commands :
DEFAULT=""
NEW_DOSTAB="o"
NEW_PART="n"
PRIMARY="p"
CHANGE_TYPE="t"
TYPE_FAT32LBA="c"
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}
PART_BOOTandROOT="1"
PART_BOOTandROOT_FIRST_SECTOR="${DEFAULT}"
PART_BOOTandROOT_SIZE="${DEFAULT}"
FDISK_SCRIPT="${NEW_PART}\n${PRIMARY}\n${PART_BOOTandROOT}\n${PART_BOOT_FIRST_SECTOR}\n${PART_BOOTandROOT_SIZE}\n${CHANGE_BOOTFLAG}\n${APPLY}\n"
# 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 "Creating Banana Pro image"
#Nothing to download.
return 0
}
function postPrepareChroot()
{
# 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}/u-boot.dtb" "${BUILD_PATH}/boot/"
# /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
}
function bunrningBootloader()
{
# DEVICE is set just before this function and looped.
title "Burning the bootloader..."
dd if=${CONFIG_PATH}/u-boot-sunxi-with-spl.bin of=${DEVICE} bs=1024 seek=8
return 0
}
function copyingCustomSystem()
{
#${BOOT} defined to the path to the mounted boot partition.
# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/vmlinuz-5.3.1-desktop-2.mga7" "${BOOT}"
# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/sun7i-a20-bananapro.dtb" "${BOOT}"
# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/boot.scr" "${BOOT}/"
# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/uboot.env" "${BOOT}/"
# /usr/bin/cp --preserve=mode "${CONFIG_PATH}/uEnv.txt" "${BOOT}/"
# /usr/bin/cp --preserve=mode -d "${CONFIG_PATH}/vmlinuz" "${BOOT}/"
# cp --preserve=mode -R "${BUILD_PATH}/boot/extlinux" "${BOOT}/"
return 0
}

Binary file not shown.

Binary file not shown.

View File

@ -1,57 +0,0 @@
# 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"
ARM_VERSION="armv7hl"
#target plateform (xu3-4 or rpi)
TARGET="rpi"
TARGET_VERSION="3"
# 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"
#Mount point of image's partitions
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)
BOOTFS="vfat"
#Path where the raspberry pi firmware is/will be installed
FIRMWARE_PATH="$INSTALL_PATH"
FIRMWARE_DIR="firmware-stable"

View File

@ -0,0 +1,130 @@
#!/bin/bash
#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 "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}
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
}
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"
;;
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
}

View File

@ -1,57 +0,0 @@
# 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"
ARM_VERSION="armv7hl"
#target plateform (xu3-4 or rpi)
TARGET="rpi"
TARGET_VERSION="3"
# 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"
#Mount point of image's partitions
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)
BOOTFS="vfat"
#Path where the raspberry pi firmware is/will be installed
FIRMWARE_PATH="$INSTALL_PATH"
FIRMWARE_DIR="firmware-stable"

View File

@ -0,0 +1,129 @@
#!/bin/bash
#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 "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}
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
}
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"
;;
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
}

View File

@ -1,57 +0,0 @@
# 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"
ARM_VERSION="armv7hl"
#target plateform (xu3-4 or rpi)
TARGET="rpi"
TARGET_VERSION="3"
# 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"
#Mount point of image's partitions
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)
BOOTFS="vfat"
#Path where the raspberry pi firmware is/will be installed
FIRMWARE_PATH="$INSTALL_PATH"
FIRMWARE_DIR="firmware-stable"

View File

@ -0,0 +1,130 @@
#!/bin/bash
#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 "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}
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
}
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"
;;
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
}

View File

@ -1,57 +0,0 @@
# 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"
ARM_VERSION="armv7hl"
#target plateform (xu3-4 or rpi)
TARGET="rpi"
TARGET_VERSION="3"
# 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"
#Mount point of image's partitions
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)
BOOTFS="vfat"
#Path where the raspberry pi firmware is/will be installed
FIRMWARE_PATH="$INSTALL_PATH"
FIRMWARE_DIR="firmware-stable"

View File

@ -0,0 +1,129 @@
#!/bin/bash
#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 "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}
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
}
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"
;;
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
}

View File

@ -1,52 +0,0 @@
# 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="armv7hl"
TARGET="xu4"
# 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="/mnt/perso/xu4-test/"
# 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_xu4"
ROOT="/mnt/root_xu4"
#Default user
ID_USER="odroid"
PASSWORD="xu4"
#root password
ROOT_PWD="odroid"
#Hostname
HOSTNAME="xu4.odroid"
#Filesystem of boot partitions (default ext4)
BOOTFS=ext4
#kernel package to install
KERNEL=kernel-odroid

View File

@ -1,34 +0,0 @@
#!/bin/bash
# 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/>.
/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
/usr/sbin/urpmi --auto --no-verify-rpm /root/kernel-odroid-4.14.y-1.armv7hl.rpm basesystem chrony rng-tools man openssh-server rfkill wireless-tools bluez wpa_supplicant make dracut u-boot-tools rsync
#/usr/sbin/urpmi --urpmi-root "$BUILD_PATH" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200
/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

100
platforms/xu4/specialFunctions.sh Executable file
View File

@ -0,0 +1,100 @@
#!/bin/bash
#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 "Creating Odroid XU3-XU4 image"
return 0
}
function postPrepareChroot()
{
#TEMPORARY CODE
#copying kernel odroid not existing in mageia repos
info "copying kernel-odroid and u-boot rpms in ${BUILD_PATH}/root"
#echo "/bin/cp ${CONFIG_PATH}/kernel-odroid-4.14.y-1.armv7hl.rpm ${BUILD_PATH}/root/"
/usr/bin/cp --preserve=mode "${CONFIG_PATH}/kernel-odroid-4.14.y-1.armv7hl.rpm" "${BUILD_PATH}/root/"
#echo "/bin/cp ${CONFIG_PATH}/u-boot-20180507-3.mga7.armv7hl.rpm ${BUILD_PATH}/root/"
/usr/bin/cp --preserve=mode "${CONFIG_PATH}/u-boot-20180507-3.mga7.armv7hl.rpm" "${BUILD_PATH}/root/"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error copying ${CONFIG_PATH}/kernel-odroid-4.14.y-1.armv7hl.rpm : exiting"
exit ${ERR_1}
fi
return 0
}
function bunrningBootloader()
{
if [ ${TARGET} = "odroid" ]; then
info "installing blobs"
pushd "${CONFIG_PATH}/sd_fuse"
if [ ${?} -ne 0 ]; then
error "line ${LINENO} error directory ${CONFIG_PATH}/sd_fuse does not exists : exiting"
exit ${ERR_1}
else
./sd_fusing.sh "${DEVICE}"
fi
pushd
fi
return 0
}
function copyingCustomSystem()
{
<<<<<<< HEAD
# ODROID_BOOT="${BUILD_PATH}/mnt/odroid_boot"
# if ! [ -d "${ODROID_BOOT}" ]; then
# rm -rf "${ODROID_BOOT}"
# mkdir -p "${ODROID_BOOT}"
# fi
=======
ODROID_BOOT="${BUILD_PATH}/mnt/odroid_boot"
if ! [ -d "${ODROID_BOOT}" ]; then
rm -rf "${ODROID_BOOT}"
mkdir -p "${ODROID_BOOT}"
fi
>>>>>>> d7c2376925bec483811b4bdada1c415b5a333b91
case ${TARGET_VERSION} in
"xu4")
info "copying u-boot for ${TARGET} ${TARGET_VERSION}"
cp --preserve=mode "${BUILD_PATH}/usr/lib/u-boot/${TARGET}-${TARGET_VERSION}/u-boot.bin" "${ARM_BOOT}/"
;;
esac
### temporary code waiting inclusion of xu4 in Mageia kernel and u-boot
info "Copying extlinux.conf on ${ODROID_BOOT}"
cp --preserve=mode -R "${BUILD_PATH}/boot/extlinux" "${ODROID_BOOT}/"
<<<<<<< HEAD
# info "copying Mageia image to root partition"
# /bin/rsync -rlptogDH --exclude "${ODROID_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
# /bin/rsync -rlptogDH "${ODROID_BOOT}/" "${BOOT}/"
=======
info "copying Mageia image to root partition"
/bin/rsync -rlptogDH --exclude "${ODROID_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
/bin/rsync -rlptogDH "${ODROID_BOOT}/" "${BOOT}/"
>>>>>>> d7c2376925bec483811b4bdada1c415b5a333b91
return 0
}

32
tools/resize_root.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
DEVICE="/dev/mmcblk0"
ROOT_PARTITION="${DEVICE}p1"
ROOT_PARTITION="1"
echo "Warning : this an early version to resize the root partition. Check the source code to ensure what you are doing."
if [ ${1} = "force" ]; then
#Check dependency
hash growpart
if [ ${?} -ne 0 ]; then
echo "install cloud-utils-growpart first. Hint : urpmi cloud-utils-growpart"
exit 1
fi
#Check the partition :
e2fsck -f ${ROOT_PARTITION}
#Change the size : BUG: app doesn't support "octet".
LC_ALL=C growpart ${DEVICE} ${ROOT_PARTITION}
#Resize the partition with the new size :
resize2fs ${ROOT_PARTITION}
#Sync (just to be sure)
sync
else
echo "If you read the source code, you should not have read that message... Exiting with out touching the partition."
fi
#Quit
exit 0