RPM jffs2 issue

If you want to cross-compile RPM Package Manager for Beagleboard C4 or some other board which uses NAND flash with JFFS2 please note there is an issue with RPM on JFFS2:

rpm -ihvv .rpm D: pool fd:    created size 464 limit -1 flags 0 D: pool ts:    created size 888 limit -1 flags 0 D: pool gi:    created size 88 limit -1 flags 0 D: pool dig:   created size 256 limit -1 flags 0 D: pool h:     created size 240 limit -1 flags 0 D: Expected size:     1363757 = lead(96)+sigs(180)+pad(4)+data(1363477) D:  Actual size:      1363757 D: .rpm: Header SHA1 digest: OK (f72871f5a1658152ec7db2dcda967b1d41325e7b) D: pool te:    created size 216 limit -1 flags 0 D: pool ds:    created size 124 limit -1 flags 0 D: pool fi:    created size 320 limit -1 flags 0 D: pool db:    created size 208 limit -1 flags 0 D: opening db environment /var/lib/rpm/Packages auto_commit:create:cdb rpmdb: mmap: Invalid argument D: opening db environment /var/lib/rpm/Packages auto_commit:create:cdb rpmdb: mmap: Invalid argument error: db4 error(22) from dbenv->open: Invalid argument D: opening db index       /var/lib/rpm/Packages create mode=0x0 error: cannot open Packages(0) index using db3 - Invalid argument (22) error: cannot open Packages database in /var/lib/rpm D: pool ps:    created size 20 limit -1 flags 0 D: pool tsi:   created size 24 limit -1 flags 0 D: ========== recording tsort relations D: ========== tsorting packages (order, #predecessors, #succesors, tree, Ldepth, Rbreadth) D:    0    0    0    1    0    0 +Bsc-arm_20101209-embedded.arm D: pool gi:    reused 0, alloc'd 1, free'd 1 items. D: pool tsi:   reused 11, alloc'd 1, free'd 1 items. D: pool ts:    reused 0, alloc'd 1, free'd 1 items. D: pool te:    reused 0, alloc'd 1, free'd 1 items. D: pool ps:    reused 0, alloc'd 1, free'd 1 items. D: pool ds:    reused 0, alloc'd 5, free'd 5 items. D: pool fi:    reused 0, alloc'd 1, free'd 1 items. D: pool db:    reused 0, alloc'd 1, free'd 1 items. D: pool h:     reused 0, alloc'd 2, free'd 2 items. D: pool dig:   reused 0, alloc'd 1, free'd 1 items. D: pool fd:    reused 1, alloc'd 1, free'd 1 items.

rpm -vv --initdb D: pool fd:    created size 464 limit -1 flags 0 D: pool ts:    created size 888 limit -1 flags 0 D: pool db:    created size 208 limit -1 flags 0 D: opening db environment /var/lib/rpm/Packages auto_commit:cdb rpmdb: mmap: Invalid argument D: opening db environment /var/lib/rpm/Packages auto_commit:create:cdb rpmdb: mmap: Invalid argument error: db4 error(22) from dbenv->open: Invalid argument D: opening db index       /var/lib/rpm/Packages create mode=0x42 error: cannot open Packages(0) index using db3 - Invalid argument (22) D: pool tsi:   created size 24 limit -1 flags 0 D: pool tsi:   reused 1, alloc'd 1, free'd 1 items. D: pool ts:    reused 0, alloc'd 1, free'd 1 items. D: pool db:    reused 0, alloc'd 1, free'd 1 items. D: pool fd:    reused 0, alloc'd 1, free'd 1 items.

rpm -vv --rebuilddb D: pool fd:    created size 464 limit -1 flags 0 D: pool ts:    created size 888 limit -1 flags 0 D: pool db:    created size 208 limit -1 flags 0 D: opening db environment /var/lib/rpm/Packages auto_commit:cdb rpmdb: mmap: Invalid argument D: opening db environment /var/lib/rpm/Packages auto_commit:create:cdb rpmdb: mmap: Invalid argument error: db4 error(22) from dbenv->open: Invalid argument D: opening db index       /var/lib/rpm/Packages rdonly mode=0x0 error: cannot open Packages(0) index using db3 - Invalid argument (22) error: cannot open Packages database in /var/lib/rpm D: pool tsi:   created size 24 limit -1 flags 0 D: pool tsi:   reused 1, alloc'd 1, free'd 1 items. D: pool ts:    reused 0, alloc'd 1, free'd 1 items. D: pool db:    reused 0, alloc'd 1, free'd 1 items. D: pool fd:    reused 0, alloc'd 1, free'd 1 items.

In order to deal with this issue please create /etc/rpm/macros.rpmdb file with the next line:

%__dbi_cdb create private nommap txn