How to unpack .pak files and then repack them on Linux?

11,342 views
Skip to first unread message

Crammo Crammowski

unread,
Jun 9, 2012, 3:32:31 AM6/9/12
to chromi...@chromium.org
I want to add something to incognito newtab, so I need to unpack resources.pak. But how to do it?

Robert Flack

unread,
Jun 9, 2012, 9:46:45 AM6/9/12
to cra...@gmail.com, chromi...@chromium.org

I don't believe there are tools in the chrome tree for doing so but the file format is fairly simple:

4 byte version number
4 byte number of resources
1 byte encoding

For each resource:
2 byte resource id
4 byte resource offset in file

There is an extra resource entry at the end with ID 0 giving the end of the last resource (which is essentially the length of the file).

After these resource entries the raw file data is written for each file. You can see the file ui/base/resource/data_pack_literal.cc in the chromium source tree for a couple commented example resource files.

On Jun 9, 2012 3:32 AM, "Crammo Crammowski" <cra...@gmail.com> wrote:
I want to add something to incognito newtab, so I need to unpack resources.pak. But how to do it?

--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Evan Martin

unread,
Jun 10, 2012, 7:30:41 PM6/10/12
to cra...@gmail.com, chromi...@chromium.org
This python module can unpack and repack files:
http://code.google.com/searchframe#OAMlx_jo-ck/src/tools/grit/grit/format/data_pack.py&exact_package=chromium&ct=rc&cd=3&q=data_pack

On Sat, Jun 9, 2012 at 12:32 AM, Crammo Crammowski <cra...@gmail.com> wrote:
> I want to add something to incognito newtab, so I need to unpack
> resources.pak. But how to do it?
>

Paweł Hajdan, Jr.

unread,
Jun 11, 2012, 10:26:27 AM6/11/12
to cra...@gmail.com, chromi...@chromium.org
Why not start with a source tree checkout, make a patch there, and use the regular build process to build .paks?

On Sat, Jun 9, 2012 at 9:32 AM, Crammo Crammowski <cra...@gmail.com> wrote:
I want to add something to incognito newtab, so I need to unpack resources.pak. But how to do it?

--

李少杰

unread,
Apr 14, 2013, 11:34:42 PM4/14/13
to chromi...@chromium.org
modify the ReadDataPack function in data_pack.py, you can write resource data to files while reading them.
my version here:http://blog.csdn.net/jokers_i/article/details/8802352

在 2012年6月9日星期六UTC+8下午3时32分31秒,Crammo Crammowski写道:
Reply all
Reply to author
Forward
0 new messages