Ini adalah jurnal singkat iseng-iseng unpacking firmware head unit mobil Chrysler yang berbasis QNX. Berikut ini adalah langkah-langkahnya:

  • Mount terlebih dahulu file image firmware updatenya berupa file .iso:
% sudo mount -o ro,loop chrysler-swdl.iso /mnt/tmp
  • Setelah itu, copy file IFS dari image yang sudah di-mount pada langkah sebelumnya:
% cp /mnt/tmp/usr/share/IFS/ifs-cmc.bin .
  • Dari sini, kita bisa melakukan umount terhadap image file tersebut:
% sudo umount /mnt/tmp
  • Langkah berikutnya adalah, kita akan melakukan kloning terhadap repositori tools yang dapat digunakan untuk melakukan operasi pada format IFS yang digunakan oleh target:
% git clone https://github.com/askac/dumpifs
  • Selanjutnya pindah ke sub direktori dumpifs tersebut:
% cd dumpifs
  • Beberapa kode sumber pada repositori dumpifs tersebut perlu diedit sesuai kebutuhan. Misalnya, jika pada sistem yang kita gunakan tidak terdapat clang, maka kita dapat menggunakan gcc pada Makefile seperti ini:
% sed -i 's/clang/gcc/' Makefile
  • Selain itu, pada file fixdecifs.c dan fixencifs.c, kita perlu menambahkan header <stdarg.h>:
#include <stdarg.h>
  • Selanjutnya, kita perlu melakukan instalasi beberapa pustaka yang merupakan dependensi yang dibutuhkan untuk kompilasi. Pada Linux distro Fedora, hal ini cukup menggunakan dnf dengan perintah berikut:
% sudo dnf install lzo-devel ucl-devel lz4-devel
  • Setelah proses instalasi pustaka yang dibutuhkan, kita dapat melakukan kompilasi dengan perintah:
% make
  • Jika proses kompilasi berjalan lancar, maka akan terdapat beberapa file executable diantaranya:
dumpifs
exMifsLz4
exMifsLzo
fixdecifs
fixencifs
uuu
zzz
  • Kita akan menggunakan dumpifs dengan argumen -u untuk melihat isi dari file ifs-cmc.bin dengan perintah seperti ini:
% ./dumpifs -u ifs-cmc.dump ifs-cmc.bin

Image startup_size: 102664 (0x19108)
Image stored_size: 1599280 (0x186730)
Compressed size: 1496612 (0x16d624)
LZO Decompress @0x19110
lzo1x_decompress(buf, 7208338...)
LZO Decompress rd=34864, wr=65536 @ 0x19110
lzo1x_decompress(buf, 7208340...)
LZO Decompress rd=36827, wr=65536 @ 0x21942
lzo1x_decompress(buf, 7209809...)
LZO Decompress rd=38366, wr=65536 @ 0x2a91f
lzo1x_decompress(buf, 7208785...)
LZO Decompress rd=35791, wr=65536 @ 0x33eff
lzo1x_decompress(buf, 7206802...)
LZO Decompress rd=30822, wr=65536 @ 0x3cad0
lzo1x_decompress(buf, 7206362...)
LZO Decompress rd=32332, wr=65536 @ 0x44338
lzo1x_decompress(buf, 7207576...)
LZO Decompress rd=38055, wr=65536 @ 0x4c186
lzo1x_decompress(buf, 7207505...)
LZO Decompress rd=40884, wr=65536 @ 0x5562f
lzo1x_decompress(buf, 7207447...)
LZO Decompress rd=8112, wr=65536 @ 0x5f5e5
lzo1x_decompress(buf, 7206297...)
LZO Decompress rd=11131, wr=65536 @ 0x61597
lzo1x_decompress(buf, 7209174...)
LZO Decompress rd=19309, wr=65536 @ 0x64114
lzo1x_decompress(buf, 7208533...)
LZO Decompress rd=36207, wr=65536 @ 0x68c83
lzo1x_decompress(buf, 7206294...)
LZO Decompress rd=34639, wr=65536 @ 0x719f4
lzo1x_decompress(buf, 7207063...)
LZO Decompress rd=29423, wr=65536 @ 0x7a145
lzo1x_decompress(buf, 7208536...)
LZO Decompress rd=26045, wr=65536 @ 0x81436
lzo1x_decompress(buf, 7207319...)
LZO Decompress rd=11086, wr=65536 @ 0x879f5
lzo1x_decompress(buf, 7208663...)
LZO Decompress rd=17717, wr=65536 @ 0x8a545
lzo1x_decompress(buf, 7209630...)
LZO Decompress rd=17307, wr=65536 @ 0x8ea7c
lzo1x_decompress(buf, 7208283...)
LZO Decompress rd=19125, wr=65536 @ 0x92e19
lzo1x_decompress(buf, 7207250...)
LZO Decompress rd=27684, wr=65536 @ 0x978d0
lzo1x_decompress(buf, 7209304...)
LZO Decompress rd=22522, wr=65536 @ 0x9e4f6
lzo1x_decompress(buf, 7210004...)
LZO Decompress rd=25266, wr=65536 @ 0xa3cf2
lzo1x_decompress(buf, 7208408...)
LZO Decompress rd=31179, wr=65536 @ 0xa9fa6
lzo1x_decompress(buf, 7207957...)
LZO Decompress rd=11850, wr=65536 @ 0xb1973
lzo1x_decompress(buf, 7206929...)
LZO Decompress rd=19394, wr=65536 @ 0xb47bf
lzo1x_decompress(buf, 7206421...)
LZO Decompress rd=24093, wr=65536 @ 0xb9383
lzo1x_decompress(buf, 7209748...)
LZO Decompress rd=27902, wr=65536 @ 0xbf1a2
lzo1x_decompress(buf, 7209364...)
LZO Decompress rd=28258, wr=65536 @ 0xc5ea2
lzo1x_decompress(buf, 7207192...)
LZO Decompress rd=22461, wr=65536 @ 0xccd06
lzo1x_decompress(buf, 7209751...)
LZO Decompress rd=18921, wr=65536 @ 0xd24c5
lzo1x_decompress(buf, 7208530...)
LZO Decompress rd=31519, wr=65536 @ 0xd6eb0
lzo1x_decompress(buf, 7208979...)
LZO Decompress rd=37358, wr=65536 @ 0xde9d1
lzo1x_decompress(buf, 7209939...)
LZO Decompress rd=37800, wr=65536 @ 0xe7bc1
lzo1x_decompress(buf, 7206032...)
LZO Decompress rd=41230, wr=65536 @ 0xf0f6b
lzo1x_decompress(buf, 7208669...)
LZO Decompress rd=35335, wr=65536 @ 0xfb07b
lzo1x_decompress(buf, 7208534...)
LZO Decompress rd=40785, wr=65536 @ 0x103a84
lzo1x_decompress(buf, 7208857...)
LZO Decompress rd=24886, wr=65536 @ 0x10d9d7
lzo1x_decompress(buf, 7207377...)
LZO Decompress rd=19021, wr=65536 @ 0x113b0f
lzo1x_decompress(buf, 7209952...)
LZO Decompress rd=27125, wr=65536 @ 0x11855e
lzo1x_decompress(buf, 7206999...)
LZO Decompress rd=21622, wr=65536 @ 0x11ef55
lzo1x_decompress(buf, 7208991...)
LZO Decompress rd=30664, wr=65536 @ 0x1243cd
lzo1x_decompress(buf, 7207833...)
LZO Decompress rd=19314, wr=65536 @ 0x12bb97
lzo1x_decompress(buf, 7209181...)
LZO Decompress rd=38213, wr=65536 @ 0x13070b
lzo1x_decompress(buf, 7208468...)
LZO Decompress rd=36177, wr=65536 @ 0x139c52
lzo1x_decompress(buf, 7208919...)
LZO Decompress rd=25021, wr=65536 @ 0x1429a5
lzo1x_decompress(buf, 7209366...)
LZO Decompress rd=33248, wr=65536 @ 0x148b64
lzo1x_decompress(buf, 7206296...)
LZO Decompress rd=46031, wr=65536 @ 0x150d46
lzo1x_decompress(buf, 7209689...)
LZO Decompress rd=52539, wr=65536 @ 0x15c117
lzo1x_decompress(buf, 235790973...)
LZO Decompress rd=41399, wr=65536 @ 0x168e54
lzo1x_decompress(buf, 7208543...)
LZO Decompress rd=35319, wr=65536 @ 0x17300d
lzo1x_decompress(buf, 7207704...)
LZO Decompress rd=19632, wr=65536 @ 0x17ba06
lzo1x_decompress(buf, 7209882...)
LZO Decompress rd=18517, wr=65536 @ 0x1806b8
lzo1x_decompress(buf, 7207825...)
LZO Decompress rd=6176, wr=42876 @ 0x184f0f
Decompressed 1496503 bytes-> 3450748 bytes
   Offset     Size  Name
        0        8  *.boot
        8      100  Startup-header flags1=0x9 flags2=0 paddr_bias=0
      108    19008  startup.*
    19110       5c  Image-header mountpoint=/
    1916c      d6c  Image-directory
     ----     ----  Root-dirent
    1a000    8a000  proc/boot/procnto-instr
    a4000     3250  proc/boot/.script
     ----        3  bin/sh -> ksh
     ----        9  dev/console -> /dev/ser3
     ----        a  tmp -> /dev/shmem
     ----       10  usr/var -> /fs/etfs/usr/var
     ----       16  HBpersistence -> /fs/etfs/usr/var/trace
     ----        a  var/run -> /dev/shmem
     ----        a  var/lock -> /dev/shmem
     ----        a  var/log/ppp -> /dev/shmem
     ----       15  opt/sys/bin/pppd -> /fs/mmc0/app/bin/pppd
     ----       15  opt/sys/bin/chat -> /fs/mmc0/app/bin/chat
     ----       18  bin/netstat -> /fs/mmc0/app/bin/netstat
     ----       16  etc/resolv.conf -> /dev/shmem/resolv.conf
     ----       16  etc/ppp/resolv.conf -> /dev/shmem/resolv.conf
     ----       18  etc/tuner -> /fs/mmc0/app/share/tuner
     ----        8  etc/security -> /fs/mmc0
     ----        8  var/override -> /fs/etfs
     ----        c  usr/local -> /fs/mmc0/app
     ----        b  usr/share/eq -> /fs/mmc0/eq
    a8000       20  etc/ECC2_MARKER
    a9000     12af  etc/system/config/fram.conf
    ab000      38c  etc/system/config/nand_partition.txt
    ac000      56b  etc/system/config/gpio.conf
    ad000     247b  bin/cat
    b0000     1fed  bin/io
    b2000     2545  bin/nice
    b5000     216a  bin/echo
    c0000    38e0f  bin/ksh
    f9000     41bb  bin/slogger
    fe000     60a1  bin/waitfor
   105000     531b  bin/pipe
   10b000     5e02  bin/dev-gpio
   120000    1270b  bin/dev-ipc
   140000    1f675  bin/io-usb
   160000     29eb  bin/resource_seed
   163000     3888  bin/spi-master
   167000     48a0  bin/dev-memory
   16c000     9eab  bin/dev-mmap
   176000     602c  bin/i2c-omap35xx
   17d000     da08  bin/devb-mmcsd-omap3730teb
   18b000      dd3  bin/dev-ipc.sh
   18c000     2198  bin/mmc.sh
   18f000     4aac  bin/boot.sh
   1a0000    1208f  bin/devc-seromap
   1b3000     323d  bin/rm
   1b7000     ffa2  bin/devc-pty
   1c7000      4eb  bin/startSplashApp
   1c8000      692  bin/startBackLightApp
   1c9000     1017  bin/mmc_chk
   1cb000     42fe  usr/bin/adjustImageState
   1d0000    13d5a  usr/bin/memifs2
   1e4000      299  usr/bin/loadsecondaryifs.sh
   1f0000    77000  lib/libc.so.3
     ----        9  lib/libc.so -> libc.so.3
   270000     b370  lib/dll/devu-omap3530-mg.so
   27c000     9d17  lib/dll/devu-ehci-omap3.so
   286000     4705  lib/dll/spi-omap3530.so
   290000    14700  lib/dll/fs-qnx6.so
   2a5000     36e6  lib/dll/cam-disk.so
   2b0000    2b7ba  lib/dll/io-blk.so
   2e0000    5594f  lib/dll/charset.so
   340000    1243c  lib/dll/libcam.so.2
     ----        b  lib/dll/libcam.so -> libcam.so.2
   360000     3886  lib/dll/fram-i2c.so
Checksums: image=0xb5207c76 startup=0xb4fe4bd400000000
Image startup_size: 102664 (0x19108)
Image stored_size: 1599280 (0x186730)
Compressed size: 1496612 (0x16d624)
  • Hasil dari perintah di atas berupa arsip ifs-cmc.dump yang isinya dapat kita ekstrak berdasarkan informasi offset dan size dari file yang akan kita ekstrak. Berikut ini adalah contoh perintah untuk mengekstrak beberapa file dari arsip tersebut:
% mkdir foo
% dd if='ifs-cmc.dump' of='foo/boot.sh' skip=$((0x18f000)) count=$((0x4aac)) bs=1
% dd if='ifs-cmc.dump' of='foo/startSplashApp' skip=$((0x1c7000)) count=$((0x4eb)) bs=1
% dd if='ifs-cmc.dump' of='foo/loadsecondaryifs.sh' skip=$((0x1e4000)) count=$((0x299)) bs=1
  • Dan berikut ini adalah hasil dari perintah di atas, misalnya file boot.sh
#!/bin/sh

# ----- Functions ----

loadtertiaryifs()
{
   echo memifs2 with 4-bit ECC including spare area
    # (use this if loading with etfs not already loaded) memifs2 -q -N -e 2 -n /
   memifs2 -p 3 -q -N -e 2 -n /
   if [[ 0 != $? ]] ; then
      echo "**********Failure while loading tertiary IFS**********" > /dev/ser3
      echo "**********Marking current IFS as invalid ***********"
      waitfor /dev/mmap/
      adjustImageState -c 1
      if [[ 0 == $? ]] ; then
         echo "**********Image state set to bad************"
      else
         echo "*******Unable to adjust image state - FRAM not available********"
      fi
      echo "**********Resetting the hardware********************"
      echo -n "\\0021" > /dev/ipc/ch4
   else
      echo "Tertiary IFS loaded successfully"
   fi
}

loadquadifs()
{
   echo memifs2 with 4-bit ECC including spare area
    # (use this if loading with etfs not already loaded) memifs2 -q -N -e 2 -n /
   memifs2 -q -l 40 -p 4 -N -e 2 -n /
   if [[ 0 != $? ]] ; then
      echo "**********Failure while loading quaternary IFS**********" > /dev/ser3
      echo "**********Marking current IFS as invalid ***********"
      waitfor /dev/mmap/
      adjustImageState -c 1
      if [[ 0 == $? ]] ; then
         echo "**********Image state set to bad************"
      else
         echo "*******Unable to adjust image state - FRAM not available********"
      fi
      adjustImageState -c 1
      echo "**********Resetting the hardware********************"
      echo -n "\\0021" > /dev/ipc/ch4
   else
      echo "quad IFS loaded successfully"
   fi
}

# ---- Main ----

export CONSOLE_DEVICE=/dev/ser3

# Redirect all output to /dev/null at startup to clean up the console
# Can turn on after etfs driver starts with /fs/etfs/VERBOSE_STARTUP
reopen /dev/null

echo ========= Start of boot.sh ====================

###   echo starting io-pkt............
qon -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/wicome io-pkt-v4 -ptcpip stacksize=8192

###   echo starting dbus............
qln -sfP /tmp /usr/var/run/dbus
qon -p 12 /usr/bin/dbus-launch --sh-syntax --config-file=/etc/dbus-1/session.conf > /tmp/envars.sh

echo "setting dbus variables for clients"
echo "export SVCIPC_DISPATCH_PRIORITY=12;" >> /tmp/envars.sh
eval `cat /tmp/envars.sh`

# Launch isp-screen AFTER DBUS is fully setup
echo "starting camera service"
qon -p 21 -d isp-screen -s -d /usr/bin/cmc/service/Ispvideo ispVideoService.lua

echo "starting service-monitor"
qon -d /usr/bin/service-monitor > $CONSOLE_DEVICE

# Set the platform variant information. Must come before launching platform services
eval `variant export`

# Extend the LUA path to include platform services and bundles
LUA_PATH="$LUA_PATH;/usr/bin/cmc/service/?.lua;/usr/bin/cmc/service/platform/?.lua"

qon -p 11 lua -s -b -d /usr/bin service.lua
# Run the platform launcher in a "managed" manner by service.lua borrowed from VP3L
qon -p 11 lua -b -d /usr/bin/cmc/service/platform platform_launcher.lua -m -n launch_bundle -p bundle.stage0

#  Start the usb overcurrent monitor utility
qon -d usb_hub_oc -p 10 -i 10 -d 500

#Command to start a kernel trace if desired at startup
#tracelogger -M -S 64M -s 3 -w &

#io -a 0x48320010 > $CONSOLE_DEVICE &
# Things started and used before loading the secondary IFS must be in the boot.ifs
###   echo loading Tertiary IFS............
loadtertiaryifs &

#disable trace-client logging by default
if [ ! -e /fs/mmc1/LOGGING ]; then

qln -sP / /fs/mmc0/app/share/trace
qln -sP /dev/null /hbsystem/multicore/navi/3
qln -sP /dev/null /hbsystem/multicore/navi/4
qln -sP /dev/null /hbsystem/multicore/navi/J
qln -sP /dev/null /hbsystem/multicore/navi/dbglvl
qln -sP /dev/null /hbsystem/multicore/navi/g
qln -sP /dev/null /hbsystem/multicore/navi/multi
qln -sP /dev/null /hbsystem/multicore/navi/r
qln -sP /dev/null /hbsystem/multicore/temic/0
qln -sP /dev/null /hbsystem/multicore/trace/0

else
# if want to write log directly to usb, make sure the mark /fs/mmc1/USB_LOGGING is removed.
   if [ -e /fs/mmc1/USB_LOGGING ]; then
     ###   echo starting trace client............
    qon -d multicored -D2 -F2 -n500 -Q -c file -q -m /hbsystem/multicore -R -f /fs/mmc1/LOGFILE.DAT -s 524288000
     qwaitfor /hbsystem/multicore
    qon -d dev-mv2trace -b 10000 -w 5 -m multicored -f
    qon mount -uw /fs/mmc1
   else
     if [ -e /fs/mmc0/nav/GNLOG_MSD ]; then
        qon -d multicored -D2 -F2 -n500 -Q -c file -q -m /hbsystem/multicore -R -f /fs/usb0/LOGFILE.DAT -s 524288000
     else
        qon -d multicored -D0 -F0 -n500 -Q -c file -q -m /hbsystem/multicore
     fi
    qwaitfor /hbsystem/multicore
    ###   echo starting trace client............
    qon -d dev-mv2trace -b 10000 -w 5 -m multicored
   fi

fi

echo "starting io-audio "
qon -p 211 io-audio -osw_mixer_samples=3072,intr_thread_prio=254 -domap35xx-dsp mcbsp=2,clk_mode=1,tx_voices=4,rx_voices=4,protocol=tdm,xclk_pol=1,sample_size=16 -osw_mixer_samples=768,intr_thread_prio=254 -domap35xx-bt mcbsp=4,clk_mode=1,sample_size=16,tx_voices=1,rx_voices=1,protocol=tdm,bit_delay=1,cap_name=bt_capture,play_name=bt_play -osw_mixer_samples=1536,intr_thread_prio=254 -domap35xx-bt mcbsp=5,clk_mode=1,sample_size=16,tx_voices=2,rx_voices=2,protocol=pcm,bit_delay=1,cap_name=embedded_capture,play_name=embedded_play

###   echo make mmc1 r/w (REMOVE WHEN CONNECTIVITY IS READY)
#PAS mount -uw /fs/mmc1/

# launching persistency manager is dependent on qdb
echo "starting persistency_mgr"
qon persistency_mgr -p -v 2 -c /etc/persistency_mgr/pmem.ini > $CONSOLE_DEVICE 2>&1

###   echo starting pps............
qwaitfor /dev/pmfs
qon pps -p /dev/pmfs

qwaitfor /dev/serv-mon/com.harman.service.PersistentKeyValue

qon set_default_theme

###   echo starting canservice............
qon canservice

# temp link so touch input works
qln -sfP /tmp /dev/devi

qwaitfor /bin/fs-etfs-omap3530_micron
echo "tertiary loaded"  > $CONSOLE_DEVICE &
#io -a 0x48320010 > $CONSOLE_DEVICE &

#starting the random generator now
qon -d random -t -p

###   echo starting ETFS driver............
qon fs-etfs-omap3530_micron -c 1024 -D cfg -m/fs/etfs -f /etc/system/config/nand_partition.txt

qon hmiGateway -sj

# Must start prior to USB enumeration. We must ensure the itun
# setup is not delayed when an iPhone is connected at startup
# with the entune app running. We have 5 seconds to start the
# itun driver and reply to the iPhone. If we miss this window
# the user will have to disconnect/connect the entune app. So
# start this driver early so it has time to initialize.
qon mount -T io-pkt lsm-tun-v4.so

# Ensure qdb directories exists before starting it
if [ ! -d /usr/var/qdb ]; then
qon mkdir -p /usr/var/qdb
fi
echo "starting qdb"
if [ ! -e /fs/etfs/VERBOSE_QDB ]; then
    qon qdb -c /etc/qdb.cfg -s latin2@unicode -o unblock=0,tempstore=/usr/var/qdb -R auto -X /bin/qdb_recover.sh
else
    qon qdb -c /etc/qdb.cfg -s latin2@unicode -vvvvvv -o unblock=0,tempstore=/usr/var/qdb,trace,profile -R auto -X /bin/qdb_recover.sh
fi

# Redirect all output back to the console if developer wants verbose output
if [ -e /fs/etfs/VERBOSE_STARTUP ]; then
   reopen $CONSOLE_DEVICE
fi

echo "starting flexgps & ndr"
qon flexgps_ndr.sh

# start packet filtering early enough to prevent telnet access
# even if user has DHCP server on connected PC
# starts enabled and reads config from default /etc/pf.conf
qon mount -T io-pkt lsm-pf-v4.so

# This script can be used to set configuration settings after an update (if needed)
if [ -x /fs/mmc0/app/bin/runafterupdate.sh ]; then
   echo running runafterupdate.sh............ > $CONSOLE_DEVICE
   qon /fs/mmc0/app/bin/runafterupdate.sh &
fi

qwaitfor /dev/qdb

qon -p 21 -d audioCtrlSvc -c /etc/audioCtrlSvcDEFAULT.conf

#echo "starting adl"
#io -a 0x48320010 > $CONSOLE_DEVICE &

# ARGUMENT TO SET ADL PID
ADL_PID_FILE=/tmp/adlpid

# Set HMI boost time in msec and priority
# Set time to 0 to disable priority boost
echo -n 400 > /tmp/HMI_BOOST_TIME
echo -n 11 > /tmp/HMI_BOOST_PRIORITY

# Running ADL at priority 11 for hmi improvement
qon -d -e MALLOC_ARENA_SIZE=65535 nice -n-1 adl -runtime /lib/air/runtimeSDK /fs/mmc0/app/share/hmi/main.xml &

AD3_PID=$!
echo -n $AD3_PID > $ADL_PID_FILE

#temporarily raising priority of onoff, until natp is fixed
qon -p 11 lua -s -b /usr/bin/onoff/main.lua > $CONSOLE_DEVICE

echo "starting hwctrl"
qon hwctrl

# THIS IS CREATED BY ADL WHEN DISCLAIMER IS SHOWN
#TODO: REMOVE THIS WHEN ANGELO STARTUP CHANGES ARE BROUGHT IN
#waitfor /tmp/adl_startup.txt 10

# Stage1 Lua scripts
echo "bundle::bundle.stage1" >> /pps/launch_bundle

echo "starting AM/FM tuner"
#-DEST uses DEST code
#-VEHLINE uses VC_VEH_LINE
if [ -e /var/override/verboseTunerStart ]; then
   qon lua -s -b /usr/bin/cmc/service/Tuner/main.lua -VEHLINE -DEST -v 0x8000 > $CONSOLE_DEVICE
else
   qon lua -s -b /usr/bin/cmc/service/Tuner/main.lua -VEHLINE -DEST
fi

echo "starting audio manager"
qon -d cmcManager -m autoplay &
qon lua -s -b /usr/bin/cmc/audioMgtWatchdog.lua

if [[ $(cat /tmp/lastAudioMode) = *cd* ]]; then
    echo "last audio mode is CD"  > $CONSOLE_DEVICE &
    #starting RSE as independent entity
    qon lua -s -b /usr/bin/cmc/service/platform/rse/rse.lua
