|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
#
|
|
# Filename: lib/boot/boot.in
|
|
# Copyright (C) 2008 The OpenSDE Project
|
|
#
|
|
# More information can be found in the files COPYING and README.
|
|
#
|
|
# 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; version 2 of the License. A copy of the
|
|
# GNU General Public License can be found in the file COPYING.
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
# by default we will peek the first suitable bootloader found
|
|
#
|
|
boot_choose_bootloader() { head -n 1; }
|
|
|
|
# variables
|
|
#
|
|
bootloader=
|
|
|
|
# load stuff from the architecture, if anything to load.
|
|
[ ! -s "architecture/$arch/boot.in" ] || . "architecture/$arch/boot.in"
|
|
# and allow targets to overload these functions and variables
|
|
# FIXME: this should honor the target_chain, in reverse order, peeking the first one.
|
|
[ ! -s "target/$target/boot.in" ] || . "target/$target/boot.in"
|
|
|
|
|
|
# if the target didn't choose one already, find the suitables and choose one
|
|
if [ -z "$bootloader" ]; then
|
|
bootloader="$(
|
|
ls -1d `sed -n -e 's,^X [^ ]\+ [^ ]\+ \([^ ]\+\) \([^ ]\+\) .* BOOT .*,package/\1/\2/boot/boot.in,p' \
|
|
"config/$config/packages"` 2> /dev/null |
|
|
cut -d/ -f'2,3' | boot_choose_bootloader )"
|
|
fi
|
|
|
|
# validate the module, and source.
|
|
#
|
|
if [ -z "$bootloader" ]; then
|
|
echo_error "boot: couldn't find any suitable bootloader."
|
|
exit 1
|
|
elif [ ! -e "package/$bootloader/boot/boot.in" ]; then
|
|
echo_error "boot: '$bootloader' is not suitable."
|
|
else
|
|
echo_status "boot: using $bootloader."
|
|
fi
|
|
|
|
# stub boot_cd_*() functions
|
|
#
|
|
boot_cd_pre() { echo_warning "No specific boot_cd_pre() available."; }
|
|
boot_cd_add() { echo_warning "No specific boot_cd_add() available."; }
|
|
boot_cd_post() { echo_warning "No specific boot_cd_post() available."; }
|
|
|
|
. "package/$bootloader/boot/boot.in"
|
|
|