Not only "you can do this with Linux", but also the commitment to practicality seen from the in-vehicle Linux demo https://monoist.atmarkit.co.jp/mn/articles/2002/06/news059.html?fbclid=IwAR2IGj6zisyVofRKcx5Lkum_A_t1wdePDKvLdYtWEhCu9inIg2QQgcda1A0
The Automotive Grade Linux (AGL) materials have not been organized.
https://www.automotivelinux.org/
Document
The Automotive Grade Linux Software Defined Connected Car Architecture 20th June 2018 Final https://www.automotivelinux.org/wp-content/uploads/sites/4/2018/06/agl_software_defined_car_jun18.pdf
2018 Global In-Vehicle Infotainment Enabling Technology Leadership Award https://www.automotivelinux.org/wp-content/uploads/sites/4/2019/05/Frost-Sullivan-Automotive-Grade-Linux-Award-Write-Up.pdf
The Linux Foundation. https://www.linuxfoundation.org/
Wiki https://wiki.automotivelinux.org/
Git Repositories https://git.automotivelinux.org/
docker-worker-generator https://git.automotivelinux.org/AGL/docker-worker-generator/
Dockerfile
FROM debian:10
COPY INSTALL /root/INSTALL
RUN /root/INSTALL/setup_image.sh
ENTRYPOINT ["/usr/bin/wait_for_net.sh"]
CMD ["/bin/systemd"]
setup_image.sh
setup_image.sh
#!/bin/bash -x
### this script is called when building the docker image: it's executing in a temp container
echo "------------------------ Starting $(basename $0) -----------------------"
function debug() {
set +x
echo "-------------------------"
echo "Command failed."
echo "Running sleep for 1 day. To proceed:"
echo "* run 'killall sleep' to continue"
echo "* run 'killall -9 sleep' to abort the build"
sig=0
sleep 86400 || sig=$?
# if killed -9, then abort
[[ $sig == 137 ]] && exit 1 # abort
set -x
return 0 # continue
}
function crash() {
set +x
echo " -------------------------"
echo "| CRASH HANDLER TRIGGERED |"
echo " -------------------------"
exit 1
}
# get the INSTALL dir (the one where we were launched)
INSTDIR=$(cd $(dirname $0) && pwd -P)
echo "Detected container install dir = $INSTDIR"
if [[ -f $INSTDIR/DEBUG ]]; then
echo "#### INTERACTIVE DEBUG MODE IS ACTIVE ####"
trap debug ERR # on error, run a sleep tp debug container
else
echo "#### JENKINS MODE MODE IS ACTIVE ####"
trap crash ERR # on error, simply crash
fi
################################## variables #################################
# source variables in conf file
. $INSTDIR/image.conf
# source flavour config file (generated by top Makefile)
. $INSTDIR/flavour.conf
if [[ -z "$CONTAINER_TYPE" ]]; then
grep -q docker /proc/self/cgroup && CONTAINER_TYPE="docker"
fi
################################## install docker endpoint #####################
# install the entrypoint script in /usr/bin
install --mode=755 $INSTDIR/wait_for_net.sh /usr/bin/
################################## install first-run service ###################
# all operations requiring runnning daemons (inc. systemd) must be run at first
# container instanciation
if [[ "$FIRSTRUN" == "yes" ]]; then
install --mode=755 $INSTDIR/firstrun.sh /root/firstrun.sh
install --mode=644 $INSTDIR/image.conf /root/firstrun.conf
[[ -d $INSTDIR/firstrun.d ]] && cp -a $INSTDIR/firstrun.d /root/
mkdir -p /etc/systemd/system/multi-user.target.wants/
cat <<EOF >/etc/systemd/system/multi-user.target.wants/firstrun.service
[Unit]
Description=Firstrun service
After=network.target
[Service]
Type=oneshot
ExecStart=-/bin/bash -c /root/firstrun.sh
TimeoutSec=0
StandardInput=null
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
fi
# helper func to install a firstrun hook
function firstrun_add() {
script=$1
level=${2:-50}
name=${3:-$(basename $script)}
mkdir -p /root/firstrun.d
cp $script /root/firstrun.d/${level}_$name
}
################################## adjust system timezone ############################
ln -sf ../usr/share/zoneinfo/$TIMEZONE /etc/localtime
################################## run other scripts in turn ##############
function enumerate_tasks() {
for script in $INSTDIR/common.d/*; do
case $(basename $script) in
[0-9][0-9]_*)
echo $(basename $script):$script
;;
esac
done
for tsk in $(cat $INSTDIR/flavours/$FLAVOUR.tasks | sed 's/#.*$//g'); do
if [[ -f $INSTDIR/tasks.d/$tsk ]]; then
echo $tsk:$INSTDIR/tasks.d/$tsk
else
# fail to find task
echo "$INSTDIR/flavours/$FLAVOUR.tasks: invalid task '$tsk'" >&2
return 1
fi
done
return 0
}
for script in $(enumerate_tasks | sort -k1 -t':' | cut -f2 -d':'); do
echo "--------------------- start script $script ---------------------"
. $script
echo "--------------------- end of script $script ---------------------"
done
############################### cleanup ###################################
cd /
apt-get clean # clean apt caches
rm -rf /var/lib/apt/lists/*
rm -rf $INSTDIR # yes, I can auto-terminate myself !
# cleanup /tmp without removing the dir
for x in $(find /tmp -mindepth 1); do
rm -rf $x || true
done
echo "------------------------ $(basename $0) finished -----------------------"
wait_for_net.sh
wait_for_net.sh
#!/bin/bash
### this script is used as entrypoint of the docker container to wait for network to be up ###
IFACE="veth0 eth0"
function wait_net() {
for i in $IFACE; do
[[ "$(cat /sys/class/net/$i/operstate 2>/dev/null)" == "up" ]] && return 1
ip link set mtu 1300 dev $IFACE
done
return 0
}
while wait_net; do
sleep 1
done
[[ $# > 0 ]] && exec "$@"
exec /bin/bash -l
Members
Platinum Members
Denso Mazuda Panasonic Renesas suzuki TOYOTA
Advisory Board HONDA NTTDATA DENSOTEN Mercedes-Benz