From db7fa5afd6a9416ad1fee85c268d9d913df5d2a7 Mon Sep 17 00:00:00 2001 From: zador-blood-stained Date: Wed, 15 Jun 2016 19:44:14 +0300 Subject: [PATCH] Modify firmware packaging procedure --- boards.sh | 3 --- common.sh | 46 ++++++----------------------------------- configuration.sh | 2 -- debootstrap-ng.sh | 11 +++++++--- extras/firmware.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++ general.sh | 3 ++- main.sh | 2 -- 7 files changed, 67 insertions(+), 51 deletions(-) create mode 100644 extras/firmware.sh diff --git a/boards.sh b/boards.sh index 5a79ba92fd..46d88a9822 100644 --- a/boards.sh +++ b/boards.sh @@ -87,9 +87,6 @@ install_kernel (){ display_alert "Installing packages" "$CHOSEN_KERNEL" "info" - # mount deb storage to tmp - mount --bind $DEST/debs/ $CACHEDIR/sdcard/tmp - # install custom root package display_alert "Installing board support package" "$BOARD" "info" chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/$RELEASE/${CHOSEN_ROOTFS}_${REVISION}_${ARCH}.deb > /dev/null" diff --git a/common.sh b/common.sh index 200007b8f1..75b08a23ba 100644 --- a/common.sh +++ b/common.sh @@ -21,7 +21,8 @@ # write_uboot # customize_image -compile_uboot (){ +compile_uboot() +{ #--------------------------------------------------------------------------------------------------------------------------------- # Compile uboot from sources #--------------------------------------------------------------------------------------------------------------------------------- @@ -104,7 +105,7 @@ compile_uboot (){ fi } -compile_sunxi_tools () +compile_sunxi_tools() { #--------------------------------------------------------------------------------------------------------------------------------- # https://github.com/linux-sunxi/sunxi-tools Tools to help hacking Allwinner devices @@ -114,44 +115,12 @@ compile_sunxi_tools () make -s clean >/dev/null make -s tools >/dev/null mkdir -p /usr/local/bin/ - make install-tools >/dev/null + make install-tools >/dev/null 2>&1 } -compile_firmware () +compile_kernel() { #--------------------------------------------------------------------------------------------------------------------------------- -# http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git + some ours -#--------------------------------------------------------------------------------------------------------------------------------- - display_alert "Merging and packing linux firmware" "@host" "info" - cd $SOURCES/$MISC6_DIR - # overlay our firmware - cp -R $SRC/lib/bin/firmware-overlay/. . - # cleanup what's not needed for sure - rm -rf amdgpu amd-ucode radeon - cd .. - cd .. - # set up control file - mkdir -p DEBIAN - cat <<-END > DEBIAN/control - Package: armbian-firmware - Version: $REVISION - Architecture: $ARCH - Maintainer: $MAINTAINER <$MAINTAINERMAIL> - Installed-Size: 1 - Section: kernel - Priority: optional - Description: Linux firmware - END - cd .. - # pack - mv armbian-firmware armbian-firmware_${REVISION}_${ARCH} - dpkg -b armbian-firmware_${REVISION}_${ARCH} >> $DEST/debug/install.log 2>&1 - mv armbian-firmware_${REVISION}_${ARCH} armbian-firmware - mv armbian-firmware*.deb $DEST/debs/ || exit_with_error "Failed moving kernel DEBs" -} - -compile_kernel (){ -#--------------------------------------------------------------------------------------------------------------------------------- # Compile kernel #--------------------------------------------------------------------------------------------------------------------------------- @@ -352,16 +321,13 @@ process_patch_file() { fi } -install_external_applications () +install_external_applications() { #-------------------------------------------------------------------------------------------------------------------------------- # Install external applications example #-------------------------------------------------------------------------------------------------------------------------------- display_alert "Installing extra applications and drivers" "" "info" -# cleanup for install_kernel and install_board_specific -umount $CACHEDIR/sdcard/tmp >/dev/null 2>&1 - for plugin in $SRC/lib/extras/*.sh; do source $plugin done diff --git a/configuration.sh b/configuration.sh index e8058d34a2..b0b54cdb90 100644 --- a/configuration.sh +++ b/configuration.sh @@ -23,8 +23,6 @@ MISC1="https://github.com/linux-sunxi/sunxi-tools.git" # Allwinner fex compiler MISC1_DIR="sunxi-tools" # local directory MISC5="https://github.com/hglm/a10disp/" # Display changer for Allwinner MISC5_DIR="sunxi-display-changer" # local directory -MISC6="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git" # Linux firmware -MISC6_DIR="armbian-firmware/lib/firmware" # local directory HOST="$BOARD" # set hostname to the board CACHEDIR=$DEST/cache diff --git a/debootstrap-ng.sh b/debootstrap-ng.sh index 4a18e0d4db..cfb5d42eaf 100644 --- a/debootstrap-ng.sh +++ b/debootstrap-ng.sh @@ -65,19 +65,23 @@ debootstrap_ng() # stage: install kernel and u-boot packages # install distribution and board specific applications + + # mount deb storage to tmp + mount --bind $DEST/debs/ $CACHEDIR/sdcard/tmp + install_distribution_specific install_kernel install_board_specific - # cleanup for install_kernel and install_board_specific - umount $CACHEDIR/sdcard/tmp - # install desktop files [[ $BUILD_DESKTOP == yes ]] && install_desktop # install additional applications [[ $EXTERNAL == yes ]] && install_external_applications + # cleanup for install_kernel and install_board_specific + umount $CACHEDIR/sdcard/tmp + # stage: user customization script # NOTE: installing too many packages may fill tmpfs mount customize_image @@ -539,6 +543,7 @@ unmount_on_exit() { trap - INT TERM EXIT umount_chroot + umount -l $CACHEDIR/sdcard/tmp >/dev/null 2>&1 umount -l $CACHEDIR/sdcard >/dev/null 2>&1 umount -l $CACHEDIR/mount/boot >/dev/null 2>&1 umount -l $CACHEDIR/mount >/dev/null 2>&1 diff --git a/extras/firmware.sh b/extras/firmware.sh new file mode 100644 index 0000000000..22279907d9 --- /dev/null +++ b/extras/firmware.sh @@ -0,0 +1,51 @@ +# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com +# +# This file is licensed under the terms of the GNU General Public +# License version 2. This program is licensed "as is" without any +# warranty of any kind, whether express or implied. +# +# This file is a part of tool chain https://github.com/igorpecovnik/lib +# + +build_firmware() +{ + display_alert "Merging and packaging linux firmware" "@host" "info" + + local plugin_repo="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git" + local plugin_dir="armbian-firmware" + + #fetch_from_github "$plugin_repo" "$plugin_dir/lib/firmware" + mkdir -p $plugin_dir/lib/firmware + # overlay our firmware + cp -R $SRC/lib/bin/firmware-overlay/* $SOURCES/$plugin_dir/lib/firmware + + # cleanup what's not needed for sure + rm -rf $plugin_dir/lib/firmware/{amdgpu,amd-ucode,radeon,nvidia} + cd $SOURCES/$plugin_dir + + # set up control file + mkdir -p DEBIAN + cat <<-END > DEBIAN/control + Package: armbian-firmware + Version: $REVISION + Architecture: all + Maintainer: $MAINTAINER <$MAINTAINERMAIL> + Installed-Size: 1 + Section: kernel + Priority: optional + Description: Linux firmware + END + + cd $SOURCES + # pack + mv armbian-firmware armbian-firmware_${REVISION}_all + dpkg -b armbian-firmware_${REVISION}_all >> $DEST/debug/install.log 2>&1 + mv armbian-firmware_${REVISION}_all armbian-firmware + mv armbian-firmware_${REVISION}_all.deb $DEST/debs/ || exit_with_error "Failed moving firmware package" +} + +[[ ! -f $DEST/debs/armbian-firmware_${REVISION}_all.deb ]] && build_firmware + +# install +display_alert "Installing linux firmware" "$REVISION" "info" +chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/armbian-firmware_${REVISION}_all.deb" >> $DEST/debug/output.log diff --git a/general.sh b/general.sh index b03976f5e0..aa88eb5dfe 100644 --- a/general.sh +++ b/general.sh @@ -179,7 +179,8 @@ display_alert() # log function parameters to install.log echo "Displaying message: $@" >> $DEST/debug/install.log -[[ -n $2 ]] && local tmp="[\e[0;33m $2 \x1B[0m]" +local tmp="" +[[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]" case $3 in err) diff --git a/main.sh b/main.sh index 45711e5582..5e64f036c2 100644 --- a/main.sh +++ b/main.sh @@ -235,8 +235,6 @@ if [[ ! -f $DEST/debs/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb ]]; then compile_kernel fi -[[ ! -f $DEST/debs/armbian-firmware_${REVISION}_${ARCH}.deb ]] && compile_firmware - [[ -n $RELEASE ]] && create_board_package if [[ $KERNEL_ONLY != yes ]]; then