mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
orangepizero2/sun50iw9/legacy: implement pre_package_kernel_image hook to convert vmlinuz to uImage manually; fix legacy u-boot build
- sourceaddr `0x40008000` was found in Xunlong's legacy kernel source squashed into a huge commit. Thanks, Xunlong! - bring `busybox` dependency with inline hook for legacy u-boot "unix2dos" which is essential
This commit is contained in:
@@ -12,15 +12,14 @@ PACKAGE_LIST_BOARD="rfkill bluetooth bluez bluez-tools"
|
|||||||
FORCE_BOOTSCRIPT_UPDATE="yes"
|
FORCE_BOOTSCRIPT_UPDATE="yes"
|
||||||
|
|
||||||
function post_family_tweaks_bsp__orangepizero2_BSP() {
|
function post_family_tweaks_bsp__orangepizero2_BSP() {
|
||||||
display_alert "Installing BSP firmware and fixups"
|
display_alert "Installing BSP firmware and fixups"
|
||||||
|
: "${destination:?}"
|
||||||
|
|
||||||
if [[ $BRANCH == legacy ]]; then
|
if [[ $BRANCH == legacy ]]; then
|
||||||
|
|
||||||
# Bluetooth for most of others (custom patchram is needed only in legacy)
|
# Bluetooth for most of others (custom patchram is needed only in legacy)
|
||||||
install -m 755 $SRC/packages/bsp/rk3399/brcm_patchram_plus_rk3399 $destination/usr/bin
|
install -m 755 $SRC/packages/bsp/rk3399/brcm_patchram_plus_rk3399 $destination/usr/bin
|
||||||
cp $SRC/packages/bsp/rk3399/rk3399-bluetooth.service $destination/lib/systemd/system/
|
cp $SRC/packages/bsp/rk3399/rk3399-bluetooth.service $destination/lib/systemd/system/
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ for overlay_file in ${user_overlays}; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Legacy uboot, requires uImage - see pre_package_kernel_image__orangepi_legacy_uImage_manual_conversion()
|
||||||
load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd
|
load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd
|
||||||
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}uImage
|
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}uImage
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,27 @@ case $BRANCH in
|
|||||||
|
|
||||||
legacy)
|
legacy)
|
||||||
|
|
||||||
|
# Legacy kernel
|
||||||
LINUXFAMILY=sun50iw9
|
LINUXFAMILY=sun50iw9
|
||||||
KERNELSOURCE='https://github.com/orangepi-xunlong/linux-orangepi.git'
|
KERNELSOURCE='https://github.com/orangepi-xunlong/linux-orangepi.git'
|
||||||
declare -g KERNEL_MAJOR_MINOR="4.9" # Major and minor versions of this kernel.
|
declare -g KERNEL_MAJOR_MINOR="4.9" # Major and minor versions of this kernel.
|
||||||
KERNELBRANCH="branch:orange-pi-4.9-sun50iw9"
|
KERNELBRANCH="branch:orange-pi-4.9-sun50iw9"
|
||||||
KERNELPATCHDIR=${BOARDFAMILY}-${BRANCH}
|
KERNELPATCHDIR=${BOARDFAMILY}-${BRANCH}
|
||||||
KERNELDIR='linux-orangepi'
|
KERNELDIR='linux-orangepi'
|
||||||
|
INITRD_ARCH=arm
|
||||||
|
ASOUND_STATE='asound.state.sun50iw9-legacy'
|
||||||
|
|
||||||
|
# This (legacy/vendor) kernel requires uImage manual conversion; do it via a 'pre_package_kernel_image' hook.
|
||||||
|
function pre_package_kernel_image__orangepi_legacy_uImage_manual_conversion() {
|
||||||
|
display_alert "Converting" "${BOARDFAMILY} - ${LINUXFAMILY} :: legacy :: uImage" "warn"
|
||||||
|
if [[ -z "${kernel_image_pre_package_path}" || ! -f "${kernel_image_pre_package_path}" ]]; then
|
||||||
|
exit_with_error "kernel_image_pre_package_path ('${kernel_image_pre_package_path}') is not set or does not exist"
|
||||||
|
fi
|
||||||
|
run_host_command_logged mkimage -A arm -O linux -T kernel -C none -a "'0x40008000'" -e "'0x40008000'" -n "'Linux kernel'" -d "${kernel_image_pre_package_path}" "${kernel_image_pre_package_path}.uImage.tmp"
|
||||||
|
run_host_command_logged mv -v "${kernel_image_pre_package_path}.uImage.tmp" "${kernel_image_pre_package_path}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Legacy u-boot
|
||||||
BOOTSOURCE='https://github.com/orangepi-xunlong/u-boot-orangepi.git'
|
BOOTSOURCE='https://github.com/orangepi-xunlong/u-boot-orangepi.git'
|
||||||
BOOTBRANCH='branch:v2018.05-sun50iw9'
|
BOOTBRANCH='branch:v2018.05-sun50iw9'
|
||||||
BOOTPATCHDIR="legacy"
|
BOOTPATCHDIR="legacy"
|
||||||
@@ -34,9 +49,6 @@ case $BRANCH in
|
|||||||
OFFSET=20
|
OFFSET=20
|
||||||
ATFSOURCE=""
|
ATFSOURCE=""
|
||||||
ATF_COMPILE="no"
|
ATF_COMPILE="no"
|
||||||
INITRD_ARCH=arm
|
|
||||||
|
|
||||||
ASOUND_STATE='asound.state.sun50iw9-legacy'
|
|
||||||
|
|
||||||
# this overrides the one in sunxi64_common.inc
|
# this overrides the one in sunxi64_common.inc
|
||||||
function write_uboot_platform() {
|
function write_uboot_platform() {
|
||||||
@@ -56,6 +68,12 @@ case $BRANCH in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# This build requires busybox (and dos2unix)
|
||||||
|
function add_host_dependencies__sunxi_add_32_bit_c_compiler() {
|
||||||
|
display_alert "Adding busybox dep" "for ${BOARD} bootloader compile" "debug"
|
||||||
|
declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} busybox"
|
||||||
|
}
|
||||||
|
|
||||||
function family_tweaks_s() {
|
function family_tweaks_s() {
|
||||||
if [[ -f $SDCARD/lib/systemd/system/aw859a-bluetooth.service ]]; then
|
if [[ -f $SDCARD/lib/systemd/system/aw859a-bluetooth.service ]]; then
|
||||||
# Enable Bluetooth
|
# Enable Bluetooth
|
||||||
@@ -82,18 +100,45 @@ function family_tweaks_bsp() {
|
|||||||
function uboot_custom_postprocess() {
|
function uboot_custom_postprocess() {
|
||||||
if [[ ${BRANCH} == legacy ]]; then
|
if [[ ${BRANCH} == legacy ]]; then
|
||||||
display_alert "Post-processing U-Boot" "$BOARD - $BRANCH" "info"
|
display_alert "Post-processing U-Boot" "$BOARD - $BRANCH" "info"
|
||||||
run_host_command_logged cp -pv ${SRC}/packages/pack-uboot/${BOARDFAMILY}/bin/* . -r
|
# "Vendor" code (by Igor) is at https://raw.githubusercontent.com/orangepi-xunlong/orangepi-build/main/external/config/sources/families/sun50iw9.conf
|
||||||
|
|
||||||
|
run_host_command_logged rm -rfv dts/*.dts sys_config ${BOARD}-u-boot.dtb
|
||||||
|
|
||||||
|
run_host_command_logged cp -rpv ${SRC}/packages/pack-uboot/${BOARDFAMILY}/bin/* .
|
||||||
|
|
||||||
run_host_command_logged cp -pv sys_config/sys_config_${BOARD}.fex sys_config.fex
|
run_host_command_logged cp -pv sys_config/sys_config_${BOARD}.fex sys_config.fex
|
||||||
run_host_command_logged cp -pv u-boot.bin u-boot.fex
|
run_host_command_logged cp -pv u-boot.bin u-boot.fex
|
||||||
|
|
||||||
|
# [[ ${BOARD} =~ orangepizero2-b|orangepizero2-lts ]] && run_host_command_logged mv -v boot0_sdcard_new.fex boot0_sdcard.fex # From vendor code, they have multiple of those boards
|
||||||
|
|
||||||
|
# make u-boot dtb
|
||||||
run_host_command_logged dtc -p 2048 -W no-unit_address_vs_reg -@ -O dtb -o ${BOARD}-u-boot.dtb -b 0 dts/${BOARD}-u-boot.dts
|
run_host_command_logged dtc -p 2048 -W no-unit_address_vs_reg -@ -O dtb -o ${BOARD}-u-boot.dtb -b 0 dts/${BOARD}-u-boot.dts
|
||||||
|
[[ ! -f "${BOARD}-u-boot.dtb" ]] && exit_with_error "dts compilation failed for ${BOARD}-u-boot.dtb"
|
||||||
|
|
||||||
|
run_host_command_logged busybox unix2dos sys_config.fex
|
||||||
|
|
||||||
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/script sys_config.fex
|
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/script sys_config.fex
|
||||||
run_host_command_logged cp -pv ${BOARD}-u-boot.dtb sunxi.fex
|
run_host_command_logged cp -pv ${BOARD}-u-boot.dtb sunxi.fex
|
||||||
|
|
||||||
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/update_dtb sunxi.fex 4096
|
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/update_dtb sunxi.fex 4096
|
||||||
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/update_boot0 boot0_sdcard.fex sys_config.bin SDMMC_CARD
|
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/update_boot0 boot0_sdcard.fex sys_config.bin SDMMC_CARD
|
||||||
# @TODO: rpardini: this looks wrong
|
|
||||||
|
# rpardini: this looks wrong, but isn't. look at vendor code.
|
||||||
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/update_uboot -no_merge u-boot.fex sys_config.bin
|
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/update_uboot -no_merge u-boot.fex sys_config.bin
|
||||||
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/update_uboot -no_merge u-boot.bin sys_config.bin
|
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/update_uboot -no_merge u-boot.bin sys_config.bin
|
||||||
|
|
||||||
|
#pack boot package
|
||||||
|
run_host_command_logged busybox unix2dos boot_package.cfg
|
||||||
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/dragonsecboot -pack boot_package.cfg
|
run_host_command_logged $SRC/packages/pack-uboot/${BOARDFAMILY}/tools/dragonsecboot -pack boot_package.cfg
|
||||||
|
|
||||||
|
# From vendor code, we never had this.
|
||||||
|
#if [[ ${MERGE_UBOOT} == yes ]]; then
|
||||||
|
# display_alert "Merge u-boot" "u-boot-${BOARD}-merged.bin" "info"
|
||||||
|
# dd if=/dev/zero of=u-boot-${BOARD}-merged.bin bs=1M count=20 > /dev/null 2>&1
|
||||||
|
# dd if=boot0_sdcard.fex of=u-boot-${BOARD}-merged.bin bs=8k seek=1 conv=fsync > /dev/null 2>&1
|
||||||
|
# dd if=boot_package.fex of=u-boot-${BOARD}-merged.bin bs=8k seek=2050 conv=fsync > /dev/null 2>&1
|
||||||
|
# mv u-boot-${BOARD}-merged.bin ${DEB_STORAGE}/u-boot/
|
||||||
|
#fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user