Merge branch 'feature/linux-rt'

This commit is contained in:
Ricardo Martins 2016-03-28 10:48:04 +01:00
commit 7699d8c06a
3 changed files with 91 additions and 8 deletions

View File

@ -40,3 +40,15 @@ err()
{
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] \033[0m\033[1;31mERROR: $*\033[0m"
}
ucat()
{
case "$1" in
*.gz)
zcat "$1"
;;
*)
cat "$1"
;;
esac
}

View File

@ -25,13 +25,55 @@ requires=\
'lz4/host'
)
# Major/Minor version.
linux_mm_version()
{
echo "$version" | cut -f1-2 -d.
}
# Major/Minor/Patch version.
linux_mmp_version()
{
echo "$version" | cut -f1 -d-
}
patches=(\
$(ls -1 \
"$pkg_dir/patches/$version/"*.patch \
"$pkg_dir/patches/$(linux_mmp_version)/"*.patch \
"$pkg_dir/patches/$(linux_mm_version)/"*.patch \
"$cfg_dir_system/patches/linux/$version/"*.patch \
"$cfg_dir_system/patches/linux/$(linux_mmp_version)/"*.patch \
"$cfg_dir_system/patches/linux/$(linux_mm_version)/"*.patch \
2> /dev/null | awk '!a[$0]++')
)
# Get configuration file.
linux_cfg_file()
{
for f in "$version" "$(linux_mmp_version)" "$(linux_mm_version)"; do
f="$cfg_dir_system/cfg/linux-$f.cfg"
if [ -f "$f" ]; then
echo "$f"
return 0
fi
echo "Candidate kernel configuration file '$f' doesn't exist." 1>&2
done
echo "ERROR: failed to find a valid kernel configuration file." 1>&2
return 1
}
post_unpack()
{
patches=$(ls "$pkg_dir/patches/$version/"*.patch\
"$cfg_dir_system/patches/linux/$version/"*.patch 2>/dev/null)
if [ -n "$patches" ]; then
cat $patches | patch -p1
fi
n=0; while [ -n "${patches[$n]}" ]; do
patch="${patches[$n]}"
echo "* Applying $patch..."
(ucat "$patch" | patch -p1) || return 1
let n++
done
if [ -d "$cfg_dir_toolchain/firmware" ]; then
tar -C "$cfg_dir_toolchain/firmware" -c -v -f - . | tar -C firmware -x -v -f -
@ -41,7 +83,7 @@ post_unpack()
refresh()
{
for rule in configure build target_install; do
if [ "$cfg_dir_system/cfg/linux-${version}.cfg" -nt "$cfg_dir_builds/linux/$pkg_var/.$rule" ]; then
if [ "$(linux_cfg_file)" -nt "$cfg_dir_builds/linux/$pkg_var/.$rule" ]; then
rm "$cfg_dir_builds/linux/$pkg_var/.$rule"
fi
done
@ -51,9 +93,11 @@ configure()
{
$cmd_make \
ARCH=${cfg_target_linux} \
mrproper &&
mrproper || return 1
cp "$cfg_dir_system/cfg/linux-${version}.cfg" .config &&
cfg="$(linux_cfg_file)"
[ -n "$cfg" ] || return 1
$cmd_cp "$cfg" .config || return 1
if [ -f "$cfg_dir_system/files/initramfs_init.sh" ]; then
$cmd_mkdir initramfs &&

27
rules/linux/rt.bash Normal file
View File

@ -0,0 +1,27 @@
. "$cfg_dir_rules/$pkg/default.bash"
version=\
(
'3.14.64-rt67'
)
url=\
(
"https://www.kernel.org/pub/linux/kernel/v3.x/linux-$(linux_mmp_version).tar.xz"
"https://www.kernel.org/pub/linux/kernel/projects/rt/$(linux_mm_version)/patch-$version.patch.gz"
)
md5=\
(
'd68173a31fb60e2195a4015fe1f83e97'
'03be9388659d844c362e507ddba2d777'
)
maintainer=\
(
'Ricardo Martins <rasm@oceanscan-mst.com>'
)
patches=("$cfg_dir_downloads/patch-$version.patch.gz" "${patches[@]}")
build_dir="linux-$(linux_mmp_version)"