Commit e25b77c3 authored by Martin Michlmayr's avatar Martin Michlmayr

Handle DTBs in vendor subdirectories (as found on arm64 kernels)

As of 3.19-rc1, DTBs on arm64 are placed in vendor subdirectories,
i.e. vendor/dtb.  Handle such DTBs by searching the whole kernel
hierarchy.

The DTB continues to be installed in dtbs/kvers/dtb (without a
vendor subdirectory) because the boot script looks for
for dtbs/${fk_kvers}/${fdtfile} and $fdtfile doesn't contain the
vendor subdir.

The current approach assumes that DTB filenames are unique when
disregarding the vendor dir.  I believe this is a pretty safe
assumption since DTB filenames start with the platform name.
If the assumption turns out to be incorrect in the future, we can
add the vendor dir to DTB-Id where needed and change the code to
look for vendor/dtb before looking for just dtb.

This approach was discussed here:
https://lists.debian.org/debian-boot/2016/07/msg00281.html
parent 9a7fd8c0
......@@ -115,9 +115,13 @@ The supported fields are:
This option is ignored if a DTB is to be appended, via either DTB-Append or
DTB-Append-From.
* DTB-Id: (optional) specifies the name of the DTB file for this device. If
the value begins with a `!' then the field is a script which should be run.
The script must produce the DTB filename (and nothing else) on stdout.
* DTB-Id: (optional) specifies the name of the DTB file for this device
relative to the kernel package DTB dir or /etc/flash-kernel/dtbs.
It's not necessary to specify the directory if the DTB is in a vendor
subdirectory as flash-kernel will search for the filename in
subdirectories. If the value begins with a `!' then the field is a script
which should be run. The script must produce the DTB filename (just the
filename, without a vendor subdirectory) on stdout (and nothing else).
* DTB-Append: (optional) when yes the DTB specified by DTB-Id will be appended
to the kernel image.
......
......@@ -12,6 +12,9 @@ flash-kernel (3.68) UNRELEASED; urgency=medium
- Xunlong Orange Pi 2
* Fix the DTB-ID for generic Allwinner-A13-based Q8-form-factor tablets.
[ Martin Michlmayr ]
* Handle DTBs in vendor subdirectories (as found on arm64 kernels).
-- Karsten Merker <merker@debian.org> Tue, 05 Jul 2016 15:07:14 +0200
flash-kernel (3.67) unstable; urgency=medium
......
......@@ -241,6 +241,12 @@ get_dtb_name() {
;;
esac
if [ -n "$dtb_name" ] ; then
# DTBs on arm64 are stored in subdirs for each vendor; strip
# the dir away (in case someone specified it, although it's
# not needed).
# The DTB will be stored in /boot/dtbs/$kvers/ without
# additional subdirs.
dtb_name=$(basename $dtb_name)
echo "DTB: $dtb_name" >&2
fi
}
......@@ -558,11 +564,11 @@ find_dtb_file() {
echo "$dtb_name"
;;
*)
if [ -e "/etc/flash-kernel/dtbs/$dtb_name" ] ; then
echo "/etc/flash-kernel/dtbs/$dtb_name"
else
echo "/usr/lib/linux-image-$kvers/$dtb_name"
local dtb=$(find /etc/flash-kernel/dtbs -name $dtb_name 2>/dev/null | head -n 1)
if [ -z "$dtb" ]; then
dtb=$(find /usr/lib/linux-image-$kvers -name $dtb_name 2>/dev/null | head -n 1)
fi
echo $dtb
;;
esac
}
......@@ -597,8 +603,8 @@ handle_dtb() {
rmdir --ignore-fail-on-non-empty /boot/dtbs
fi
else
if [ -e $dtb ]; then
echo "Installing $dtb_name into /boot/dtbs/$kvers/$dtb_name" >&2
if [ -e "$dtb" ]; then
echo "Installing $dtb into /boot/dtbs/$kvers/$dtb_name" >&2
mkdir -p /boot/dtbs/$kvers/
cp "$dtb" "/boot/dtbs/$kvers/$dtb_name.new"
backup_and_install \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment