Advertisement
Guest User

Makefile

a guest
Apr 28th, 2011
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 40.13 KB | None | 0 0
  1. # Makefile for webOS Doctor modifications
  2. #
  3. # Copyright (C) 2009,2010 by Rod Whitby <rod@whitby.id.au>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. #
  19.  
  20. ############################
  21. ## START OF DOCUMENTATION ##
  22. ############################
  23.  
  24. # BYPASS_ACTIVATION removes the Palm activation process that normally
  25. # runs on the first boot of the device.  This allows users to use the
  26. # device even if they do not have access to cellular connectivity or
  27. # would prefer not to go through the activation process.  Only use this
  28. # if you are never going to use cellular connectivity on this device.
  29. # Bypassing activation may prevent you from creating a Palm profile.
  30. # This is not a method to use a device on a different cellular carrier.
  31. # Uncomment the corresponding line below to enable this feature.
  32.  
  33. # BYPASS_FIRST_USE_APP allows the device to start without running the
  34. # First Use application.  This allows users to enable wifi service
  35. # first and use that for Palm profile creation and restoring of all
  36. # the profile data.  Note that to create a Palm profile you may still
  37. # need to activate the cellular connection.  This will also make the
  38. # First Use application visible in the launcher.
  39. # This is not a method to use a device on a different cellular carrier.
  40. # Uncomment the corresponding line below to enable this feature.
  41.  
  42. # ENABLE_DEVELOPER_MODE puts the phone in Developer Mode.  This allows
  43. # installation and testing of applications on the device without
  44. # needing to type the developer mode activation code.  There are no
  45. # known security implications of leaving a phone in developer mode.
  46. # Uncomment the corresponding line below to enable this feature.
  47.  
  48. # ENABLE_TESTING_FEEDS installs a flag file which tells Preware to
  49. # automatically install testing feeds for all WebOS Internals
  50. # packages.  You must, of course, install Preware as well to use them.
  51. # Uncomment the corresponding line below to enable this feature.
  52.  
  53. # INSTALL_SSH_AUTH_KEYS imports the SSH authorized_keys file from the
  54. # user's home directory to the device.  The user can then connect to
  55. # the device from their computer as soon as an SSH daemon is
  56. # installed.  You must already have a valid openssh authorized_keys
  57. # file in ~/.ssh/authorized_keys or in ./config/authorized_keys before
  58. # enabling this feature, or it will cause a fatal error.  You then
  59. # need to install the OpenSSH SFTP Server application in Preware to
  60. # actually access the device using the openssh private key that matches
  61. # the openssh public key listed in your authorized_keys file.
  62. # Uncomment the corresponding line below to enable this feature.
  63.  
  64. # INSTALL_WIFI_PROFILES imports a wifi preferences database file from
  65. # the user's home directory to the device.  The device will then be
  66. # set up to use wifi immediately after the webOS Doctor has completed.
  67. # You must already have copied a correctly configured prefsDB.sl file
  68. # from the /var/preferences/com.palm.wifi/ directory on the device to
  69. # ~/.ssh/com.palm.wifi.prefsDB.sl or to ./config/com.palm.wifi.prefsDB.sl
  70. # on your host machine before enabling this feature, or it will cause a
  71. # fatal error.  
  72. # Uncomment the corresponding line below to enable this feature.
  73.  
  74. # AUTO_INSTALL_PREWARE automatically queues the installation of
  75. # Preware as soon as a network connection is available after first
  76. # boot.  This feature also installs the preware.org x509 Certification
  77. # Authority certificate, allowing packages signed by WebOS Internals
  78. # to be installed via the appInstallService installHistory database.
  79. # Uncomment the corresponding line below to enable this feature.
  80.  
  81. # DISABLE_UPLOAD_DAEMON disables a background process that
  82. # automatically uploads usage information to Palm on a daily basis.
  83. # It uploads debug information related to operating system or
  84. # application crashes, users' GPS information, along with data on
  85. # every application used, and for how long it was used.  You may wish
  86. # to disable this on privacy grounds, or if you do not have an
  87. # unlimited data plan and will be paying exorbitant data charges.
  88. # Uncomment the corresponding line below to enable this feature.
  89.  
  90. # DISABLE_UPDATE_DAEMON disables the Palm Over The Air update daemon.
  91. # Uncomment the corresponding line below to enable this feature.
  92.  
  93. # DISABLE_MODEM_UPDATE prevents the device from reflashing the modem
  94. # software.  This saves some time during the webOS Doctor process.
  95. # Uncomment the corresponding line below to enable this feature.
  96.  
  97. # ENABLE_USB_NETWORKING activates USB networking functionality.  The
  98. # device can then be accessed via USB networking (usbnet drivers are
  99. # required on the host).  This is not a tethering mechanism.
  100. # Uncomment the corresponding line below to enable this feature.
  101.  
  102. # REMOVE_CARRIER_CHECK prevents the webOS Doctor from verifying that
  103. # it is installing a software version from the same provider through
  104. # which the device was distributed.  It also removes any and all
  105. # carrier-specific applications and features. The webOS Doctor can
  106. # then be used to update the core software using a release from a
  107. # different provider (excluding any provider-specific functionality).
  108. # This is likely to break access to the App Catalog and Updates apps.
  109. # This is not a method to use a device on a different cellular carrier.
  110. # Uncomment the corresponding line below the enable this feature.
  111.  
  112. # REMOVE_MODEL_CHECK prevents the webOS Doctor from verifying that it
  113. # is installing a software version for the intended device.  The webOS
  114. # Doctor can then be used to update the core software using a release
  115. # from a different device (e.g. EU device vs US device).
  116. # This is not a method to use a device on a different cellular carrier.
  117. # Uncomment the corresponding line below to enable this feature.
  118.  
  119. # CHANGE_KEYBOARD_TYPE permanently changes the keyboard layout using
  120. # the manufacturing software token area.  You only need to do this
  121. # once.  Future uses of the webOS Doctor without this feature enabled
  122. # will not change the setting.  You can use this feature again in the
  123. # future at any time to reverse this change.
  124. # Uncomment the corresponding line below to enable this feature.
  125. # ('z' means QWERTY, 'y' & 'y1' mean QWERTZ, 'w1' means AZERTY).
  126.  
  127. # ADD_EXTRA_CARRIERS adds extra carrier information from the files in
  128. # the ./patches/carriers directory (currently only for WebOS 2.0.0).
  129. # Uncomment the corresponding line below to enable this feature.
  130.  
  131. # INCREASE_VAR_SPACE increases the size of the /var partition to 2 GB.
  132. # This allows more space for the installation of Linux applications
  133. # and the storage of huge amounts of email and attachments on the
  134. # device.  The extra space is taken away from the USB drive.
  135. # Uncomment the corresponding line below to enable this feature.
  136.  
  137. # ADD_EXT3FS_PARTITION adds a spare LVM partition formatted as ext3.
  138. # This allows space for experimentation that requires an additional
  139. # ext3 filesytem.  The extra space is taken away from the USB drive.
  140. # Uncomment the corresponding line below to enable this feature.
  141.  
  142. ##########################
  143. ## END OF DOCUMENTATION ##
  144. ##########################
  145.  
  146. ########################################
  147. ## START OF AREA FOR END USER CHANGES ##
  148. ########################################
  149.  
  150. # Uncomment the features that you wish to enable below:
  151. # BYPASS_ACTIVATION     = 1
  152.  BYPASS_FIRST_USE_APP  = 1
  153.  ENABLE_DEVELOPER_MODE = 1
  154.  AUTO_INSTALL_PREWARE  = 1
  155.  ENABLE_TESTING_FEEDS  = 1
  156. # INSTALL_SSH_AUTH_KEYS = 1
  157. # INSTALL_WIFI_PROFILES = 1
  158.  DISABLE_UPLOAD_DAEMON = 1
  159. # DISABLE_UPDATE_DAEMON = 1
  160. # DISABLE_MODEM_UPDATE  = 1
  161.  ENABLE_USB_NETWORKING = 1
  162. # REMOVE_MODEL_CHECK    = 1
  163. # REMOVE_CARRIER_CHECK  = 1
  164. # CHANGE_KEYBOARD_TYPE  = z
  165. # ADD_EXTRA_CARRIERS    = 1
  166. # INCREASE_VAR_SPACE    = 1
  167. # ADD_EXT3FS_PARTITION  = 2GB
  168.  
  169. # Select "pre", "preplus", "pixi", "pixiplus" or "pre2".
  170. DEVICE = "pre"
  171.  
  172. # Select "wr", "sprint", "verizonwireless", "bellmo", "telcel" or "att".
  173. CARRIER = "wr"
  174.  
  175. # Supply a different boot logo if you wish.
  176. CUSTOM_BOOTLOGO = scripts/ratm.tga
  177.  
  178. ######################################
  179. ## END OF AREA FOR END USER CHANGES ##
  180. ######################################
  181.  
  182. ######################################
  183. ## START OF AREA FOR ROD'S USE ONLY ##
  184. ######################################
  185.  
  186. ifeq (${LOGNAME},rwhitby)
  187. DEVICE = pre2
  188. CARRIER = wr
  189. ifeq (${CARRIER},sprint)
  190. BYPASS_ACTIVATION     = 1
  191. BYPASS_FIRST_USE_APP  = 1
  192. endif
  193. ifeq (${CUSTOM_CARRIER_LIST},Sprint)
  194. BYPASS_ACTIVATION     = 1
  195. BYPASS_FIRST_USE_APP  = 1
  196. endif
  197. ENABLE_DEVELOPER_MODE = 1
  198. AUTO_INSTALL_PREWARE  = 1
  199. ENABLE_TESTING_FEEDS  = 1
  200. INSTALL_SSH_AUTH_KEYS = 1
  201. INSTALL_WIFI_PROFILES = 1
  202. DISABLE_UPLOAD_DAEMON = 1
  203. # DISABLE_UPDATE_DAEMON = 1
  204. # DISABLE_MODEM_UPDATE  = 1
  205. # REMOVE_MODEL_CHECK    = 1
  206. # REMOVE_CARRIER_CHECK  = 1
  207. # REMOVE_BUILD_CHECK    = 1
  208. # REMOVE_RELEASE_CHECK  = 1
  209.  
  210. # CUSTOM_WEBOS_TARBALL = webOS.tar
  211. # CUSTOM_CARRIER_TARBALL = wr.tar
  212. # CUSTOM_XML = castle.xml
  213. # CUSTOM_BUILD_INFO = palm-build-info
  214. # CUSTOM_WEBOS_DMSET = base
  215. # CUSTOM_CARRIER_DMSET = a
  216. # CUSTOM_MODEL_LIST = P100EWW
  217. # CUSTOM_CARRIER_LIST = Sprint
  218. # CUSTOM_BOOTLOGO = scripts/WebOS-Internals.tga
  219.  
  220. # CUSTOM_DEVICETYPE = castle
  221. # CUSTOM_BOOTLOADER = boot.bin
  222. # CUSTOM_INSTALLER = nova-installer-image-castle.uImage
  223. # CUSTOM_KERNEL_DIR = rootfs
  224. # CUSTOM_ROOTFS = nova-cust-image-castle.rootfs.tar.gz
  225. # CUSTOM_BUILD_CHECK   =
  226. # CUSTOM_RELEASE_CHECK =
  227. # CUSTOM_CARRIER_CHECK =
  228. # CUSTOM_MODEL_CHECK   =
  229. # CUSTOM_UPDATE_SITE   =
  230. endif
  231.  
  232. ####################################
  233. ## END OF AREA FOR ROD'S USE ONLY ##
  234. ####################################
  235.  
  236. ##############################################################################
  237. ## DO NOT MODIFY ANYTHING PAST THIS POINT, UNLESS YOU ARE A MAKEFILE EXPERT ##
  238. ##############################################################################
  239.  
  240. CARRIER_TARBALL = ${CARRIER}.tar
  241.  
  242. # Latest supported version is:
  243. # VERSION = 2.1.0
  244.  
  245. ifeq (${DEVICE},pre)
  246. CODENAME = castle
  247. ifeq (${CARRIER},wr)
  248. MODEL = p100ueu
  249. VERSION = 1.4.5
  250. ifeq (${VERSION},1.1.3)
  251. MODEL = p100eww
  252. endif
  253. endif
  254. ifeq (${CARRIER},sprint)
  255. MODEL = p100eww
  256. VERSION = 1.4.5
  257. endif
  258. ifeq (${CARRIER},bellmo)
  259. MODEL = p100eww
  260. VERSION = 1.4.5
  261. endif
  262. ifeq (${CARRIER},telcel)
  263. MODEL = p100eww
  264. VERSION = 1.4.0
  265. CARRIER_TARBALL = wr.tar
  266. endif
  267. endif
  268.  
  269. ifeq (${DEVICE},preplus)
  270. CODENAME = castle
  271. ifeq (${CARRIER},wr)
  272. MODEL = p101ueu
  273. VERSION = 2.1.0
  274. CARRIER_TARBALL = wr-castle-plus.tar
  275. endif
  276. ifeq (${CARRIER},verizonwireless)
  277. MODEL = p101eww
  278. VERSION = 1.4.5
  279. CARRIER_TARBALL = verizon.tar
  280. endif
  281. ifeq (${CARRIER},att)
  282. MODEL = p101eww
  283. VERSION = 1.4.5
  284. endif
  285. endif
  286.  
  287. ifeq (${DEVICE},pixi)
  288. CODENAME = pixie
  289. ifeq (${CARRIER},sprint)
  290. MODEL = p200eww
  291. VERSION = 1.4.5
  292. ifeq (${VERSION},1.3.5.1)
  293. MODEL = p120eww
  294. endif
  295. endif
  296. endif
  297.  
  298. ifeq (${DEVICE},pixiplus)
  299. CODENAME = pixie
  300. ifeq (${CARRIER},wr)
  301. MODEL = p121ewweu
  302. VERSION = 1.4.5
  303. endif
  304. ifeq (${CARRIER},verizonwireless)
  305. MODEL = p121eww
  306. VERSION = 1.4.5
  307. CARRIER_TARBALL = verizon.tar
  308. endif
  309. ifeq (${CARRIER},att)
  310. MODEL = p121eww
  311. VERSION = 1.4.5
  312. endif
  313. endif
  314.  
  315. ifeq (${DEVICE},pre2)
  316. CODENAME = roadrunner
  317. ifeq (${CARRIER},wr)
  318. MODEL = p103ueuna
  319. VERSION = 2.1.0
  320. ifeq (${VERSION},2.0.1)
  321. MODEL = p102ueuna
  322. endif
  323. ifeq (${VERSION},2.0.0)
  324. MODEL = p103ueu
  325. endif
  326. endif
  327. ifeq (${CARRIER},verizonwireless)
  328. MODEL = p102eww
  329. VERSION = 2.0.1
  330. CARRIER_TARBALL = verizon.tar
  331. DOCTOR = webosdoctorp102${CARRIER}-${VERSION}.jar
  332. endif
  333. endif
  334.  
  335. ifndef DOCTOR
  336. DOCTOR = webosdoctor${MODEL}${CARRIER}-${VERSION}.jar
  337. ifeq (${CARRIER},wr)
  338. DOCTOR = webosdoctor${MODEL}-${CARRIER}-${VERSION}.jar
  339. endif
  340. endif
  341.  
  342. PATIENT = ${DEVICE}-${MODEL}-${CARRIER}-${VERSION}
  343.  
  344. APPLICATIONS = com.palm.app.firstuse
  345.  
  346. ifdef CUSTOM_DEVICETYPE
  347. ifeq (${VERSION},2.0.0)
  348. PATCH_DOCTOR          = 1
  349. endif
  350. ifeq (${VERSION},2.0.1)
  351. PATCH_DOCTOR          = 1
  352. endif
  353. DISABLE_UPLOAD_DAEMON = 1
  354. DISABLE_MODEM_UPDATE  = 1
  355. REMOVE_CARRIER_CHECK  = 1
  356. REMOVE_MODEL_CHECK    = 1
  357. endif
  358.  
  359. ifeq (${PATCH_DOCTOR},1)
  360. CLASSES = com/palm/nova/installer/recoverytool/MainFlasher
  361. DOCTOR_PATCHES = flasher-disable-everything.patch
  362. endif
  363.  
  364. OLDDIRS = ./usr/palm/applications/com.palm.app.firstuse ./usr/lib/ipkg/info ./etc/ssl ./usr/bin ./boot ./lib/modules
  365. OLDFILES = ./etc/palm-build-info
  366. NEWDIRS = ${OLDDIRS} ./var/luna/preferences ./var/gadget ./var/home/root ./var/preferences ./var/palm/data
  367. NEWFILES = ${OLDFILES}
  368.  
  369. ifeq (${ADD_EXTRA_CARRIERS},1)
  370.     OLDDIRS += ./etc/carrierdb
  371. endif
  372.  
  373. ifeq (CYGWIN,$(findstring CYGWIN,$(shell uname -s)))
  374. ERR = $(error Using Cygwin on Windows is not a valid MetaDoctor option.  See the Wiki page and use WUBI instead.)
  375. endif
  376.  
  377. ifeq ($(shell uname -s),Darwin)
  378. TAR = gnutar
  379. export COPYFILE_DISABLE=true
  380. export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
  381. ifeq (${PATCH_DOCTOR},1)
  382. JAD = build/tools/jad-macosx/jad
  383. endif
  384. else
  385. TAR = tar
  386. ifeq (${PATCH_DOCTOR},1)
  387. JAD = build/tools/jad-linux/jad
  388. endif
  389. endif
  390. JODE= downloads/jode-1.1.2-pre1.jar
  391.  
  392. .PHONY: settings
  393. settings:
  394.     @echo "DEVICE = ${DEVICE}"
  395.     @echo "CARRIER = ${CARRIER}"
  396.     @echo "VERSION = ${VERSION}"
  397. ifdef BYPASS_ACTIVATION
  398.     @echo "BYPASS_ACTIVATION = ${BYPASS_ACTIVATION}"
  399. endif
  400. ifdef BYPASS_FIRST_USE_APP
  401.     @echo "BYPASS_FIRST_USE_APP = ${BYPASS_FIRST_USE_APP}"
  402. endif
  403. ifdef ENABLE_DEVELOPER_MODE
  404.     @echo "ENABLE_DEVELOPER_MODE = ${ENABLE_DEVELOPER_MODE}"
  405. endif
  406. ifdef AUTO_INSTALL_PREWARE
  407.     @echo "AUTO_INSTALL_PREWARE = ${AUTO_INSTALL_PREWARE}"
  408. endif
  409. ifdef ENABLE_TESTING_FEEDS
  410.     @echo "ENABLE_TESTING_FEEDS = ${ENABLE_TESTING_FEEDS}"
  411. endif
  412. ifdef INSTALL_SSH_AUTH_KEYS
  413.     @echo "INSTALL_SSH_AUTH_KEYS = ${INSTALL_SSH_AUTH_KEYS}"
  414. endif
  415. ifdef INSTALL_WIFI_PROFILES
  416.     @echo "INSTALL_WIFI_PROFILES = ${INSTALL_WIFI_PROFILES}"
  417. endif
  418. ifdef DISABLE_UPLOAD_DAEMON
  419.     @echo "DISABLE_UPLOAD_DAEMON = ${DISABLE_UPLOAD_DAEMON}"
  420. endif
  421. ifdef DISABLE_UPDATE_DAEMON
  422.     @echo "DISABLE_UPDATE_DAEMON = ${DISABLE_UPDATE_DAEMON}"
  423. endif
  424. ifdef DISABLE_MODEM_UPDATE
  425.     @echo "DISABLE_MODEM_UPDATE = ${DISABLE_MODEM_UPDATE}"
  426. endif
  427. ifdef ENABLE_USB_NETWORKING
  428.     @echo "ENABLE_USB_NETWORKING = ${ENABLE_USB_NETWORKING}"
  429. endif
  430. ifdef REMOVE_MODEL_CHECK  
  431.     @echo "REMOVE_MODEL_CHECK = ${REMOVE_MODEL_CHECK}"
  432. endif
  433. ifdef REMOVE_CARRIER_CHECK
  434.     @echo "REMOVE_CARRIER_CHECK = ${REMOVE_CARRIER_CHECK}"
  435. endif
  436. ifdef REMOVE_BUILD_CHECK  
  437.     @echo "REMOVE_BUILD_CHECK = ${REMOVE_BUILD_CHECK}"
  438. endif
  439. ifdef REMOVE_RELEASE_CHECK
  440.     @echo "REMOVE_RELEASE_CHECK = ${REMOVE_RELEASE_CHECK}"
  441. endif
  442. ifdef CHANGE_KEYBOARD_TYPE
  443.     @echo "CHANGE_KEYBOARD_TYPE = ${CHANGE_KEYBOARD_TYPE}"
  444. endif
  445. ifdef ADD_EXTRA_CARRIERS  
  446.     @echo "ADD_EXTRA_CARRIERS = ${ADD_EXTRA_CARRIERS}"
  447. endif
  448. ifdef INCREASE_VAR_SPACE  
  449.     @echo "INCREASE_VAR_SPACE = ${INCREASE_VAR_SPACE}"
  450. endif
  451. ifdef ADD_EXT3FS_PARTITION
  452.     @echo "ADD_EXT3FS_PARTITION = ${ADD_EXT3FS_PARTITION}"
  453. endif
  454. ifdef CUSTOM_WEBOS_TARBALL
  455.     @echo "CUSTOM_WEBOS_TARBALL = ${CUSTOM_WEBOS_TARBALL}"
  456. endif
  457. ifdef CUSTOM_CARRIER_TARBALL
  458.     @echo "CUSTOM_CARRIER_TARBALL = ${CUSTOM_CARRIER_TARBALL}"
  459. endif
  460. ifdef CUSTOM_XML
  461.     @echo "CUSTOM_XML = ${CUSTOM_XML}"
  462. endif
  463. ifdef CUSTOM_BUILD_INFO
  464.     @echo "CUSTOM_BUILD_INFO = ${CUSTOM_BUILD_INFO}"
  465. endif
  466. ifdef CUSTOM_WEBOS_DMSET
  467.     @echo "CUSTOM_WEBOS_DMSET = ${CUSTOM_WEBOS_DMSET}"
  468. endif
  469. ifdef CUSTOM_CARRIER_DMSET
  470.     @echo "CUSTOM_CARRIER_DMSET = ${CUSTOM_CARRIER_DMSET}"
  471. endif
  472. ifdef CUSTOM_MODEL_LIST  
  473.     @echo "CUSTOM_MODEL_LIST = ${CUSTOM_MODEL_LIST}"
  474. endif
  475. ifdef CUSTOM_CARRIER_LIST
  476.     @echo "CUSTOM_CARRIER_LIST = ${CUSTOM_CARRIER_LIST}"
  477. endif
  478. ifdef CUSTOM_BOOTLOGO
  479.     @echo "CUSTOM_BOOTLOGO = ${CUSTOM_BOOTLOGO}"
  480. endif
  481. ifdef CUSTOM_DEVICETYPE
  482.     @echo "CUSTOM_DEVICETYPE = ${CUSTOM_DEVICETYPE}"
  483. endif
  484. ifdef CUSTOM_BOOTLOADER
  485.     @echo "CUSTOM_BOOTLOADER = ${CUSTOM_BOOTLOADER}"
  486. endif
  487. ifdef CUSTOM_INSTALLER
  488.     @echo "CUSTOM_INSTALLER = ${CUSTOM_INSTALLER}"
  489. endif
  490. ifdef CUSTOM_KERNEL_DIR
  491.     @echo "CUSTOM_KERNEL_DIR = ${CUSTOM_KERNEL_DIR}"
  492. endif
  493. ifdef CUSTOM_ROOTFS
  494.     @echo "CUSTOM_ROOTFS = ${CUSTOM_ROOTFS}"
  495. endif
  496. ifdef CUSTOM_BUILD_CHECK  
  497.     @echo "CUSTOM_BUILD_CHECK = ${CUSTOM_BUILD_CHECK}"
  498. endif
  499. ifdef CUSTOM_RELEASE_CHECK
  500.     @echo "CUSTOM_RELEASE_CHECK = ${CUSTOM_RELEASE_CHECK}"
  501. endif
  502. ifdef CUSTOM_CARRIER_CHECK
  503.     @echo "CUSTOM_CARRIER_CHECK = ${CUSTOM_CARRIER_CHECK}"
  504. endif
  505. ifdef CUSTOM_MODEL_CHECK  
  506.     @echo "CUSTOM_MODEL_CHECK = ${CUSTOM_MODEL_CHECK}"
  507. endif
  508. ifdef CUSTOM_UPDATE_SITE  
  509.     @echo "CUSTOM_UPDATE_SITE = ${CUSTOM_UPDATE_SITE}"
  510. endif
  511.  
  512. .PHONY: all
  513. all:
  514.     ${ERR}
  515. ifneq (${DEVICE},undefined)
  516. ifneq (${CARRIER},undefined)
  517.     @if [ "${MODEL}" == "" ] || [ "${VERSION}" == "" ] ; then \
  518.       echo You have specified an invalid DEVICE and CARRIER combination ; false ; \
  519.     fi
  520.     ${MAKE} unpack patch pack
  521. else
  522.     @echo You must set the DEVICE and CARRIER variables ; false
  523. endif
  524. else
  525. ifneq (${CARRIER},undefined)
  526.     @echo You must set the DEVICE and CARRIER variables ; false
  527. else
  528.     ${MAKE} DEVICE=pre all-wr all-sprint all-bellmo all-telcel
  529.     ${MAKE} DEVICE=preplus all-wr all-verizonwireless all-att
  530.     ${MAKE} DEVICE=pixi all-sprint
  531.     ${MAKE} DEVICE=pixiplus all-wr all-verizonwireless all-att
  532. endif
  533. endif
  534.  
  535. .PHONY: all-%
  536. all-%:
  537.     ${ERR}
  538.     ${MAKE} CARRIER=$* unpack patch pack
  539.  
  540. .PHONY: unpack-%
  541. unpack-%:
  542.     ${MAKE} CARRIER=$* unpack
  543.  
  544. .PHONY: unpack
  545. unpack: build/${PATIENT}/.unpacked
  546.  
  547. build/${PATIENT}/.unpacked: downloads/${DOCTOR}
  548.     rm -rf build/${PATIENT}
  549.     mkdir -p build/${PATIENT}
  550.     cp $< build/${PATIENT}/${DOCTOR}
  551.     ( cd build/${PATIENT} ; \
  552.         unzip -q ${DOCTOR} META-INF/MANIFEST.MF com/* \
  553.             resources/webOS.tar resources/recoverytool.config )
  554. ifndef REMOVE_CARRIER_CHECK
  555.     ( cd build/${PATIENT} ; \
  556.         unzip -q ${DOCTOR} resources/${CARRIER_TARBALL} )
  557. endif
  558. ifdef CUSTOM_WEBOS_TARBALL
  559.     cp ${CUSTOM_WEBOS_TARBALL} build/${PATIENT}/resources/webOS.tar
  560. endif
  561. ifndef REMOVE_CARRIER_CHECK
  562. ifdef CUSTOM_CARRIER_TARBALL
  563.     cp ${CUSTOM_CARRIER_TARBALL} build/${PATIENT}/resources/${CARRIER_TARBALL}
  564. endif
  565. endif
  566.     mkdir -p build/${PATIENT}/webOS
  567.     ${TAR} -C build/${PATIENT}/webOS \
  568.         -f build/${PATIENT}/resources/webOS.tar -x
  569. ifdef CUSTOM_DEVICETYPE
  570.     mv build/${PATIENT}/webOS/${CUSTIMAGEOLD}.rootfs.tar.gz build/${PATIENT}/webOS/${CUSTIMAGENEW}.rootfs.tar.gz
  571.     mv build/${PATIENT}/webOS/${INSTIMAGEOLD}.uImage build/${PATIENT}/webOS/${INSTIMAGENEW}.uImage
  572.     mv build/${PATIENT}/webOS/${BOOTLOADEROLD}.bin build/${PATIENT}/webOS/${BOOTLOADERNEW}.bin
  573.     mv build/${PATIENT}/webOS/${CODENAMEOLD}.xml build/${PATIENT}/webOS/${CODENAMENEW}.xml
  574. endif
  575. ifdef CUSTOM_INSTALLER
  576.     cp ${CUSTOM_INSTALLER} build/${PATIENT}/webOS/${INSTIMAGENEW}.uImage
  577. endif
  578. ifdef CUSTOM_BOOTLOADER
  579.     cp ${CUSTOM_BOOTLOADER} build/${PATIENT}/webOS/${BOOTLOADERNEW}.bin
  580. endif
  581. ifdef CUSTOM_ROOTFS
  582.     cp ${CUSTOM_ROOTFS} build/${PATIENT}/webOS/${CUSTIMAGENEW}.rootfs.tar.gz
  583. endif
  584. ifdef CUSTOM_XML
  585.     cp ${CUSTOM_XML} build/${PATIENT}/webOS/${CODENAMENEW}.xml
  586. endif
  587. ifdef CUSTOM_BOOTLOGO
  588.     cp ${CUSTOM_BOOTLOGO} build/${PATIENT}/webOS/BootLogo.tga
  589. endif
  590. ifndef REMOVE_CARRIER_CHECK
  591.     mkdir -p build/${PATIENT}/carrier
  592.     ${TAR} -f build/${PATIENT}/resources/${CARRIER_TARBALL} -t \
  593.         > build/${PATIENT}/carrier/carrier-file-list.txt
  594.     ${TAR} -C build/${PATIENT}/carrier \
  595.         -f build/${PATIENT}/resources/${CARRIER_TARBALL} -x
  596. endif
  597.     gunzip -f build/${PATIENT}/webOS/${CUSTIMAGENEW}.rootfs.tar.gz
  598.     mkdir -p build/${PATIENT}/rootfs
  599.     ${TAR} -C build/${PATIENT}/rootfs --wildcards \
  600.         -f build/${PATIENT}/webOS/${CUSTIMAGENEW}.rootfs.tar \
  601.         -x ${OLDDIRS} ${OLDFILES} ./md5sums*
  602. ifdef CUSTOM_KERNEL_DIR
  603.     ( cd ${CUSTOM_KERNEL_DIR}/boot ; tar cf - . ) | ( cd build/${PATIENT}/rootfs/boot ; tar xf - )
  604.     ( cd ${CUSTOM_KERNEL_DIR}/lib/modules ; tar cf - . ) | ( cd build/${PATIENT}/rootfs/lib/modules ; tar xf - )
  605. endif
  606. ifdef CUSTOM_BOOTLOADER
  607.     cp ${CUSTOM_BOOTLOADER} build/${PATIENT}/rootfs/boot/boot.bin
  608. endif
  609. ifdef CUSTOM_BUILD_INFO
  610.     cp ${CUSTOM_BUILD_INFO} build/${PATIENT}/rootfs/etc/palm-build-info
  611. endif
  612.     touch $@
  613.  
  614. .PHONY: patch-%
  615. patch-%:
  616.     ${ERR}
  617.     ${MAKE} CARRIER=$* patch
  618.  
  619. .PHONY: patch
  620. patch: build/${PATIENT}/.patched
  621.  
  622. build/${PATIENT}/.patched: ${JAD}
  623.     ${ERR}
  624.     rm -f $@
  625.     [ -d patches/webos-${VERSION} ]
  626.     @for app in ${APPLICATIONS} ; do \
  627.       mv build/${PATIENT}/rootfs/usr/lib/ipkg/info/$$app.md5sums build/${PATIENT}/rootfs/usr/lib/ipkg/info/$$app.md5sums.old ; \
  628.     done
  629.     if [ -f build/${PATIENT}/rootfs/md5sums.gz ] ; then \
  630.       gunzip -c < build/${PATIENT}/rootfs/md5sums.gz > build/${PATIENT}/rootfs/md5sums ; \
  631.     fi
  632.     mv build/${PATIENT}/rootfs/md5sums build/${PATIENT}/rootfs/md5sums.old
  633. ifeq (${BYPASS_ACTIVATION},1)
  634.     ( cd patches/webos-${VERSION} ; cat bypass-activation.patch ) | \
  635.     ( cd build/${PATIENT}/rootfs ; patch -p1 --no-backup-if-mismatch )
  636. endif
  637. ifeq (${BYPASS_FIRST_USE_APP},1)
  638.     mkdir -p build/${PATIENT}/rootfs/var/luna/preferences
  639.     touch build/${PATIENT}/rootfs/var/luna/preferences/ran-first-use
  640.     touch build/${PATIENT}/rootfs/var/luna/preferences/first-use-profile-created
  641.     sed -i.orig -e 's/"visible": "false"/"visible": "true"/' \
  642.         build/${PATIENT}/rootfs/usr/palm/applications/com.palm.app.firstuse/appinfo.json
  643.     rm -f build/${PATIENT}/rootfs/usr/palm/applications/com.palm.app.firstuse/appinfo.json.orig
  644.     for f in build/${PATIENT}/rootfs/usr/palm/applications/com.palm.app.firstuse/resources/*/appinfo.json ; do \
  645.       if [ -f $$f ] ; then \
  646.         sed -i.orig -e 's/"visible": "false"/"visible": "true"/' $$f ; rm -f $$f.orig ; \
  647.       fi ; \
  648.     done
  649. endif
  650. ifeq (${ENABLE_DEVELOPER_MODE},1)
  651.     mkdir -p build/${PATIENT}/rootfs/var/gadget
  652.     touch build/${PATIENT}/rootfs/var/gadget/novacom_enabled
  653. endif
  654. ifeq (${ENABLE_TESTING_FEEDS},1)
  655.     mkdir -p build/${PATIENT}/rootfs/var/preferences/org.webosinternals.preware
  656.     touch build/${PATIENT}/rootfs/var/preferences/org.webosinternals.preware/enable-testing-feeds
  657. endif
  658. ifeq (${ENABLE_USB_NETWORKING},1)
  659.     mkdir -p build/${PATIENT}/rootfs/var/gadget
  660.     touch build/${PATIENT}/rootfs/var/gadget/usbnet_enabled
  661. endif
  662. ifeq (${DISABLE_UPDATE_DAEMON},1)
  663.     chmod -x build/${PATIENT}/rootfs/usr/bin/UpdateDaemon
  664. endif
  665. ifeq (${DISABLE_UPLOAD_DAEMON},1)
  666.     chmod -x build/${PATIENT}/rootfs/usr/bin/uploadd
  667.     chmod -x build/${PATIENT}/rootfs/usr/bin/contextupload
  668.     chmod -x build/${PATIENT}/rootfs/usr/bin/rdxd
  669. endif
  670. ifeq (${INSTALL_SSH_AUTH_KEYS},1)
  671.     mkdir -p build/${PATIENT}/rootfs/var/home/root/.ssh
  672.     chmod 700 build/${PATIENT}/rootfs/var/home/root/.ssh build/${PATIENT}/rootfs/var/home/root
  673.     @if [ -f ./config/authorized_keys ]; then \
  674.         cp ./config/authorized_keys build/${PATIENT}/rootfs/var/home/root/.ssh/authorized_keys ; \
  675.         chmod 644 build/${PATIENT}/rootfs/var/home/root/.ssh/authorized_keys ; \
  676.     elif [ -f ${HOME}/.ssh/authorized_keys ]; then \
  677.         cp ${HOME}/.ssh/authorized_keys build/${PATIENT}/rootfs/var/home/root/.ssh/authorized_keys ; \
  678.         chmod 644 build/${PATIENT}/rootfs/var/home/root/.ssh/authorized_keys ; \
  679.     else \
  680.         echo "No authorized_keys file found in ./config or ${HOME}/.ssh" ; \
  681.     fi
  682. endif
  683. ifeq (${INSTALL_WIFI_PROFILES},1)
  684.     mkdir -p build/${PATIENT}/rootfs/var/preferences/com.palm.wifi
  685.     @if [ -f ./config/com.palm.wifi.prefsDB.sl ]; then \
  686.         cp ./config/com.palm.wifi.prefsDB.sl build/${PATIENT}/rootfs/var/preferences/com.palm.wifi/prefsDB.sl ; \
  687.     elif [ -f ${HOME}/.ssh/com.palm.wifi.prefsDB.sl ]; then \
  688.         cp ${HOME}/.ssh/com.palm.wifi.prefsDB.sl build/${PATIENT}/rootfs/var/preferences/com.palm.wifi/prefsDB.sl ; \
  689.     else \
  690.         echo "No com.palm.wifi.prefsDB.sl file found in ./config or ${HOME}/.ssh" ; \
  691.     fi
  692. endif
  693. ifeq (${ADD_EXTRA_CARRIERS},1)
  694.     for f in patches/carriers/*.json ; do \
  695.         if [ -f $$f ]; then \
  696.             cat $$f >>build/${PATIENT}/rootfs/etc/carrierdb/carrierdb.json ; \
  697.         fi ; \
  698.     done ; \
  699.     mv build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcarrierdb.md5sums \
  700.         build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcarrierdb.md5sums.old ; \
  701.     ( cd build/${PATIENT}/rootfs ; md5sum ./etc/carrierdb/carrierdb.json ) > \
  702.       build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcarrierdb.md5sums.new ; \
  703.     python ./scripts/replace-md5sums.py \
  704.       build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcarrierdb.md5sums.old \
  705.       build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcarrierdb.md5sums.new \
  706.           > build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcarrierdb.md5sums
  707.     rm -f build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcarrierdb.md5sums.old \
  708.           build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcarrierdb.md5sums.new
  709. endif
  710. ifeq (${AUTO_INSTALL_PREWARE},1)
  711.     mv build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcertstore.md5sums \
  712.        build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcertstore.md5sums.old
  713.     cat scripts/preware-ca-bundle.crt >> build/${PATIENT}/rootfs/etc/ssl/certs/appsigning-bundle.crt
  714.     ( cd build/${PATIENT}/rootfs ; md5sum ./etc/ssl/certs/appsigning-bundle.crt ) > \
  715.       build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcertstore.md5sums.new
  716.     python ./scripts/replace-md5sums.py \
  717.       build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcertstore.md5sums.old \
  718.       build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcertstore.md5sums.new \
  719.           > build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcertstore.md5sums
  720.     rm -f build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcertstore.md5sums.old \
  721.           build/${PATIENT}/rootfs/usr/lib/ipkg/info/pmcertstore.md5sums.new
  722.     mkdir -p build/${PATIENT}/rootfs/var/palm/data/com.palm.appInstallService/
  723.     cp scripts/preware-install.db \
  724.       build/${PATIENT}/rootfs/var/palm/data/com.palm.appInstallService/installHistory.db
  725. endif
  726. ifdef CUSTOM_BUILD_INFO
  727.     mv build/${PATIENT}/rootfs/usr/lib/ipkg/info/palmbuildinfo.md5sums \
  728.         build/${PATIENT}/rootfs/usr/lib/ipkg/info/palmbuildinfo.md5sums.old ; \
  729.     ( cd build/${PATIENT}/rootfs ; md5sum ./etc/palm-build-info ) > \
  730.       build/${PATIENT}/rootfs/usr/lib/ipkg/info/palmbuildinfo.md5sums.new ; \
  731.     python ./scripts/replace-md5sums.py \
  732.       build/${PATIENT}/rootfs/usr/lib/ipkg/info/palmbuildinfo.md5sums.old \
  733.       build/${PATIENT}/rootfs/usr/lib/ipkg/info/palmbuildinfo.md5sums.new \
  734.           > build/${PATIENT}/rootfs/usr/lib/ipkg/info/palmbuildinfo.md5sums
  735.     rm -f build/${PATIENT}/rootfs/usr/lib/ipkg/info/palmbuildinfo.md5sums.old \
  736.           build/${PATIENT}/rootfs/usr/lib/ipkg/info/palmbuildinfo.md5sums.new
  737. endif
  738.     for app in ${APPLICATIONS} ; do \
  739.       ( cd build/${PATIENT}/rootfs ; \
  740.         find ./usr/palm/applications/$$app -type f | xargs md5sum ) \
  741.           > build/${PATIENT}/rootfs/usr/lib/ipkg/info/$$app.md5sums.new ; \
  742.       python ./scripts/replace-md5sums.py \
  743.         build/${PATIENT}/rootfs/usr/lib/ipkg/info/$$app.md5sums.old build/${PATIENT}/rootfs/usr/lib/ipkg/info/$$app.md5sums.new \
  744.           > build/${PATIENT}/rootfs/usr/lib/ipkg/info/$$app.md5sums ; \
  745.       rm -f build/${PATIENT}/rootfs/usr/lib/ipkg/info/$$app.md5sums.old build/${PATIENT}/rootfs/usr/lib/ipkg/info/$$app.md5sums.new ; \
  746.     done
  747.     ( cd build/${PATIENT}/rootfs ; \
  748.       find ${OLDDIRS} ${OLDFILES} -type f | xargs md5sum ) \
  749.         > build/${PATIENT}/rootfs/md5sums.new
  750.     python ./scripts/replace-md5sums.py build/${PATIENT}/rootfs/md5sums.old build/${PATIENT}/rootfs/md5sums.new > \
  751.                      build/${PATIENT}/rootfs/md5sums
  752.     rm -f build/${PATIENT}/rootfs/md5sums.old build/${PATIENT}/rootfs/md5sums.new
  753. ifeq (${INCREASE_VAR_SPACE},1)
  754.     sed -i.orig -e '/<Volume id="var"/s|256MB|2048MB|' build/${PATIENT}/webOS/${CODENAMENEW}.xml
  755.     rm -f build/${PATIENT}/webOS/${CODENAMENEW}.xml.orig
  756. endif
  757. ifdef CUSTOM_CARRIER_LIST
  758.     [ -f hashes/${CUSTOM_CARRIER_LIST} ]
  759.     sed -i.orig -e '/ApprovalCharlieHash/d' \
  760.         build/${PATIENT}/resources/recoverytool.config
  761.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  762.     echo "ApprovalCharlieHash=`cat hashes/${CUSTOM_CARRIER_LIST}`" >> \
  763.         build/${PATIENT}/resources/recoverytool.config
  764. endif
  765. ifdef CUSTOM_CARRIER_CHECK
  766.     sed -i.orig -e '/ApprovalCharlieHash/d' \
  767.         build/${PATIENT}/resources/recoverytool.config
  768.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  769.     echo "ApprovalCharlieHash=${CUSTOM_CARRIER_CHECK}" >> \
  770.         build/${PATIENT}/resources/recoverytool.config
  771. endif
  772. ifeq (${REMOVE_CARRIER_CHECK},1)
  773.     sed -i.orig -e '/ApprovalCharlieHash/d' -e '/CustomizationBuild/d' \
  774.         build/${PATIENT}/resources/recoverytool.config
  775.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  776. endif
  777. ifdef CUSTOM_MODEL_LIST
  778.     [ -f hashes/${CUSTOM_MODEL_LIST} ]
  779.     sed -i.orig -e '/ApprovalMikeHash/d' \
  780.         build/${PATIENT}/resources/recoverytool.config
  781.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  782.     echo "ApprovalMikeHash=`cat hashes/${CUSTOM_MODEL_LIST}`" >> \
  783.         build/${PATIENT}/resources/recoverytool.config
  784. endif
  785. ifdef CUSTOM_MODEL_CHECK
  786.     sed -i.orig -e '/ApprovalMikeHash/d' \
  787.         build/${PATIENT}/resources/recoverytool.config
  788.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  789.     echo "ApprovalMikeHash=${CUSTOM_MODEL_CHECK}" >> \
  790.         build/${PATIENT}/resources/recoverytool.config
  791. endif
  792. ifeq (${REMOVE_MODEL_CHECK},1)
  793.     sed -i.orig -e '/ApprovalMikeHash/d' \
  794.         build/${PATIENT}/resources/recoverytool.config
  795.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  796. endif
  797. ifdef CUSTOM_RELEASE_CHECK
  798.     sed -i.orig -e '/ApprovalReleaseHash/d' \
  799.         build/${PATIENT}/resources/recoverytool.config
  800.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  801.     echo "ApprovalReleaseHash=${CUSTOM_RELEASE_CHECK}" >> \
  802.         build/${PATIENT}/resources/recoverytool.config
  803. endif
  804. ifeq (${REMOVE_RELEASE_CHECK},1)
  805.     sed -i.orig -e '/ApprovalReleaseHash/d' \
  806.         build/${PATIENT}/resources/recoverytool.config
  807.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  808. endif
  809. ifdef CUSTOM_BUILD_CHECK
  810.     sed -i.orig -e '/ApprovalBuildName/d' \
  811.         build/${PATIENT}/resources/recoverytool.config
  812.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  813.     echo "ApprovalBuildName=${CUSTOM_BUILD_CHECK}" >> \
  814.         build/${PATIENT}/resources/recoverytool.config
  815. endif
  816. ifeq (${REMOVE_BUILD_CHECK},1)
  817.     sed -i.orig -e '/ApprovalBuildName/d' \
  818.         build/${PATIENT}/resources/recoverytool.config
  819.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  820. endif
  821. ifdef CUSTOM_UPDATE_SITE
  822.     sed -i.orig -e '/SoftwareUpdateSite/d' \
  823.         build/${PATIENT}/resources/recoverytool.config
  824.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  825.     echo "SoftwareUpdateSite=${CUSTOM_UPDATE_SITE}" >> \
  826.         build/${PATIENT}/resources/recoverytool.config
  827. endif
  828. ifdef CUSTOM_DEVICETYPE
  829.     sed -i.orig -e 's/DeviceType=.*/DeviceType=${CUSTOM_DEVICETYPE}/' \
  830.         build/${PATIENT}/resources/recoverytool.config
  831.     rm -f build/${PATIENT}/resources/recoverytool.config.orig
  832. endif
  833. ifeq (${DISABLE_MODEM_UPDATE},1)
  834.     sed -i.orig -e '/ModemUpdater/d' \
  835.         build/${PATIENT}/webOS/installer.xml
  836.     rm -f build/${PATIENT}/webOS/installer.xml.orig
  837. endif
  838. ifdef CUSTOM_DEVICETYPE
  839.     sed -i.orig -e 's/target="[^"]*"/target="${CUSTOM_DEVICETYPE}"/' \
  840.             -e 's/bootfile="[^"]*"/bootfile="${BOOTLOADERNEW}.bin"/' \
  841.         build/${PATIENT}/webOS/installer.xml
  842.     rm -f build/${PATIENT}/webOS/installer.xml.orig
  843. endif
  844. ifdef CUSTOM_WEBOS_DMSET
  845.     sed -i.orig -e 's/DMSet token="[^"]*"/DMSet token="${CUSTOM_WEBOS_DMSET}"/' \
  846.         build/${PATIENT}/webOS/installer.xml
  847.     rm -f build/${PATIENT}/webOS/installer.xml.orig
  848. endif
  849. ifndef REMOVE_CARRIER_CHECK
  850. ifdef CUSTOM_CARRIER_DMSET
  851.     sed -i.orig -e 's/DMSet token="[^"]*"/DMSet token="${CUSTOM_CARRIER_DMSET}"/' \
  852.         build/${PATIENT}/carrier/installer.xml
  853.     rm -f build/${PATIENT}/carrier/installer.xml.orig
  854. endif
  855. endif
  856. ifdef ADD_EXT3FS_PARTITION
  857.     sed -i.orig \
  858.       -e 's|<Volume id="media"|<Volume id="ext3fs" type="ext3" size="${ADD_EXT3FS_PARTITION}" mount="/media/ext3fs"/>\
  859. <Volume id="media"|' \
  860.       -e 's|<Mount id="media"|<Mount id="ext3fs" options="noatime,data=writeback" freq="0" passno="0"/>\
  861. <Mount id="media"|' \
  862.         build/${PATIENT}/webOS/${CODENAMENEW}.xml
  863.     rm -f build/${PATIENT}/webOS/${CODENAMENEW}.xml.orig
  864. endif
  865. ifdef CHANGE_KEYBOARD_TYPE
  866.     sed -i.orig -e 's|<Section name="tokens" type="token" size="4KB">|<Section name="tokens" type="token" size="4KB">\
  867. <Val name="KEYoBRD" action="overwrite" value="${CHANGE_KEYBOARD_TYPE}"/>|' \
  868.         build/${PATIENT}/webOS/${CODENAMENEW}.xml
  869.     rm -f build/${PATIENT}/webOS/${CODENAMENEW}.xml.orig
  870. endif
  871. ifeq (${PATCH_DOCTOR},1)
  872.     [ -d patches/doctor ]
  873.     ( cd build/${PATIENT} ; ../../${JAD} -b -ff -o -r -space -s java ${CLASSES:%=%.class} )
  874.     for f in ${CLASSES:%=%.java} ; do \
  875.       [ -f build/${PATIENT}/$$f ] || exit ; \
  876.     done
  877.     ( cd patches/doctor ; cat ${DOCTOR_PATCHES} ) | \
  878.     ( cd build/${PATIENT} ; patch -p0 --no-backup-if-mismatch )
  879. endif
  880.     touch $@
  881.  
  882. .PHONY: pack-%
  883. pack-%:
  884.     ${MAKE} CARRIER=$* pack
  885.  
  886. .PHONY: pack
  887. pack: build/${PATIENT}/.packed
  888.     ${ERR}
  889.  
  890. CODENAMEOLD = ${CODENAME}
  891. INSTIMAGEOLD = nova-installer-image-${CODENAMEOLD}
  892. CUSTIMAGEOLD = nova-cust-image-${CODENAMEOLD}
  893. BOOTLOADEROLD = boot-${CODENAMEOLD}
  894.  
  895. ifdef CUSTOM_DEVICETYPE
  896. CODENAMENEW = ${CUSTOM_DEVICETYPE}
  897. else
  898. CODENAMENEW = ${CODENAMEOLD}
  899. endif
  900.  
  901. INSTIMAGENEW = nova-installer-image-${CODENAMENEW}
  902. CUSTIMAGENEW = nova-cust-image-${CODENAMENEW}
  903. BOOTLOADERNEW = boot-${CODENAMENEW}
  904.  
  905.  
  906. build/${PATIENT}/.packed:
  907.     ${ERR}
  908.     rm -f $@
  909. ifeq (${PATCH_DOCTOR},1)
  910.     ( cd build/${PATIENT} ; javac -cp . ${CLASSES:%=%.java} )
  911. endif
  912.     - ${TAR} -C build/${PATIENT}/rootfs --wildcards \
  913.         -f build/${PATIENT}/webOS/${CUSTIMAGENEW}.rootfs.tar \
  914.         --delete ${OLDDIRS} ${OLDFILES} ./md5sums*
  915.     ( cd build/${PATIENT}/rootfs ; mkdir -p ${NEWDIRS} )
  916.     if [ -f build/${PATIENT}/rootfs/md5sums.gz ] ; then \
  917.       gzip -f build/${PATIENT}/rootfs/md5sums ; \
  918.       ( cd build/${PATIENT}/rootfs ; \
  919.         ${TAR} -f ../webOS/${CUSTIMAGENEW}.rootfs.tar \
  920.             --numeric-owner --owner=0 --group=0 \
  921.             --append ${NEWDIRS} ${NEWFILES} ./md5sums.gz ) ; \
  922.     else \
  923.       ( cd build/${PATIENT}/rootfs ; \
  924.         ${TAR} -f ../webOS/${CUSTIMAGENEW}.rootfs.tar \
  925.             --numeric-owner --owner=0 --group=0 \
  926.             --append ${NEWDIRS} ${NEWFILES} ./md5sums ) ; \
  927.     fi
  928.     gzip -f build/${PATIENT}/webOS/${CUSTIMAGENEW}.rootfs.tar
  929.     ( cd build/${PATIENT}/webOS ; \
  930.         ${TAR} -f ../resources/webOS.tar \
  931.             --numeric-owner --owner=0 --group=0 -h \
  932.             -c . )
  933.     sed -i.orig -e '/^Name: /d' -e '/^SHA1-Digest: /d' -e '/^ /d' -e '/^\n$$/d' \
  934.         build/${PATIENT}/META-INF/MANIFEST.MF
  935.     ( cd build/${PATIENT} ; \
  936.         zip -q -d ${DOCTOR} META-INF/MANIFEST.MF META-INF/JARKEY.* ${CLASSES:%=%*.class} \
  937.             resources/webOS.tar resources/recoverytool.config )
  938.     ( cd build/${PATIENT} ; \
  939.         zip -q ${DOCTOR} META-INF/MANIFEST.MF ${CLASSES:%=%*.class} \
  940.             resources/webOS.tar resources/recoverytool.config )
  941. ifndef REMOVE_CARRIER_CHECK
  942.     ( cd build/${PATIENT}/carrier ; \
  943.         ${TAR} -f ../resources/${CARRIER_TARBALL} \
  944.             --numeric-owner --owner=0 --group=0 -h \
  945.             -c -T carrier-file-list.txt )
  946.     ( cd build/${PATIENT} ; \
  947.         zip -q -d ${DOCTOR} resources/${CARRIER_TARBALL} )
  948.     ( cd build/${PATIENT} ; \
  949.         zip -q ${DOCTOR} resources/${CARRIER_TARBALL} )
  950. endif
  951.     @echo
  952.     @echo "Your custom doctor file has been created at build/${PATIENT}/${DOCTOR}"
  953.     @echo
  954.     touch $@
  955.  
  956. .PHONY: devmode-%
  957. devmode-%:
  958.     ${MAKE} CARRIER=$* devmode
  959.  
  960. .PHONY: devmode
  961. devmode: mount
  962.     novacom -w run file://bin/mount -- /dev/mapper/store-var /tmp/var -o remount,rw
  963.     novacom -w run file://bin/mkdir -- -p /tmp/var/gadget
  964.     novacom -w run file://bin/touch -- /tmp/var/gadget/novacom_enabled
  965.     novacom -w run file://bin/mount -- /dev/mapper/store-var /tmp/var -o remount,ro
  966.  
  967. .PHONY: backup-%
  968. backup-%:
  969.     ${MAKE} CARRIER=$* backup
  970.  
  971. .PHONY: backup
  972. backup: mount
  973.     @export id="`novacom -w run file://bin/cat -- /proc/nduid | cut -c 1-8`" ; \
  974.     mkdir -p clones/$$id ; \
  975.     echo "Creating clones/$$id/tokens.txt" ; \
  976.     novacom -w run file://sbin/tokens -- --list > clones/$$id/tokens.txt ; \
  977.     echo "Creating clones/$$id/${CUSTIMAGEOLD}.nvram.bin" ; \
  978.     ( novacom -w run file://bin/dd -- if=/dev/mmcblk0p1 ) > \
  979.        clones/$$id/${CUSTIMAGEOLD}.nvram.bin ; \
  980.     echo "Creating clones/$$id/${CUSTIMAGEOLD}.varfs.tar.gz" ; \
  981.     ( novacom -w run file://bin/tar -- -C /tmp/var/ --totals -cf - . ) | \
  982.       gzip -c > clones/$$id/${CUSTIMAGEOLD}.varfs.tar.gz ; \
  983.     echo "Creating clones/$$id/${CUSTIMAGEOLD}.rootfs.tar.gz" ; \
  984.     ( novacom -w run file://bin/tar -- -C /tmp/root/ --totals -cf - . ) | \
  985.       gzip -c > clones/$$id/${CUSTIMAGEOLD}.rootfs.tar.gz ; \
  986.     echo "Creating clones/$$id/${CUSTIMAGEOLD}.boot.tar.gz" ; \
  987.     ( novacom -w run file://bin/tar -- -C /tmp/boot/ --totals -cf - . ) | \
  988.       gzip -c > clones/$$id/${CUSTIMAGEOLD}.boot.tar.gz ; \
  989.     echo "Creating clones/$$id/${CUSTIMAGEOLD}.mojodb.tar.gz" ; \
  990.     ( novacom -w run file://bin/tar -- -C /tmp/mojodb/ --totals -cf - . ) | \
  991.       gzip -c > clones/$$id/${CUSTIMAGEOLD}.mojodb.tar.gz ; \
  992.     echo "Creating clones/$$id/${CUSTIMAGEOLD}.filecache.tar.gz" ; \
  993.     ( novacom -w run file://bin/tar -- -C /tmp/filecache/ --totals -cf - . ) | \
  994.       gzip -c > clones/$$id/${CUSTIMAGEOLD}.filecache.tar.gz ; \
  995.     echo "Creating clones/$$id/${CUSTIMAGEOLD}.log.tar.gz" ; \
  996.     ( novacom -w run file://bin/tar -- -C /tmp/log/ --totals -cf - . ) | \
  997.       gzip -c > clones/$$id/${CUSTIMAGEOLD}.log.tar.gz ; \
  998.     echo "Creating clones/$$id/${CUSTIMAGEOLD}.update.tar.gz" ; \
  999.     ( novacom -w run file://bin/tar -- -C /tmp/update/ --totals -cf - . ) | \
  1000.       gzip -c > clones/$$id/${CUSTIMAGEOLD}.update.tar.gz ; \
  1001.     echo "Creating clones/$$id/${CUSTIMAGEOLD}.media.tar.gz" ; \
  1002.     ( novacom -w run file://bin/tar -- -C /tmp/media/ --totals -cf - . ) | \
  1003.       gzip -c > clones/$$id/${CUSTIMAGEOLD}.media.tar.gz ; \
  1004.  
  1005. .PHONY: mount
  1006. mount: unmount
  1007.     novacom -w run file://usr/sbin/lvm.static -- vgscan --ignorelockingfailure 2> /dev/null
  1008.     novacom -w run file://usr/sbin/lvm.static -- vgchange -ay --ignorelockingfailure 2> /dev/null
  1009.     @for f in var root mojodb filecache log update media ; do \
  1010.       echo "Mounting /dev/mapper/store-$$f" ; \
  1011.       novacom -w run file://bin/mkdir -- -p /tmp/$$f ; \
  1012.       novacom -w run file://bin/mount -- /dev/mapper/store-$$f /tmp/$$f -o ro ; \
  1013.     done
  1014.     @echo "Mounting /dev/mmcblk0p2"
  1015.     @novacom -w run file://bin/mkdir -- -p /tmp/boot
  1016.     @novacom -w run file://bin/mount -- /dev/mmcblk0p2 /tmp/boot -o ro
  1017.  
  1018. .PHONY: unmount
  1019. unmount:
  1020.     @for f in var root mojodb filecache log update media boot ; do \
  1021.       echo "Unmounting /tmp/$$f" ; \
  1022.       ( novacom -w run file://bin/umount -- /tmp/$$f 2> /dev/null || true ) ; \
  1023.     done
  1024.  
  1025. .PHONY: memload-%
  1026. memload-%:
  1027.     ${MAKE} CARRIER=$* memload
  1028.  
  1029. .PHONY: memload
  1030. memload: build/${PATIENT}/.unpacked
  1031.     novacom -w boot mem:// < build/${PATIENT}/webOS/${INSTIMAGEOLD}.uImage
  1032.     @sleep 5
  1033.  
  1034. .PHONY: memboot-%
  1035. memboot-%:
  1036.     ${MAKE} CARRIER=$* memboot
  1037.  
  1038. .PHONY: memboot
  1039. memboot: build/${PATIENT}/.unpacked
  1040.     novacom -w run file://sbin/tellbootie recover || true
  1041.     @sleep 5
  1042.     novacom -w boot mem:// < build/${PATIENT}/webOS/${INSTIMAGEOLD}.uImage
  1043.     @sleep 5
  1044.  
  1045. .PHONY: reboot
  1046. reboot:
  1047.     novacom -w run file://sbin/tellbootie || true
  1048.     @sleep 5
  1049.  
  1050. .PHONY: recover
  1051. recover:
  1052.     novacom -w run file://sbin/tellbootie recover || true
  1053.     @sleep 5
  1054.  
  1055. .PHONY: download-%
  1056. download-%:
  1057.     ${MAKE} CARRIER=$* download
  1058.  
  1059. .PHONY: download
  1060. download: downloads/${DOCTOR}
  1061.  
  1062. downloads/${DOCTOR}:
  1063.     ${ERR}
  1064.     mkdir -p downloads
  1065.     @ [ -f $@ ] || echo "Please download the correct version of the webOS Doctor .jar file" &&  echo "and then move it to $@ (i.e. the downloads directory that was just created under the current directory)." && false
  1066.     touch $@
  1067.  
  1068. .PHONY: jad
  1069. jad: ${JAD}
  1070.  
  1071. build/tools/jad-macosx/jad: downloads/jad158g.mac.intel.zip
  1072.     mkdir -p build/tools/jad-macosx
  1073.     ( cd build/tools/jad-macosx ; unzip ../../../$< jad )
  1074.     touch $@
  1075.  
  1076. downloads/jad158g.mac.intel.zip:
  1077.     mkdir -p downloads
  1078.     curl -L -o $@ http://www.varaneckas.com/sites/default/files/jad/jad158g.mac.intel.zip
  1079.  
  1080. build/tools/jad-linux/jad: downloads/jad158e.linux.static.zip
  1081.     mkdir -p build/tools/jad-linux
  1082.     ( cd build/tools/jad-linux ; unzip ../../../$< jad )
  1083.     touch $@
  1084.  
  1085. downloads/jad158e.linux.static.zip:
  1086.     mkdir -p downloads
  1087.     curl -L -o $@ http://www.varaneckas.com/sites/default/files/jad/jad158e.linux.static.zip
  1088.  
  1089. ${JODE}:
  1090.     mkdir -p downloads
  1091.     curl -L -o $@ http://sourceforge.net/projects/jode/files/jode/1.1.2-pre1/jode-1.1.2-pre1.jar/download
  1092.  
  1093. clobber:
  1094.     rm -rf build
  1095.  
  1096. clobber-%:
  1097.     make CARRIER=$* clobber-build
  1098.  
  1099. clobber-build:
  1100.     rm -rf build/${PATIENT}
  1101.  
  1102. reallyclobber: clobber
  1103.     rm -rf clones
  1104.  
  1105. .PHONY: err
  1106. err: ; $(ERR)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement