Modify firmware packaging procedure

This commit is contained in:
zador-blood-stained 2016-06-15 19:44:14 +03:00
parent d7dac79d3d
commit db7fa5afd6
7 changed files with 67 additions and 51 deletions

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

51
extras/firmware.sh Normal file
View File

@ -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

View File

@ -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)

View File

@ -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