diff options
-rwxr-xr-x | create_arm_img_urpmi.sh | 132 | ||||
-rw-r--r-- | mageia4arm.cfg.template | 3 | ||||
-rwxr-xr-x | rpi/bcm2836-rpi-2-b.dtb | bin | 0 -> 13018 bytes | |||
-rwxr-xr-x | rpi/bcm2837-rpi-3-b-plus.dtb | bin | 0 -> 14348 bytes | |||
-rwxr-xr-x | rpi/bcm2837-rpi-3-b.dtb | bin | 0 -> 14096 bytes | |||
-rw-r--r-- | rpi/extlinux.conf | 10 | ||||
-rw-r--r-- | rpi/mageia4arm.cfg | 13 | ||||
-rw-r--r-- | rpi/second_stage_install.sh | 5 |
8 files changed, 105 insertions, 58 deletions
diff --git a/create_arm_img_urpmi.sh b/create_arm_img_urpmi.sh index 2e18568..836905e 100755 --- a/create_arm_img_urpmi.sh +++ b/create_arm_img_urpmi.sh @@ -68,7 +68,8 @@ function help() echo "--chroot chroot to arm directory and launch packages installation" echo "--create-image Create the image of Mageia $MAGEIA_VERSION" echo "--build-path Path to the build directory of the image of Mageia $MAGEIA_VERSION" -# echo "--target target system (for now rpi, xu3, xu4)" + echo "--target target system (for now rpi, odroid)" + echo "--target-version version of the taget (0, 1, 2, 3 for rpi, 3 or 4 for odroid)" echo "--config Path to config files" echo "--bootfs filesystem of boot partition (ext4 or vfat) default: etx4" echo -e "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)" @@ -245,32 +246,9 @@ function installbasesystem() fi } -function jumpchroot() +function preparechroot() { title "Preparing chrooting in $BUILD_PATH" - info "mounting dev, sys, proc directories in chroot" - /bin/mount -B /dev "$BUILD_PATH/dev" - if [ $? -ne 0 ];then - error "line $LINENO error mounting $BUILD_PATH/dev : exiting" - exit 1 - fi - /bin/mount -B /sys "$BUILD_PATH/sys" - if [ $? -ne 0 ];then - error "line $LINENO error mounting $BUILD_PATH/sys : exiting" - exit 1 - fi - /bin/mount -B /proc "$BUILD_PATH/proc" - if [ $? -ne 0 ];then - error "line $LINENO error mounting $BUILD_PATH/proc : exiting" - exit 1 - fi - info "Copying resolv.conf" - /bin/cp -a /etc/resolv.conf "$BUILD_PATH/etc/" - if [ $? -ne 0 ];then - error "line $LINENO error copying $BUILD_PATH/etc : exiting" - exit 1 - fi - info "making /etc/hostname" echo "$HOSTNAME" > "$BUILD_PATH/etc/hostname" @@ -300,7 +278,7 @@ EOF" >>"$BUILD_PATH/second_stage_install.sh" case $TARGET in - xu3|xu4) + ODROID) #TEMPORARY CODE #copying kernel odroid not existing in mageia repos info "copying kernel-odroid rpm in $BUILD_PATH/root" @@ -314,26 +292,55 @@ EOF" >>"$BUILD_PATH/second_stage_install.sh" rpi) ;; esac - +} + +function jumpchroot() +{ title "chrooting to $BUILD_PATH" - /sbin/chroot --userspec root:root "$BUILD_PATH" /bin/bash -v -c 'sh /second_stage_install.sh' + info "mounting dev, sys, proc directories in chroot" + /bin/mount -B /dev "$BUILD_PATH/dev" + if [ $? -ne 0 ];then + error "line $LINENO error mounting $BUILD_PATH/dev : exiting" + exit 1 + fi + /bin/mount -B /sys "$BUILD_PATH/sys" + if [ $? -ne 0 ];then + error "line $LINENO error mounting $BUILD_PATH/sys : exiting" + exit 1 + fi + /bin/mount -B /proc "$BUILD_PATH/proc" + if [ $? -ne 0 ];then + error "line $LINENO error mounting $BUILD_PATH/proc : exiting" + exit 1 + fi + info "Copying resolv.conf" + /bin/cp -a /etc/resolv.conf "$BUILD_PATH/etc/" + if [ $? -ne 0 ];then + error "line $LINENO error copying $BUILD_PATH/etc/resolv.conf : exiting" + exit 1 + fi + if [ "$OPT" = "chroot" ];then + /sbin/chroot "$BUILD_PATH" + else + /sbin/chroot --userspec root:root "$BUILD_PATH" /bin/bash -v -c 'sh /second_stage_install.sh' + fi RET=$? if [ $RET -ne 0 ];then error "line $LINENO Warning : chrooting to $BUILD_PATH retrurn an error $RET" ERRORN=$((ERRORN++)) fi info "unmounting dev, sys, proc" - /bin/umount "$BUILD_PATH/dev" + /bin/umount -lf "$BUILD_PATH/dev" if [ $? -ne 0 ];then warning "line $LINENO Warning : error unmounting $BUILD_PATH/dev, continuing anyway" ERRORN=$((ERRORN++)) fi - /bin/umount "$BUILD_PATH/sys" + /bin/umount -lf "$BUILD_PATH/sys" if [ $? -ne 0 ];then warning "line $LINENO Warning : error unmounting $BUILD_PATH/sys, continuing anyway" ERRORN=$((ERRORN++)) fi - /bin/umount "$BUILD_PATH/proc" + /bin/umount -lf "$BUILD_PATH/proc" if [ $? -ne 0 ];then warning "line $LINENO Warning : error unmounting $BUILD_PATH/proc, continuing anyway" ERRORN=$((ERRORN++)) @@ -505,16 +512,8 @@ UUID=$ROOT_UUID / ext4 defaults 0 0" > "$BUILD_PA case $TARGET in rpi) -# info "copying raspberry firmware in /boot" -# /bin/rsync -rlptDH "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/" "$BOOT" -#TODO copy to bootstrap /boot - cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/start*" "$BOOT" - cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/fixup*" "$BOOT" - #cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/extra/uname_string" "$BOOT" - #cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/extra/uname_string7" "$BOOT" + info "copying config.txt, boot.cmd and 10-vchiq-permissions.rules" - cp "$SOURCE_PATH/$CONFIG_PATH/config.txt" "$BOOT" - cp "$SOURCE_PATH/$CONFIG_PATH/boot.cmd" "$BOOT" cp "$SOURCE_PATH/$CONFIG_PATH/10-vchiq-permissions.rules" "$BUILD_PATH/etc/udev/rules.d/" # Making /etc/modules echo "vchiq @@ -526,11 +525,37 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules /bin/cp -a "$SOURCE_PATH/$CONFIG_PATH/modprobe.conf" "$BUILD_PATH/etc/" chown root:root "$BUILD_PATH/etc/modprobe.conf" - #info "making /boot/cmdline.txt" - #echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait fsck.repair=1" > "$BOOT/cmdline.txt" -# info "copying raspberry modules in /lib/modules" -# /bin/rsync -rlptDH "$FIRMWARE_PATH/$FIRMWARE_DIR/modules/" "$BUILD_PATH/lib/modules/" -# info "copying raspberry optionals files in opt" + info "making /boot/extlinux/extlinux.conf" + mkdir "$BUILD_PATH/boot/extlinux" + sed -e s/\<UUID\>/$BOOT_UUID/g $SOURCE_PATH/$CONFIG_PATH/extlinux.conf >"$BUILD_PATH/boot/extlinux/extlinux.conf" + + info "copying firmware, overlays and dtb in /boot" + cp -a "$BUILD_PATH/usr/lib/linux-"* "$BOOT/dtb" + cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/start"* "$BUILD_PATH/boot/" + cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/fixup"* "$BUILD_PATH/boot/" + cp -a "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/overlays" "$BUILD_PATH/boot/" + + info "copying u-boot binary to /boot" + case $TARGET_VERSION in + 2) + info "copying u-boot for $TARGET 2" + cp "$BUILD_PATH/usr/lib/u-boot/rpi_2/u-boot.bin" "$BUILD_PATH/boot/kernel7" + ;; + 0) + info "copying u-boot for $TARGET 0" + cp "$BUILD_PATH/usr/lib/u-boot/rpi_0_w/u-boot.bin" "$BUILD_PATH/boot/kernel7" + ;; + 1) + info "copying u-boot for $TARGET 1" + cp "$BUILD_PATH/usr/lib/u-boot/rpi/u-boot.bin" "$BUILD_PATH/boot/kernel7" + ;; + 3_32) + info "copying u-boot for $TARGET 3 32 bits" + cp "$BUILD_PATH/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "$BUILD_PATH/boot/kernel7" + ;; + 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" @@ -550,7 +575,7 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules fi info "copying " ;; - xu3 | xu4) + ODROID) ;; esac @@ -593,7 +618,7 @@ fi # parsing commandline -TEMP=$(getopt -o h,a --long all,help,clean,create-chroot,addmedia,create-image,,config:,target:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size: -n $CMDNAME -- "$@") +TEMP=$(getopt -o h,a --long all,help,clean,create-chroot,addmedia,create-image,,config:,target:,target-version:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size: -n $CMDNAME -- "$@") if [ $? -ne 0 ] ; then error "line $LINENO Failed parsing options." >&2 ; exit 1 ; fi eval set -- "$TEMP" @@ -659,8 +684,12 @@ do fi shift ;; - --system) - SYSTEM=$2 + --target) + TARGET=$2 + shift 2 + ;; + --target-version) + TARGET_VERSION=$2 shift 2 ;; --config) @@ -684,7 +713,7 @@ done info "Option: "$OPT -IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET.img" +IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET$TARGET_VERSION.img" BOOT="/mnt/boot" ROOT="/mnt/root" BUILD_PATH="$INSTALL_PATH/build" @@ -722,7 +751,7 @@ fi # assign function for building image of TARGET ( rpi, xu3 or xu4 ) case $TARGET in -xu3|xu4) +odroid) CREATEIMG="createxu3image" ;; rpi) @@ -788,6 +817,7 @@ case $OPT in addmedia updatemirror installbasesystem + preparechroot jumpchroot $CREATEIMG ;; diff --git a/mageia4arm.cfg.template b/mageia4arm.cfg.template index 5432f98..8db59e0 100644 --- a/mageia4arm.cfg.template +++ b/mageia4arm.cfg.template @@ -19,7 +19,8 @@ MAGEIA_VERSION="6" ARM_VERSION="armv7hl" #target plateform (xu3-4 or rpi) -TARGET="xu3-4" +TARGET="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" diff --git a/rpi/bcm2836-rpi-2-b.dtb b/rpi/bcm2836-rpi-2-b.dtb Binary files differnew file mode 100755 index 0000000..06ba65b --- /dev/null +++ b/rpi/bcm2836-rpi-2-b.dtb diff --git a/rpi/bcm2837-rpi-3-b-plus.dtb b/rpi/bcm2837-rpi-3-b-plus.dtb Binary files differnew file mode 100755 index 0000000..9fa2dd4 --- /dev/null +++ b/rpi/bcm2837-rpi-3-b-plus.dtb diff --git a/rpi/bcm2837-rpi-3-b.dtb b/rpi/bcm2837-rpi-3-b.dtb Binary files differnew file mode 100755 index 0000000..7ed21fb --- /dev/null +++ b/rpi/bcm2837-rpi-3-b.dtb diff --git a/rpi/extlinux.conf b/rpi/extlinux.conf new file mode 100644 index 0000000..7f6b846 --- /dev/null +++ b/rpi/extlinux.conf @@ -0,0 +1,10 @@ +menu autoboot Welcome to Mageia-Minimal. +timeout 20 +default Mageia + +label Mageia + kernel /vmlinuz + append root=UUID=<UUID> 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" + fdtdir /dtb/ + initrd /initrd + diff --git a/rpi/mageia4arm.cfg b/rpi/mageia4arm.cfg index e1b78d9..5bea977 100644 --- a/rpi/mageia4arm.cfg +++ b/rpi/mageia4arm.cfg @@ -1,5 +1,5 @@ -# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <dtux@free.fr> +# 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 @@ -20,11 +20,16 @@ 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="3_32" # 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="<change this>" + +INSTALL_PATH="/mnt/perso/raspi-test" # Build directory will be created here BUILD_PATH="$INSTALL_PATH/build" @@ -33,7 +38,6 @@ BUILD_PATH="$INSTALL_PATH/build" IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET.img" #Mount point of image's partitions -#no need to be changed BOOT="/mnt/boot" ROOT="/mnt/root" @@ -48,9 +52,8 @@ ROOT_PWD="piroot" 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 +#Path where the raspberry pi firmware is/will be installed FIRMWARE_PATH="$INSTALL_PATH" FIRMWARE_DIR="firmware-stable" diff --git a/rpi/second_stage_install.sh b/rpi/second_stage_install.sh index d8d92ef..a22a8fe 100644 --- a/rpi/second_stage_install.sh +++ b/rpi/second_stage_install.sh @@ -23,7 +23,7 @@ #Install all packages you need # No verifying rpm due to a bug in packages, some are not signed -/usr/sbin/urpmi --auto --no-verify-rpm basesystem chrony rng-tools man openssh-server rfkill wireless-tools bluez wpa_supplicant make dracut u-boot-tools bcm283x-firmware rsync +/usr/sbin/urpmi --auto --no-verify-rpm basesystem chrony rng-tools man openssh-server rfkill wireless-tools bluez wpa_supplicant make dracut u-boot rsync kernel-desktop-latest /usr/bin/chown :chrony -R /etc/chrony.keys /var/log/chrony @@ -36,3 +36,6 @@ KV=`basename /boot/vmlinuz-*` KV=${KV#vmlinuz-} dracut --kver $KV +rm -f $0 +cp /boot/vmlinuz-* /boot/vmlinuz +cp /boot/initrd-* /boot/initrd |