platform/core/system/initrd-flash.git
2 years agoscripts: Remove unused tools 83/277283/1 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.061101 accepted/tizen/7.0/unified/hotfix/20221116.105725 accepted/tizen/unified/20220705.211133 submit/tizen/20220705.015056 tizen_7.0_m2_release
Seung-Woo Kim [Mon, 4 Jul 2022 10:11:25 +0000 (19:11 +0900)]
scripts: Remove unused tools

After removing wifi feature, ln, sed, cp and find tools are not
used. Remove the unused tools.

Change-Id: Ie9f603dd133554cf06a7fbde3a93f0b185e5bc3e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agodata: add the generic partition info data 04/273904/1 accepted/tizen/unified/20220418.042544 submit/tizen/20220418.013112
Jaehoon Chung [Mon, 18 Apr 2022 00:41:40 +0000 (09:41 +0900)]
data: add the generic partition info data

To support network download, it needs to locate partition.info in hal.
This is the common partition layout to use Tizen.

Change-Id: Ife8ab1f948da5f6ab7a0f77c24fb302f8ac13187
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agousd: Check validation of set_line_coding packet size. 85/271485/1 accepted/tizen/unified/20220222.132921 submit/tizen/20220222.053708
Dongwoo Lee [Tue, 22 Feb 2022 04:24:12 +0000 (13:24 +0900)]
usd: Check validation of set_line_coding packet size.

To prevent vulnerable memory allocation of set_line_conding packet,
check validation of set_line_coding packet size value.

Change-Id: I0db4860477769622a79d4b0b6d18d3518c795d59
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
3 years agopackaging: remove initrd-flash dependency to fm-data 07/256107/1 accepted/tizen_6.5_unified tizen_6.5 accepted/tizen/6.5/unified/20211028.114751 accepted/tizen/unified/20210330.111146 submit/tizen/20210330.084551 submit/tizen_6.5/20211028.162501 tizen_6.5.m2_release
Seung-Woo Kim [Mon, 29 Mar 2021 06:36:39 +0000 (15:36 +0900)]
packaging: remove initrd-flash dependency to fm-data

To split device specific data from common image, remove dependency
to device specific fm-data from initrd-flash package.

Note: RPI images have fm-data-rpi3 explictly, so it will not break
current flash process.

Change-Id: Ie1f714686b383c350cb9897ae36548c812a0840a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agodfu: add error log about failure for partition information 06/256106/1
Seung-Woo Kim [Mon, 29 Mar 2021 06:33:42 +0000 (15:33 +0900)]
dfu: add error log about failure for partition information

When splitting /hal directory, there can be no files under /hal
directory. Add explicit error log about failure to open device
speicif file.

Change-Id: Icf14faac406035927cec00e4a46595e1d7559edd
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agodate: move device specific partition under /hal directory 05/256105/1
Seung-Woo Kim [Mon, 29 Mar 2021 05:07:52 +0000 (14:07 +0900)]
date: move device specific partition under /hal directory

The pratition information is device specific data, and it should
be under /hal directory.

Change-Id: I543fd5d5d1fe4c0c688ef3fcb76adca8e5b2f510
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agopackaging: remove unnecessary Requires packages 22/255322/1
Jaehoon Chung [Tue, 16 Mar 2021 23:22:01 +0000 (08:22 +0900)]
packaging: remove unnecessary Requires packages

Remove unnecessary Requires packages.
dnsmasq / wpa_supplicant don't use anymore after Wireless mode was
removed.

Change-Id: I399ca6ea5a48b866033cac317100e6938627327a
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodata: update a hal partition information 83/249283/2 accepted/tizen/unified/20201211.124320 submit/tizen/20201211.031336
Jaehoon Chung [Thu, 10 Dec 2020 00:04:27 +0000 (09:04 +0900)]
data: update a hal partition information

Update a hal partition information for flashing hal.img.
It's for preparing to use hal.img in future.

Change-Id: Iea6fa126951f4f27fd432a5760fcf7b5c59cdb90
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodata: remove WiFi firmware data files 82/249282/2
Jaehoon Chung [Wed, 9 Dec 2020 22:37:30 +0000 (07:37 +0900)]
data: remove WiFi firmware data files

Remove WiFi firmare data files and codes related with it.
It doesn't need to include anymore.

Change-Id: Id527d4467e430a268b65df8829b0cd89e27ea001
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agothor: Fix the bug upon file size recovery 45/245745/1 accepted/tizen/unified/20201028.123845 submit/tizen/20201027.003535
Junghoon Kim [Thu, 15 Oct 2020 07:55:00 +0000 (16:55 +0900)]
thor: Fix the bug upon file size recovery

TFM throws a flashing error for files larger than 2 GBytes. Fix the
calculation logic for the file size recovery.

Change-Id: I28ec141dec63cfe495dcb6a5bcbe03323de36947
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
4 years agoscripts: flash-init: disable WiFi AP mode on tfm 56/245256/1 accepted/tizen/6.0/unified/20201030.115539 accepted/tizen/6.0/unified/hotfix/20201103.003515 accepted/tizen/unified/20201006.075859 submit/tizen/20201006.065742 submit/tizen_6.0/20201029.205104 submit/tizen_6.0_hotfix/20201102.192504 submit/tizen_6.0_hotfix/20201103.114804 tizen_6.0.m2_release
Jaehoon Chung [Tue, 6 Oct 2020 05:58:58 +0000 (14:58 +0900)]
scripts: flash-init: disable WiFi AP mode on tfm

Disable WIFi AP mode on tfm.
If it doesn't register to network security, it can be jamming with its
mac address.

Change-Id: I83fc9ac98c9186ec79bcbe769b0ea41d30a6914f
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agoAdd missing newline character from log 91/244591/1 accepted/tizen/unified/20200923.093736 submit/tizen/20200923.032842
Seung-Woo Kim [Tue, 22 Sep 2020 06:50:43 +0000 (15:50 +0900)]
Add missing newline character from log

Change-Id: I7600d5d2e9ebded4bcfdcde0e0420bf578a49bbe
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agodfu: add null check for thread 74/244574/1
Seung-Woo Kim [Tue, 22 Sep 2020 05:20:48 +0000 (14:20 +0900)]
dfu: add null check for thread

If dfu_start() is failed, there are cases ctx->thread is null and
this causes crash during dfu_free_context(). So add null check for
thread from dfu_free_context().

This fixes below crash-stack:
  Call Stack Count: 2
   0: pthread_cancel + 0x10 (0x0000007f81d9eab0) [/mnt/initrd-recovery/usr/lib64/libpthread.so.0] + 0x10ab0
   1: dfu_free_context + 0x1c (0x000000557ca2283c) [/mnt/initrd-recovery/usr/bin/flash-manager] + 0x483c
  End of Call Stack

Change-Id: I92fb9980047a3a58de516e81d694b7507662be26
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agousb: Add support to set proper serial-number 21/243121/3 accepted/tizen/unified/20200904.154058 submit/tizen/20200904.033042
Dongwoo Lee [Thu, 3 Sep 2020 07:43:59 +0000 (16:43 +0900)]
usb: Add support to set proper serial-number

Now, we can provide serial-number to TFM's usb interface by using
option 's'.

Change-Id: Ie88350fded96999eb24b1a3f834598479c80177c
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agointerface: Improve checking availiablity 09/243209/1
Dongwoo Lee [Thu, 3 Sep 2020 09:18:27 +0000 (18:18 +0900)]
interface: Improve checking availiablity

This improving checking interface availability for both situation:
1) stucked on initializing interface due to no available interfaces,
and 2) options for unavailable interface is passed.

Change-Id: I895d0c6e6fcf1d4539cb419c5e9c4f69ef9bf544
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agousb: Read until buffer is fully filled 66/242866/1 accepted/tizen/unified/20200902.145546 submit/tizen/20200902.012141
Dongwoo Lee [Tue, 1 Sep 2020 10:11:28 +0000 (19:11 +0900)]
usb: Read until buffer is fully filled

Since a single read may not fill the buffer entirely, this makes try
to fill the buffer fully with loop.

Change-Id: Ic73daf50b060f37c773774108952dbdf30de07e1
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agousb: properly clean up usb gadget 01/240101/1 accepted/tizen/unified/20200804.142348 submit/tizen/20200804.050420
Seung-Woo Kim [Mon, 3 Aug 2020 08:09:37 +0000 (17:09 +0900)]
usb: properly clean up usb gadget

If error occurs during flashing, usb gadget is not cleaned up and
the second tfm session does not work for usb gadget. Properly clean
up usb gadget including usbg_disable_gadget() and usbg_rm_gadget().

Change-Id: I702deaa009642e3ead45d40abb20c3bf821f1fb7
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoscript: flash-init: Add default PATH variable 01/235901/1 accepted/tizen/unified/20200618.015753 submit/tizen/20200617.105114
Dongwoo Lee [Thu, 11 Jun 2020 00:55:37 +0000 (09:55 +0900)]
script: flash-init: Add default PATH variable

To mitigate security vulnerability, this defines default PATH
variable explicitly.

Change-Id: Idb828873481fe442ddf4ed3a6a89854590420e78
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agoUpdate install directory to support architecture difference 74/235474/1 accepted/tizen/unified/20200610.140849 submit/tizen/20200610.021850
Seung-Woo Kim [Thu, 4 Jun 2020 11:01:10 +0000 (20:01 +0900)]
Update install directory to support architecture difference

Some install directory can be differ from each architecture. So
use the install directory with packaging macro by configure file
setup of cmake.

Note: install init flie to libexec instead of libdir.

Change-Id: I479e631a47bfff55f14209eaa60928c7a96acd8b
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agopackaging: adjust file permission 35/235435/1
Seung-Woo Kim [Thu, 4 Jun 2020 11:04:26 +0000 (20:04 +0900)]
packaging: adjust file permission

Only executable files are required to be set with exec permission.
Adjust file permission for packaging.

Change-Id: I62a11c42896bd8c96b7bb1a51fd2e867cdd5c5af
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agopackaging: Enable aarch64 build 02/231902/1 accepted/tizen/unified/20200506.100235 submit/tizen/20200504.005339
Seung-Woo Kim [Fri, 24 Apr 2020 09:55:14 +0000 (18:55 +0900)]
packaging: Enable aarch64 build

The flash-manager can be used in aarch64, so no reason not to
build in aarch64. Enable aarch64 build.

Note: dependent package, initrd-recovery change to enable aarch64
build is required.

Change-Id: Id2235971570eba474b4a5127f7587f1ccec097d3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agodfu: Don't print out progress if no terminal 39/231139/1
Dongwoo Lee [Fri, 17 Apr 2020 10:22:18 +0000 (19:22 +0900)]
dfu: Don't print out progress if no terminal

Since commit 76316d20e333 ("dfu: Improve progress display"), broken
progress bar can flood massively if the output is redirected to
non-terminal device such as a log file. To prevent this, prints out
the simple result instead of progress bar if terminal doesn't exist.

Change-Id: If5edb6408b7614951180fb4a73df53ad06572cc7
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agoscripts: Add missing files to copying file list 58/229558/3 accepted/tizen/unified/20200403.034440 submit/tizen/20200402.093820
Seung-Woo Kim [Thu, 2 Apr 2020 01:34:40 +0000 (10:34 +0900)]
scripts: Add missing files to copying file list

Add missing files to copying file list except /usr/sbin/reboot
because it is symbolic link made from initrd-recovery package.

This fixes below script errors when creating initrd-recovery.img
without other recovery sub modules:
   /sbin/flash-init: line 98: /usr/bin/cp: No such file or directory
   /sbin/flash-init: line 99: /usr/bin/cp: No such file or directory

Change-Id: I7edcc18311f07aca43f2c040f5bf1e6555e28ba0
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoscripts: Fix file list with directory full path 57/229557/2
Seung-Woo Kim [Thu, 2 Apr 2020 01:13:23 +0000 (10:13 +0900)]
scripts: Fix file list with directory full path

From file list for copying and moving, there are mixture of file
path with and without prefix, "/usr". Fix the file list with
prefix, "/usr", always.  In Tizen, /bin and /sbin are symbolic
links made from /usr/bin and /usr/sbin, so there is no functional
change.

Change-Id: Id7cc5ddb9d936da08fa47c05cf02b9f64f793b16
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agonet: Remove unused variables in net_available() 56/229556/2
Seung-Woo Kim [Thu, 2 Apr 2020 01:47:22 +0000 (10:47 +0900)]
net: Remove unused variables in net_available()

There are unused variable warnings. Remove the unused variables in
net_available().

Change-Id: Ic373fed340c0a65dd7c940cf407add7f0bcdb25e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agodfu: Improve progress display 16/229016/6
Dongwoo Lee [Wed, 1 Apr 2020 01:43:52 +0000 (10:43 +0900)]
dfu: Improve progress display

Since commit 951986d4deb9 ("thor: Use smaller flash unit size"), the
number of character '#' is extremely increased while transfer is
proceeded. For removing it and providing fancy progress bar, this
reworks progress display.

Change-Id: Ic21ec3f1c87a469f23f6c892cfd341f956777930
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agothor: Move context members to structure dfu_entry 15/229015/5
Dongwoo Lee [Wed, 1 Apr 2020 00:22:23 +0000 (09:22 +0900)]
thor: Move context members to structure dfu_entry

This removes unnecessary members in thor context and move them into
dfu_entry structure. The code is just cleaned up and the change has
no effect on functionalites.

Change-Id: I297132be52b7e5e1b75b410297e98cf63870c503
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agoscripts: Fix to copy all firmware files 14/229014/2 accepted/tizen/unified/20200330.054444 submit/tizen/20200327.075007
Dongwoo Lee [Thu, 26 Mar 2020 05:30:05 +0000 (14:30 +0900)]
scripts: Fix to copy all firmware files

Since this copying all firmware files instead of adding the individual
files when making ramdisk-recovery.img.

Change-Id: I7c64d861bcea5d2546b92b0ee076c266679962db
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agodfu: Fix possible wrong memory access 32/229032/1
Dongwoo Lee [Fri, 27 Mar 2020 07:11:44 +0000 (16:11 +0900)]
dfu: Fix possible wrong memory access

Currently, dfu context is assigned after thread creation, tfm can
be died due to wrong memory access if thread is scheduled in advance.
This fixes this by assigning ctx before thread creation.

Change-Id: I44f86223b90d6dac537699369a478d4cdb7829c2
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agodfu: Use longer delay for waiting queue available 02/228702/1 accepted/tizen/unified/20200325.055722 submit/tizen/20200325.024820
Dongwoo Lee [Wed, 25 Mar 2020 02:39:05 +0000 (11:39 +0900)]
dfu: Use longer delay for waiting queue available

By recommend of static analysis tool, sleep time for waiting queue
become available will be expanded to 10000us.

Change-Id: I5ace690d1f6826234fad89489c9617a046456f8c
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agotfm: Add wireless connection support for RPI4 29/228129/6 accepted/tizen/unified/20200323.173017 submit/tizen/20200320.075622
Dongwoo Lee [Thu, 19 Mar 2020 04:45:10 +0000 (13:45 +0900)]
tfm: Add wireless connection support for RPI4

The nvram files for RPI4 and RPI3+ wifi chipset have a little
difference contents but name is identical. To deal with this,
the target is identified through sysfs node and the correct
nvram is selected by result.

In addition, now tfm shows ssid including serial number.

Change-Id: I7122574b09155cbd27ccf1c35c2cdcabe528864a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agousb: Add check availability 28/228128/4
Dongwoo Lee [Wed, 18 Mar 2020 03:32:20 +0000 (12:32 +0900)]
usb: Add check availability

If the target can be configured by usb configfs gadget, then it
considers that the target supports usb interface.

Change-Id: Ief17152a655b5e0eae11db8fbb8f8ca93feec653
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agonet: Add check availability 27/228127/3
Dongwoo Lee [Wed, 18 Mar 2020 03:32:08 +0000 (12:32 +0900)]
net: Add check availability

If the target has NIC named eth0 or wlan0, then it considers that
network is available.

Change-Id: I6cb0bc48a9bb8154a8d02fd183db105554ea9862
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agointerface: Introduce operation for checking availability 26/228126/2
Dongwoo Lee [Wed, 18 Mar 2020 03:31:39 +0000 (12:31 +0900)]
interface: Introduce operation for checking availability

Because there is no need to setup interface not supported by target,
check availability of interface and ignore the target which is not
available. Since this, the interface not providing available function
will be also ignored.

Change-Id: Ic7cf11e2d46bd6b979cc02a87cb392cfb04ed399
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agousb: Fix possible vulnerability 55/228155/2
Dongwoo Lee [Thu, 19 Mar 2020 08:24:09 +0000 (17:24 +0900)]
usb: Fix possible vulnerability

Since the return value of read operation is not checked properly,
it can be the target of attack by buffer overflows. To prevent this,
return values will be treated.

Change-Id: I702b64fb4f77b7cc507a519952c11f41813cf0a2
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agodfu: Limit maximum length of io queue 33/223033/12
Dongwoo Lee [Tue, 17 Mar 2020 04:56:20 +0000 (13:56 +0900)]
dfu: Limit maximum length of io queue

To prevent timeout due to fsync, the maximum length of io queue is
limited. Transfer may be blocked until the previous request is
fsync'ed, but it is not harmful to overall performance since fsync is
bottleneck; even transfer is faster, flashing time is not reduced
because elapsed time is mostly consumed in fsync.

Change-Id: I8b59c175eb8065f388487249c9e7f3ef1dbab5b6
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agothor: Use smaller flash unit size 32/223032/12
Dongwoo Lee [Tue, 17 Mar 2020 04:56:36 +0000 (13:56 +0900)]
thor: Use smaller flash unit size

Large size of flash unit causes timeout for such interface which has
request timeout by making fsync takes very long time. To prevent this,
use smaller size of flash unit, and transfer unit is also adjusted.

Change-Id: Ib45f20855dad4cef18e02410e9d976022cfc1597
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agointerface: Choose interface after thor handshake 31/223031/12
Dongwoo Lee [Tue, 17 Mar 2020 04:55:56 +0000 (13:55 +0900)]
interface: Choose interface after thor handshake

To prevent that interface blocks other connection before host actually
start transferring, connected interface is selected after handshake is
done.

Change-Id: I6b8587898b4dae83ffeb9e4330d379fa723e98d1
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agointerface: usb: Add support for USB interface 29/223029/12
Dongwoo Lee [Tue, 17 Mar 2020 04:53:32 +0000 (13:53 +0900)]
interface: usb: Add support for USB interface

USB interface is added and enabled by configuring gadget driver
through configfs with support of libusbgx.

Change-Id: I638bfa59e127f7896f8ed4b6fa11ba3d37d4548e
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agotfm: Get rid of unnecessary global header tfm.h 28/223028/10
Dongwoo Lee [Tue, 17 Mar 2020 04:44:33 +0000 (13:44 +0900)]
tfm: Get rid of unnecessary global header tfm.h

Global tfm context is no more used, so global header tfm.h is neither
required. This just removes unnecessary header, thus has no functional
changes.

Change-Id: I69daaaa255dea57676e04bdb0c8145cf4049ed87
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agointerface: net: Apply interface f/w into network transfer 27/223027/10
Dongwoo Lee [Tue, 17 Mar 2020 04:42:38 +0000 (13:42 +0900)]
interface: net: Apply interface f/w into network transfer

Since this, network connection is processed upon interface f/w.

Change-Id: I87df71a923f010bb013e0b4166c50949bb19a153
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agointerface: Add support for multiple transfer interfaces 35/223035/9
Dongwoo Lee [Tue, 17 Mar 2020 04:36:02 +0000 (13:36 +0900)]
interface: Add support for multiple transfer interfaces

To support USB connection, multiple interface f/w should be required
before. This adds only interface f/w, so network connection is
still processed without f/w.

Change-Id: I367f9e961daefe3b9005104084955edbe0851057
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agotfm: Refactor code structure 34/223034/9
Dongwoo Lee [Tue, 17 Mar 2020 04:29:24 +0000 (13:29 +0900)]
tfm: Refactor code structure

To cleanup code and resolve dependency on each module, this just
refactors code structure without functional changes.

Change-Id: I0c9e4b50d1054255c4f33f2a0218469c0647d2c7
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agothor: Bump protocol version to 5.0 96/227996/2
Dongwoo Lee [Wed, 18 Mar 2020 03:35:59 +0000 (12:35 +0900)]
thor: Bump protocol version to 5.0

To support the images exceeds 4GB, thor protocol 5.0 is applied.

This requires thor client support:
Ref: https://git.tizen.org/cgit/tools/lthor/commit/?id=30fa9f0cbfc4b089bb7e733b9cb75a60e1d10369

u-boot thor downloader already supports protocol 5.0:
Ref: https://gitlab.denx.de/u-boot/u-boot/-/commit/1fe9ae76b113103bcc40aa15949f9dd8aa0a06a2

Change-Id: I149361ca2f40b5775249f3672e3e19b2f6394b68
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agoFix to check memory allocation failure 67/224367/1 accepted/tizen/unified/20200210.131720 submit/tizen/20200210.075209
Seung-Woo Kim [Mon, 10 Feb 2020 06:28:36 +0000 (15:28 +0900)]
Fix to check memory allocation failure

The strdup() can be failed and return NULL. Not to access wrong
memory, explictly check memory allocation failure.

Change-Id: I2917cf0cebd6488004b653c29137c0acbb56074e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agofix use string after null check 77/222177/1 accepted/tizen/unified/20200113.130531 submit/tizen/20200113.015142
Seung-Woo Kim [Fri, 10 Jan 2020 06:29:42 +0000 (15:29 +0900)]
fix use string after null check

The result of strdup() can be null, so use it after null check.

Change-Id: I61b5e5a4d4b631984eb19240b46afe0e94752043
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agodfu: do stringop with termination character 76/222176/1
Seung-Woo Kim [Fri, 10 Jan 2020 06:10:49 +0000 (15:10 +0900)]
dfu: do stringop with termination character

Doing string operation with strlen() result, there is possibilty
of omission of termination character. Do stringop with termination
character with strlen() + 1. The destination buffer is allocated
sum of all strlen() and 1, there is no overflow.

Change-Id: I35627dbbb0ac72bc58398ccfffa43802729c5b85
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoFix gcc9 build warnings 32/221932/1 accepted/tizen/unified/20200109.065607 submit/tizen/20200109.031349
Dongwoo Lee [Wed, 8 Jan 2020 08:53:40 +0000 (17:53 +0900)]
Fix gcc9 build warnings

This fixes build warnings on compiling with gcc9.

Change-Id: I7ff58499fc2813931ff49c8f7d58e851b08ef5dc
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agodata: Add rpi4 dtb as a flashing entity 31/221931/1
Dongwoo Lee [Fri, 3 Jan 2020 05:46:28 +0000 (14:46 +0900)]
data: Add rpi4 dtb as a flashing entity

To support tizen flash manager for rpi4, this adds a dtb file for
bcm2711 into partition information file.

Change-Id: I9b4a97c5d80f40c329d04f87d1eb1b29066d17f0
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agodfu: Free resources on error 84/209484/2 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.004244 accepted/tizen/5.5/unified/mobile/hotfix/20201027.090327 accepted/tizen/5.5/unified/wearable/hotfix/20201027.113015 accepted/tizen/unified/20190709.071054 submit/tizen/20190708.085020 submit/tizen_5.5/20191031.000010 submit/tizen_5.5_mobile_hotfix/20201026.185104 submit/tizen_5.5_wearable_hotfix/20201026.184304 tizen_5.5.m2_release
Dongwoo Lee [Mon, 8 Jul 2019 07:07:45 +0000 (16:07 +0900)]
dfu: Free resources on error

This patch makes resources are freed on error case while scanning
the type of filesystem with blkid APIs. This resource leakage was
reported by static analystic tool.

Change-Id: Ibeba4190316fb1db0bde02eaca0648c0db0bad2e
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoCMakeLists: Apply PIE flags 73/208473/2 accepted/tizen/unified/20190626.114555 submit/tizen/20190626.004500
Dongwoo Lee [Tue, 25 Jun 2019 01:23:49 +0000 (10:23 +0900)]
CMakeLists: Apply PIE flags

To support ASLR, this patch applies PIE (position independent
executable) flags to CMakeLists.txt.

Change-Id: If7eae9c8aad08fe9da3083cbdad64a7221fdaa98
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agodata: Update the partition info file to support 32-bit architecture 37/205837/2 accepted/tizen/unified/20190618.050016 submit/tizen/20190614.000839
Junghoon Kim [Thu, 9 May 2019 12:26:39 +0000 (21:26 +0900)]
data: Update the partition info file to support 32-bit architecture

This patch adds the dtb and zImage to the partition info file, in order
to support 32-bit architecture. Also, common u-boot and config files
have been added to facilitate testing between 32-bit and 64-bit
architectures.

Change-Id: Idf27f33e50bbafbf438b78d6b336d4794416aa18
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
5 years agoscripts: flash-init: create symbolic link about firmware path 88/205788/2 accepted/tizen/unified/20190510.012035 submit/tizen/20190509.080043
Jaehoon Chung [Thu, 9 May 2019 07:10:40 +0000 (16:10 +0900)]
scripts: flash-init: create symbolic link about firmware path

Create symbolic link about firmware path.

Change-Id: Ia0243afbafddbeef2bf797b3ad184150af75f4c5
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agopackaging: move firmware file to data directory 87/205787/1
Jaehoon Chung [Thu, 9 May 2019 05:24:14 +0000 (14:24 +0900)]
packaging: move firmware file to data directory

Move firmare file to data directory from /lib/firmware/brcm/.

Change-Id: I5d37d3fda035bc271fb62ef0c8f8b2926828fbf1
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agoscripts: Print out brief information about network connection 39/204239/2 accepted/tizen/unified/20190425.111810 submit/tizen/20190425.041112
Dongwoo Lee [Mon, 22 Apr 2019 07:53:12 +0000 (16:53 +0900)]
scripts: Print out brief information about network connection

This patch refactors init script in order to provide brief
information of the target network as below:

  Network Information:
  Wired: xxx.xxx.xxx.xxx
  Wireless: xxx.xxx.xxx.xxx [SSID: xxxxxxxxx]

Change-Id: I5df962443cc846e60a5952dbb3e8dadb37273dd3
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoscripts: Prevent failure of ip assigning 38/204238/1
Dongwoo Lee [Thu, 18 Apr 2019 01:36:43 +0000 (10:36 +0900)]
scripts: Prevent failure of ip assigning

If init script tries to assign ip before usb nic is ready, it fails and
the target is rebooted. To prevent this, tries several times for
assigning, and determine failure after exceeding maximum tries.

Change-Id: Iaa8dfbcee57985c69055e4742818f8256fba1cdd
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoscripts: flash-init: use dnsmasq and hostapd 65/203665/2
Jaehoon Chung [Tue, 16 Apr 2019 22:39:01 +0000 (07:39 +0900)]
scripts: flash-init: use dnsmasq and hostapd

Use dnsmasq and hostapd for AP mode.
wlan0 is used static ip as 192.168.43.1.

Change-Id: Id9f8fdd1d1b1a3d30dd9306f13834b86267df978
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agopackaging: include dnsmasq config file 64/203664/2
Jaehoon Chung [Tue, 16 Apr 2019 11:07:33 +0000 (20:07 +0900)]
packaging: include dnsmasq config file

To use dnsmasq, include dnsmasq.conf file.
- run background with pid-file
- user/group don't assigne to nothing for ramdisk-recovery

Change-Id: I71e517e1f4cb74b5493a50668823f3d43fa3c982
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agopackaging: add dnsmasq package as Requires 63/203663/1
Jaehoon Chung [Tue, 16 Apr 2019 11:00:35 +0000 (20:00 +0900)]
packaging: add dnsmasq package as Requires

Add dnsmasq package as Requires.
dnsmasq provides DHCP/DNS server role.
When client try to associate to AP, it will be assigned to client's ip
address.

Change-Id: I6c3cace46ff7e3df87ef212e772251968405a914
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agopackaging: include hostapd config file 62/203662/1
Jaehoon Chung [Tue, 16 Apr 2019 10:58:06 +0000 (19:58 +0900)]
packaging: include hostapd config file

To use hostapd, include hostapd config file under /usr/lib/firmware/brcm.

Change-Id: I1a26796c6ff4ab1b1da7014c38c440151027aa31
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agopackaging: add wpa_supplicant as Requires 61/203661/1
Jaehoon Chung [Mon, 15 Apr 2019 02:27:20 +0000 (11:27 +0900)]
packaging: add wpa_supplicant as Requires

Add wpa_supplicant as Requires.
wpa_supplicant package provides hostapd.
To use RPI3 as AP mode, it needs to include hostpad in image.

Change-Id: I937aad2e12d049f72789d61632f6f170fb1af287
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agoscripts: flash-init: enable wlan interface 98/203398/3
Jaehoon Chung [Fri, 12 Apr 2019 07:39:08 +0000 (16:39 +0900)]
scripts: flash-init: enable wlan interface

Add scripts to enable wlan interface.
- Copy .ko files from module partition.
- insmod module image with firmware files.
- wlan0 interface up

Change-Id: I67ffbcc70e26c504a72b3513546c6bfa60546ed9
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agopackaging: spec: add module-init-tools as Requires 97/203397/3
Jaehoon Chung [Fri, 12 Apr 2019 07:26:33 +0000 (16:26 +0900)]
packaging: spec: add module-init-tools as Requires

module-init-tools is provieded commands likes lsmod, insmod, etc.
To enable WiFi device, it needs to include them in image.

Change-Id: Ic4603deb3489ba30582579b839d3a69323f6caa9
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agopackaging: spec: copy broadcom firmware files into image 96/203396/3
Jaehoon Chung [Fri, 12 Apr 2019 07:08:02 +0000 (16:08 +0900)]
packaging: spec: copy broadcom firmware files into image

Copy broadcom firmware files into ramdisk-recovery image.

Change-Id: I043728ff8cb7fbaa4c8065542b51fd712aee1317
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agodata: add broadcom open firmware file and license file 95/203395/3
Jaehoon Chung [Fri, 12 Apr 2019 06:26:51 +0000 (15:26 +0900)]
data: add broadcom open firmware file and license file

Add broadcom opne firmware file and license file for rpi3.
These firmwares take from below url.
- https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

Change-Id: I59fc2ca1e9f28b89afe0a398b1f359a69d088f04
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
5 years agoAdd grep into the list for ramdisk-recovery creation 80/202480/1 accepted/tizen/unified/20190401.225006 submit/tizen/20190329.061322
Dongwoo Lee [Fri, 29 Mar 2019 02:15:42 +0000 (11:15 +0900)]
Add grep into the list for ramdisk-recovery creation

'grep' is used for parsing the current IP address, but grep is not
presented in ramdisk-recovery image basically. To this end, this adds
grep into the list for ramdisk-recovery image creation.

Change-Id: Id208ef8e9dde428daf2ded22a3e0fc0d8dec8610
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoRefactor file download mode 93/201093/1 tizen_5.0 accepted/tizen/unified/20190315.061232 submit/tizen/20190314.014942 submit/tizen_5.0/20190319.011148
Dongwoo Lee [Fri, 8 Mar 2019 07:16:39 +0000 (16:16 +0900)]
Refactor file download mode

To fix the problem of file download mode, and to improve error
handling of mount/unmount operation, this patch refactors file
download mode.

Change-Id: I2df4378bc00181632f1399833221a182a6c4407b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoCheck failure of network configuration 04/200104/4 accepted/tizen/unified/20190307.231038 submit/tizen/20190222.054942 submit/tizen/20190306.092244 submit/tizen_5.0/20190306.065358
Dongwoo Lee [Tue, 19 Feb 2019 06:55:53 +0000 (15:55 +0900)]
Check failure of network configuration

If network configuration is failed due to some reason, tfm cannot be
proceeded. In this case, reboot the system to retry  when network setup
fails.

Change-Id: Idb615fb455ea2af9226c5caf395e1a06bb94e954
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoPrint out progress status 03/200103/3
Dongwoo Lee [Tue, 12 Feb 2019 04:36:40 +0000 (13:36 +0900)]
Print out progress status

To print out the information about transfer progress and
synchronization state, the additional messages will be added.

Change-Id: I931700c5c9bc88267d656d2ac02b111f1275fa29
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoCorrect dfu thread state 02/200102/3
Dongwoo Lee [Fri, 1 Feb 2019 05:57:35 +0000 (14:57 +0900)]
Correct dfu thread state

There is no need to unlock to change dfu state, this patch removes
lock/unlock between dfu state change. Also, some missing state change
is applied either.

Change-Id: I15215504bc4c2d7ca407285822d2508fe09b5a25
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoUnmount inform partition to clear reboot-param.bin explicitly 01/200101/4
Dongwoo Lee [Thu, 10 Jan 2019 06:27:22 +0000 (15:27 +0900)]
Unmount inform partition to clear reboot-param.bin explicitly

Before synchronizing changes on reboot-param.bin for clear boot
parameter, flash-manager can be rebooted by fatal errors and thus
the target re-enters download mode unintendly. To prevent this,
unmount inform partition right after clearing parameter file.

Change-Id: Ibd5dc72f31cb6b869d7164185ff1a894d615fc47
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoRemove user-level ip configuration 14/196614/1 accepted/tizen/unified/20190104.061230 submit/tizen/20190102.221308 submit/tizen/20190103.040758 submit/tizen_5.0/20190103.041413 submit/tizen_5.0/20190110.063209
Dongwoo Lee [Thu, 27 Dec 2018 04:25:26 +0000 (13:25 +0900)]
Remove user-level ip configuration

Since rpi u-boot can support ip configuration thorugh kernel itself,
user-level configuration is no more needed. Since this patch, just
prints out to inform IP address to user which is configured by kernel.

Change-Id: I92cff85c050119af4b3706b802a1df956967a80f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoUpdate partition info file 92/196492/2 submit/tizen/20190102.053705
Dongwoo Lee [Mon, 31 Dec 2018 07:59:08 +0000 (16:59 +0900)]
Update partition info file

To support dtb files, all dtbs are included. In addition, to specify
the board, now partition file has the name of the board as prefix.

Change-Id: I1278108ac90ce2d6b5e3f93c05fd1b9048f3abe8
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoUse static partition node 50/196050/5
Dongwoo Lee [Fri, 21 Dec 2018 04:05:33 +0000 (13:05 +0900)]
Use static partition node

Label-based search for target partition node cannot be successfully
proceed for all cases. So, this patch removes label-based search,
and adds static partition node to information file to be used for
target partition node.

Change-Id: I2636ddabe9ea46f916d0faa4dd02a7a5bed3242a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoImprove dfu thread state for safe exit 62/195662/2
Dongwoo Lee [Mon, 10 Dec 2018 07:48:43 +0000 (16:48 +0900)]
Improve dfu thread state for safe exit

To acomplish exit process safely when tfm fails to flash image, this
patch improves dfu thread state. Since this, dfu thread could be
canceled only when flashing is not proceed to protect the target.

Change-Id: I7c1b50520ec6b70a51afe2af222d7449022fdbed
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoClean up file list for ramdisk-recovery image creation 63/195663/2
Dongwoo Lee [Fri, 7 Dec 2018 00:48:28 +0000 (09:48 +0900)]
Clean up file list for ramdisk-recovery image creation

This patch changes the action of file list properly, and removes
unnecessary entries.

Change-Id: Ib856faa87dc1c506ce5c17d91b3a6d0277088bd6
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoFix partition search for ramdisk-recovery image 78/195978/1
Dongwoo Lee [Thu, 20 Dec 2018 07:34:43 +0000 (16:34 +0900)]
Fix partition search for ramdisk-recovery image

Since ramdisk-recovery.img is mounted on memory space and it also has
the same label with physical partition, the target partition could be
wrong if the ram-mounted partition is searched first. To resolve it,
this fixes partition search as excepting the devices including 'ram'
on its node name.

Change-Id: I15b6124eb202f0c5ddbe8ca518bfcc892309aa9a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
6 years agoRemove unnecessary conditional statement in CMakeList.txt 50/192150/1 accepted/tizen_5.0_unified accepted/tizen/5.0/unified/20181217.141949 accepted/tizen/unified/20181107.081814 submit/tizen/20181102.055037 submit/tizen_5.0/20181107.081820 submit/tizen_5.0/20181214.082247
Dongwoo [Wed, 31 Oct 2018 02:19:53 +0000 (11:19 +0900)]
Remove unnecessary conditional statement in CMakeList.txt

To resolve asan build error, unnecessary conditional statement
for adding linker option will be removed from CMakeList.

Change-Id: I94da35d24280653527b652da77f645549b088c4e
Signed-off-by: Dongwoo <dwoo08.lee@samsung.com>
6 years agoFix error path of main thread with freeing allocated buffer 02/190802/3 accepted/tizen/5.0/unified/20181102.021321 accepted/tizen/unified/20181011.095115 submit/tizen/20181010.051409 submit/tizen_5.0/20181101.000004
Seung-Woo Kim [Fri, 5 Oct 2018 09:46:41 +0000 (18:46 +0900)]
Fix error path of main thread with freeing allocated buffer

There can be memory leak for strdup(). Fix error path of main
thread with freeing allocated buffer.

Change-Id: I292d66d8b9f5c857a692f35a9867d221dabb6a7d
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoCheck whether creating temporary directory is success or not 97/190797/1
Seung-Woo Kim [Fri, 5 Oct 2018 09:16:29 +0000 (18:16 +0900)]
Check whether creating temporary directory is success or not

There is no checking created temporary directory. Check whether
creating is success of not.

Change-Id: I499d34487659f8d3b83b706c98d8fa8d8e5f3251
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoFix to convert variable type explicitly 06/190606/4
Dongwoo [Thu, 4 Oct 2018 01:22:47 +0000 (10:22 +0900)]
Fix to convert variable type explicitly

This patch resolves svace warnings "SIGNED_TO_BIGGER_UNSIGNED", which
means assignment of a signed value which has type int(void*) to a
variable of a bigger integer type uint64_t.

Change-Id: Icb9576641a41f695272d61fd1f0847884b865935
Signed-off-by: Dongwoo <dwoo08.lee@samsung.com>
6 years agoFix build warnings with -Wformat 12/190612/2
Seung-Woo Kim [Thu, 4 Oct 2018 06:22:50 +0000 (15:22 +0900)]
Fix build warnings with -Wformat

There are build warnings with -Wformat for printing format for
size_t and ssize_t. Fix the build warnings with profer formats.

Change-Id: I82f50c8541b9bc4ffba36f01b0c84eb89e04c12b
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoFix wrong check of empty queue 32/190632/2
Dongwoo [Thu, 4 Oct 2018 08:40:07 +0000 (17:40 +0900)]
Fix wrong check of empty queue

This patch resolves svace warnings "DEREF_OF_NULL", which means that can
have only NULL value. Even it is false positive, the condition is also
wrong because it should continue iteration if queue is not empty.

Change-Id: I445463c9ef4522e3e58923fbcbda01d0ce606dcc
Signed-off-by: Dongwoo <dwoo08.lee@samsung.com>
6 years agoRecognize partition device name by blkid label 81/188081/5 accepted/tizen/unified/20180918.152300 submit/devel/20180917.094703 submit/tizen/20180917.095112
Dongwoo Lee [Fri, 25 May 2018 00:15:30 +0000 (09:15 +0900)]
Recognize partition device name by blkid label

In certain case, target board can have different device name for
storage. So, static device name cannot be applicable for all cases.
This patch gets device name from blkid information within target
storage instead of static information in partition table.

Change-Id: I171fa8d5da79ea815b1acdef438908849a37861b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
6 years agoAdd pre-defined partition information for RPI3 80/188080/3
Dongwoo Lee [Tue, 15 May 2018 02:14:45 +0000 (11:14 +0900)]
Add pre-defined partition information for RPI3

The partition information about RPI3 will be added. This inforamation
is retrieved from sd_fusing script in RPI3 kernel repository.

Change-Id: Iac335daf5c285264c8d73a21c616035373028a5b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
6 years agoAdd script for enabling flash-manager for ramdisk-recovery image 79/188079/3
Dongwoo Lee [Mon, 16 Apr 2018 02:24:01 +0000 (11:24 +0900)]
Add script for enabling flash-manager for ramdisk-recovery image

This patch adds scripts for creating ramdisk partition image. The
script will be executed while MIC builds ramdisk image as copying
list of required files for building ramdisk-recovery image.

Change-Id: I63ac7dcde55df26217de46f9bfab63dd1faebb7f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
6 years agoAdd initial implementation of network backend 78/188078/3
Dongwoo Lee [Thu, 2 Nov 2017 21:33:17 +0000 (06:33 +0900)]
Add initial implementation of network backend

This is initial version of flash-manager with network backend. The
entire structure would be evolved while the new feature is added.

Change-Id: I659c2795d339060afada9a9ffd5f41294c17f228
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
6 years agoCreate spec file for RPM package 42/179042/1
Dongwoo Lee [Mon, 16 Apr 2018 01:45:17 +0000 (10:45 +0900)]
Create spec file for RPM package

This patch creates files required to build the RPM package. Althogh it
is possible to build the package, only one empty RPM file would be
created since source files are not implemented yet.

Change-Id: Ie3ce70a8c2b00b9aaa88610bcdfdcf9384daa06d
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
6 years agoInitial empty repository master
Tizen Infrastructure [Wed, 9 May 2018 09:49:30 +0000 (09:49 +0000)]
Initial empty repository