fi

# Launch stage2 Lua scripts (software/hardware key processing)
echo "bundle::bundle.stage2" >> /pps/launch_bundle

echo "starting appManager"
if [ ! -d /fs/etfs/usr/var/appman/xletRMS ]; then
    qon mkdir -p /fs/etfs/usr/var/appman/xletRMS
fi

if [ $VARIANT_MARKET = "NA" ]; then
  appManager -s -j -d -c=/etc/system/config/appManager.cfg --tp=/fs/mmc0/app/share/trace/appManager.hbtc &
else
  appManager -s -j -d -c=/etc/system/config/appManager_nonNA.cfg --tp=/fs/mmc0/app/share/trace/appManager.hbtc &
fi

if [ $VARIANT_SDARS = "YES" ]; then
   echo "starting XM control port"
   ####
   # Note: If the command line for the serial driver is changed, please make the same change in platform_xmApp.lua
   ####
   qon devc-ser8250 -u4 -I32768 -r200 -R50 -D800 -c7372800/16 0x09000000^1,167
   qwaitfor /dev/ser4 4
fi

if [[ $(cat /tmp/lastAudioMode) = *sat* ]]; then
    echo "[BOOT] Last audio mode is XM"  > $CONSOLE_DEVICE &
    if [ $VARIANT_SDARS = "YES" ]; then
        echo "[BOOT] Starting xmApp"
        if [ -e /fs/etfs/SYSTEM_UPDATE_DONE ]; then
            echo "Copying from /fs/mmc0/app/share/sdars/traffic to /fs/etfs/usr/var/sdars/ (no overwrite)"  > $CONSOLE_DEVICE
            qon cp -RX /fs/mmc0/app/share/sdars/traffic /fs/etfs/usr/var/sdars/

            echo "Copying from /fs/mmc0/app/share/sdars/sports to /fs/etfs/usr/var/sdars/ (no overwrite)" >  $CONSOLE_DEVICE
            qon cp -RX /fs/mmc0/app/share/sdars/sports /fs/etfs/usr/var/sdars/

            echo "Copying from /fs/mmc0/app/share/sdars/sportsservice to /fs/etfs/usr/var/sdars/ (no overwrite)" >  $CONSOLE_DEVICE
            qon cp -RX /fs/mmc0/app/share/sdars/sportsservice /fs/etfs/usr/var/sdars/

            echo "Copying from /fs/mmc0/app/share/sdars/channelart to /fs/etfs/usr/var/sdars/ (no overwrite)" >  $CONSOLE_DEVICE
            qon cp -RX /fs/mmc0/app/share/sdars/channelart /fs/etfs/usr/var/sdars/

            qon chmod  -R +rwx /fs/etfs/usr/var/sdars
        fi

        if [ $VARIANT_MODEL = "VP4" ]; then
            (waitfor /tmp/xm_shdn_line_ready.txt; xmApp -c /etc/sdars/XMApp.cfg --tp=/fs/mmc0/app/share/trace/XMApp.hbtc) &
            qon lua -s -b /usr/bin/cmc/xmwatchdog.lua
        else
            (waitfor /tmp/xm_shdn_line_ready.txt; xmApp -c /etc/sdars/XMAppAudioOnly.cfg --tp=/fs/mmc0/app/share/trace/XMApp.hbtc) &
            qon lua -s -b /usr/bin/cmc/xmwatchdog.lua
        fi
        qwaitfor /tmp/xmAppModuleInitializing 10
    fi
fi


# Starting dabLauncher
# DR: Temporary until DAB_PRSNT is added to canservice
if [ -e /var/override/forceDABStart ]; then
   qon lua -s -b /usr/bin/cmc/dabLauncher.lua -v -f
else
   qon lua -s -b /usr/bin/cmc/dabLauncher.lua
fi

loadquadifs &

# THIS IS CREATED BY  LAYER MANAGER WHEN ACCEPT BUTTON IS READY
qwaitfor /tmp/accept.txt 10

# save sequentual dumps to ETFS if requested
##if [ -e /fs/etfs/enableDumper ]; then
#   qon -d dumper -d /fs/etfs -n
##fi

echo copy resolv.conf to /tmp....
qon cp /fs/mmc0/app//share/ppp/resolv.conf /tmp/resolv.conf

# Must start prior to USB enumeration. We must ensure the itun
# setup is not delayed when an iPhone is connected at startup
# with the entune app running.
echo "starting connection manager"
qon connmgr -c "/etc/system/config/connmgr_P_1_2.json"

echo "starting usb detection"
qon enum-devices -c /etc/system/enum/common

# Start media.  Do not background this.
qon media.sh
qwaitfor /dev/serv-mon/com.harman.service.Media

# Slay audioCtrlSvc worker thread to higher priority. This reduces lag during volume adjustments in
# non amplified vehicles, especially under heavy CPU load conditions
slay -T 1 -P 21 audioCtrlSvc

# Launch the bundle that launches vehicle status, and CAN reporting services
echo "bundle::bundle.stage3" >> /pps/launch_bundle

# Explicitly have to start clock separately because as written it
# consumes too much of the platform_launcher's time-slice
qon lua -s -b -d /usr/bin/cmc/service/platform/clock clock.lua

# Start dbus-monitor  only if this flag is set  else its started when
# cisco or dlink adapter is detected

if [[ $(cat /tmp/lastAudioMode) != *sat* ]]; then
    echo "[BOOT] Last audio mode is not XM"  > $CONSOLE_DEVICE &
    if [ $VARIANT_SDARS = "YES" ]; then
        echo "[BOOT] Starting xmApp"
        if [ -e /fs/etfs/SYSTEM_UPDATE_DONE ]; then
            echo "Copying from /fs/mmc0/app/share/sdars/traffic to /fs/etfs/usr/var/sdars/ (no overwrite)"  > $CONSOLE_DEVICE
            qon cp -RX /fs/mmc0/app/share/sdars/traffic /fs/etfs/usr/var/sdars/

            echo "Copying from /fs/mmc0/app/share/sdars/sports to /fs/etfs/usr/var/sdars/ (no overwrite)" >  $CONSOLE_DEVICE
            qon cp -RX /fs/mmc0/app/share/sdars/sports /fs/etfs/usr/var/sdars/

            echo "Copying from /fs/mmc0/app/share/sdars/sportsservice to /fs/etfs/usr/var/sdars/ (no overwrite)" >  $CONSOLE_DEVICE
            qon cp -RX /fs/mmc0/app/share/sdars/sportsservice /fs/etfs/usr/var/sdars/

            echo "Copying from /fs/mmc0/app/share/sdars/channelart to /fs/etfs/usr/var/sdars/ (no overwrite)" >  $CONSOLE_DEVICE
            qon cp -RX /fs/mmc0/app/share/sdars/channelart /fs/etfs/usr/var/sdars/

            qon chmod  -R +rwx /fs/etfs/usr/var/sdars
        fi
        if [ $VARIANT_MODEL = "VP4" ]; then
            (waitfor /tmp/xm_shdn_line_ready.txt; xmApp -c /etc/sdars/XMApp.cfg --tp=/fs/mmc0/app/share/trace/XMApp.hbtc) &
            qon lua -s -b /usr/bin/cmc/xmwatchdog.lua
        else
            (waitfor /tmp/xm_shdn_line_ready.txt; xmApp -c /etc/sdars/XMAppAudioOnly.cfg --tp=/fs/mmc0/app/share/trace/XMApp.hbtc) &
            qon lua -s -b /usr/bin/cmc/xmwatchdog.lua
        fi
    fi
fi

# echo "starting diag service"
qon lua -s -b  /usr/bin/cmc/service/diagserv.lua

echo "starting Vehicle Lua services"

# Launch the bundle that launches personal configuration, swcPal, vehicle settings,
# hvac, climate and psse
echo "bundle::bundle.stage4" >> /pps/launch_bundle

if [[ $(cat /tmp/lastAudioMode) != *cd* ]]; then
    echo "last audio mode is not CD"  > $CONSOLE_DEVICE &
    #starting RSE as independent entity
    qon lua -s -b /usr/bin/cmc/service/platform/rse/rse.lua
fi

echo "Starting Authentication Service"
qon -d authenticationService -k /etc/system/config/authenticationServiceKeyFile.json

# Renice adl to normal priority
# Angelo Giannotti Removed - don't need to do this unless you nice adl when it is launched.
# renice +1 -p `cat  $ADL_PID_FILE`

echo "starting Navigation"
qon nav.sh

qwaitfor /dev/serv-mon/com.harman.service.Navigation 10

echo "starting WavePrompter service"
qon mqueue
qon -d wavePrompter -p12 -c /fs/mmc0/app/share/wavePrompter/wavePrompter.conf

echo "starting Bluetooth"
qon bt_wicome_start.sh

qwaitfor /dev/serv-mon/com.harman.service.BluetoothService 5

echo "starting UISpeechService and natp for speech recognition and tts"
#/bin/sh /fs/mmc0/app/bin/start_natp.sh
qon speech.sh

qwaitfor /tmp/waitfornothing 12

qwaitfor /dev/serv-mon/com.harman.service.UISpeechService 5

echo "starting embeddedPhoneDbusService"
qon -d -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/wicome embeddedPhone -s /usr/bin/cmc/service/embeddedPhoneDbusService.lua

# Start sideStreamer, create system directory files used by mediaService for streaming files
#   these entries must match entries in mcd.conf and mme_data.sql
if [ -e /fs/etfs/VERBOSE_SIDESTREAMER_USB ]; then
    echo starting sideStreamer verbosely with log
    qon -d /usr/bin/sideStreamer -v 7ff -s /etc/system/config/sideStreamer.conf > /fs/usb0/streamer.log
elif [ -e /fs/etfs/VERBOSE_SIDESTREAMER_ETFS ]; then
    echo starting sideStreamer verbosely with log
    if [! -e /fs/etfs/tmp/sideStreamer ]; then
        mkdir /fs/etfs/tmp/sideStreamer
    fi
    qon -d /usr/bin/sideStreamer -v 7ff -s /etc/system/config/sideStreamer.conf > /fs/etfs/tmp/sideStreamer/streamer.log
else
    echo starting sideStreamer
    qon -d /usr/bin/sideStreamer -v 1 -s /etc/system/config/sideStreamer.conf
fi


echo "starting ecallService"
(waitfor /dev/serv-mon/com.harman.service.EmbeddedPhone 30; ecallService)  &


echo "starting connectivity"
qon -d connectivity_startup.sh

echo "starting voltage regulator in normal mode............."
qon isendrecv -a0x48 -n/dev/i2c2 -l2 0x04 0xb7
echo "starting eqService............."
qon lua -s -b  -d /usr/bin/service/eqService/ eqService.lua -i /dev/mcd/SER_ATTACH -e /dev/mcd/SER_DETACH -b /fs/mmc0/eq

# Launch the bundle that launches embedded phone, SDP DataManager, and DTC services
echo "bundle::bundle.stage5" >> /pps/launch_bundle

#lets start the service which are less important after navigation is up
qwaitfor /dev/serv-mon/com.aicas.xlet.manager.AMS 30

# Launch the bundle that launches systemInfo, screen shot, nav trail service,
# and file services
echo "bundle::bundle.stage6" >> /pps/launch_bundle

echo "starting software update service"
(cd /usr/bin/cmc/service/swdlMediaDetect; lua -s -b  ./swdlMediaDetect.lua) &

echo "Starting Anti Read Disturb Service"
qon -d ards_startup.sh

echo "Starting omapTempService ........."
qon omapTempService -d -p 2000

# Start Image Rot Fixer, currently started with high verbosity
# Options -v for Verbosity and -p for priority
qon image_rot_fixer -v 6 -p 9


qon -d lua -s -b /usr/bin/cmc/service/platform/platform_ams_restart.lua > $CONSOLE_DEVICE


if [ ! -e /fs/etfs/BOX_INITIALIZED ]; then
    # script to perform factory initialization (reset requred for changes to be effective)
    qon -p 9 initialize_hu.lua
    qon touch /fs/etfs/BOX_INITIALIZED
fi

# Clear the flag set by software update, used to initialize
# XMAPP datatbase after a system update
qon rm -rf /fs/etfs/SYSTEM_UPDATE_DONE

# Create a flag indicating boot.sh has completed executing
# (Used to prohibit certain actions prematurely; i.e., factory_cleanup.sh)
qon touch /tmp/boot_done
  • file loadsecondaryifs.sh isinya adalah sebagai berikut:
#!/bin/sh
echo memifs2 with 4-bit ECC including spare area
nice -n-201 memifs2 -q -N -e 2 -p 2 -n /
if [[ 0 != $? ]] ; then
   echo "**********Failure in loading secondary IFS**********" > /dev/ser3
   echo "**********Marking current IFS as invalid ***********"
   waitfor /dev/gpio/
   waitfor /dev/mmap/
   adjustImageState -c 1 -v 1
   if [[ 0 == $? ]] ; then
       echo "**********Image state set to bad************"
   else
       echo "*******Unable to adjust image state - FRAM not available********"
   fi
   echo "**********Resetting the hardware********************"
   echo -n "\0021" > /dev/ipc/ch4
else
   echo "Secondary IFS loaded successfully"
fi
  • File startSplashApp adalah script LUA yang isinya adalah sebagai berikut:
#!/usr/bin/lua
-- start splash

local invisible = false

local function getLastAwakeMode()
    local LAST_AWAKE_MODE_POSN = 7
    local lastAwakeMode = 0

    local f = io.open("/dev/mmap/system", "r+")
    if f then
        local r, e = f:seek("set", LAST_AWAKE_MODE_POSN)
        if r and r == LAST_AWAKE_MODE_POSN then
            local x = f:read(1)
            if x then
                lastAwakeMode = string.byte(x)
            end
        end
        f:close()
    end

    return lastAwakeMode
end

function splashAllowed()
    local powerModeStates = {
        [0] = "undefined", -- this value only used where power mode state isn't implemented in the IOC
        [1] = "standby",
        [2] = "timed",
        [3] = "idle",
        [4] = "full_operation"
    }
    local lastAwakeMode = powerModeStates[getLastAwakeMode()]
    if lastAwakeMode == "idle" then
        return false
    end
    return true
end

function startSplash(invisible)
    local invisibleOpt = ""
    if invisible then
        invisibleOpt = " -i "
    end

    -- no timeout - stay around forever
    local cmd = "nice -n-3 splash -c /etc/splash.conf"..invisibleOpt
    os.execute(cmd)
end

if not splashAllowed() then
    invisible = true
end

startSplash(invisible)

Sekian jurnal singkat kali ini, semoga bermanfaat. Terima kasih kepada Allah SWT, dan Anda yang telah membaca jurnal ini.

gan , sekolah IT berapa tahun?

Dia belajar sama dewa komputer

Saya hanya lulusan SMU. No kidding.

Gak percaya deh 🤔, lulusan SMU tapi kaya sudah bertahun-tahun sekolah jurusan programmer atau coder atau apalah itu namanya🤔

Belajar otodidak.