3.) re-packing system.img (NOT ok)
further following the instructions i grab yaffs2 and the android_filesystem_config.h and applied the .diff. (so this is primed for chunkSize = 4096 and
spareSize = 128 too.)
The 'make' gives a lot of warnings but no 'error'
so...
Instructions:
we will make a mkyaffs2image binary for the old firmware since i cant check at all if the HY variant works.
If you never cloned a .git repository before use the Terminal Window and enter:
'sudo apt-get install git' (give password, confirm, lean back...)
change into a directory where you want the next batch of files we will be toying with.
input 'git clone git://android.git.kernel.org/platform/external/yaffs2.git'
now you have a 'yaffs2' directory where you just have been.
change into that and the 2nd yaffs2 directory under that too.
The "yaffs2-android-git.diff" must be inside this directory. (if you want a HY version you need to open the .diff file and change the chunk and spare size to the values mentioned in the unyaffs part)
the linked "android_filesystem_config.h" must be inside the 'utils' directory.
the contens of the "android_filesystem_config.h" has no leading numbers! it looks like this:
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* This file is used to define the properties of the filesystem
** images generated by build tools (mkbootfs and mkyaffs2image) and
** by the device side of adb.
*/
#ifndef _ANDROID_FILESYSTEM_CONFIG_H_
#define _ANDROID_FILESYSTEM_CONFIG_H_
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
/* This is the master Users and Groups config for the platform.
** DO NOT EVER RENUMBER.
*/
#define AID_ROOT 0 /* traditional unix root user */
#define AID_SYSTEM 1000 /* system server */
#define AID_RADIO 1001 /* telephony subsystem, RIL */
#define AID_BLUETOOTH 1002 /* bluetooth subsystem */
#define AID_GRAPHICS 1003 /* graphics devices */
#define AID_INPUT 1004 /* input devices */
#define AID_AUDIO 1005 /* audio devices */
#define AID_CAMERA 1006 /* camera devices */
#define AID_LOG 1007 /* log devices */
#define AID_COMPASS 1008 /* compass device */
#define AID_MOUNT 1009 /* mountd socket */
#define AID_WIFI 1010 /* wifi subsystem */
#define AID_ADB 1011 /* android debug bridge (adbd) */
#define AID_INSTALL 1012 /* group for installing packages */
#define AID_MEDIA 1013 /* mediaserver process */
#define AID_DHCP 1014 /* dhcp client */
#define AID_SDCARD_RW 1015 /* external storage write access */
#define AID_VPN 1016 /* vpn system */
#define AID_KEYSTORE 1017 /* keystore subsystem */
#define AID_USB 1018 /* USB devices */
#define AID_DRM 1019 /* DRM server */
#define AID_DRMIO 1020 /* DRM IO server */
#define AID_GPS 1021 /* GPS daemon */
#define AID_NFC 1022 /* nfc subsystem */
#define AID_SHELL 2000 /* adb and debug shell user */
#define AID_CACHE 2001 /* cache access */
#define AID_DIAG 2002 /* access to diagnostic resources */
/* The 3000 series are intended for use as supplemental group id's only.
* They indicate special Android capabilities that the kernel is aware of. */
#define AID_NET_BT_ADMIN 3001 /* bluetooth: create any socket */
#define AID_NET_BT 3002 /* bluetooth: create sco, rfcomm or l2cap sockets */
#define AID_INET 3003 /* can create AF_INET and AF_INET6 sockets */
#define AID_NET_RAW 3004 /* can create raw INET sockets */
#define AID_NET_ADMIN 3005 /* can configure interfaces and routing tables. */
#define AID_MISC 9998 /* access to misc storage */
#define AID_NOBODY 9999
#define AID_APP 10000 /* first app user */
#if !defined(EXCLUDE_FS_CONFIG_STRUCTURES)
struct android_id_info {
const char *name;
unsigned aid;
};
static const struct android_id_info android_ids[] = {
{ "root", AID_ROOT, },
{ "system", AID_SYSTEM, },
{ "radio", AID_RADIO, },
{ "bluetooth", AID_BLUETOOTH, },
{ "graphics", AID_GRAPHICS, },
{ "input", AID_INPUT, },
{ "audio", AID_AUDIO, },
{ "camera", AID_CAMERA, },
{ "log", AID_LOG, },
{ "compass", AID_COMPASS, },
{ "mount", AID_MOUNT, },
{ "wifi", AID_WIFI, },
{ "dhcp", AID_DHCP, },
{ "adb", AID_ADB, },
{ "install", AID_INSTALL, },
{ "media", AID_MEDIA, },
{ "drm", AID_DRM, },
{ "drmio", AID_DRMIO, },
{ "nfc", AID_NFC, },
{ "shell", AID_SHELL, },
{ "cache", AID_CACHE, },
{ "diag", AID_DIAG, },
{ "net_bt_admin", AID_NET_BT_ADMIN, },
{ "net_bt", AID_NET_BT, },
{ "sdcard_rw", AID_SDCARD_RW, },
{ "vpn", AID_VPN, },
{ "keystore", AID_KEYSTORE, },
{ "usb", AID_USB, },
{ "gps", AID_GPS, },
{ "inet", AID_INET, },
{ "net_raw", AID_NET_RAW, },
{ "net_admin", AID_NET_ADMIN, },
{ "misc", AID_MISC, },
{ "nobody", AID_NOBODY, },
};
#define android_id_count
(sizeof(android_ids) / sizeof(android_ids[0]))
struct fs_path_config {
unsigned mode;
unsigned uid;
unsigned gid;
const char *prefix;
};
/* Rules for directories.
** These rules are applied based on "first match", so they
** should start with the most specific path and work their
** way up to the root.
*/
static struct fs_path_config android_dirs[] = {
{ 00770, AID_SYSTEM, AID_CACHE, "cache" },
{ 00771, AID_SYSTEM, AID_SYSTEM, "data/app" },
{ 00771, AID_SYSTEM, AID_SYSTEM, "data/app-private" },
{ 00771, AID_SYSTEM, AID_SYSTEM, "data/dalvik-cache" },
{ 00771, AID_SYSTEM, AID_SYSTEM, "data/data" },
{ 00771, AID_SHELL, AID_SHELL, "data/local/tmp" },
{ 00771, AID_SHELL, AID_SHELL, "data/local" },
{ 01771, AID_SYSTEM, AID_MISC, "data/misc" },
{ 00770, AID_DHCP, AID_DHCP, "data/misc/dhcp" },
{ 00771, AID_SYSTEM, AID_SYSTEM, "data" },
{ 00750, AID_ROOT, AID_SHELL, "sbin" },
{ 00755, AID_ROOT, AID_SHELL, "system/bin" },
{ 00755, AID_ROOT, AID_SHELL, "system/vendor" },
{ 00755, AID_ROOT, AID_SHELL, "system/xbin" },
{ 00755, AID_ROOT, AID_ROOT, "system/etc/ppp" },
{ 00777, AID_ROOT, AID_ROOT, "sdcard" },
{ 00755, AID_ROOT, AID_ROOT, 0 },
};
/* Rules for files.
** These rules are applied based on "first match", so they
** should start with the most specific path and work their
** way up to the root. Prefixes ending in * denotes wildcard
** and will allow partial matches.
*/
static struct fs_path_config android_files[] = {
{ 00440, AID_ROOT, AID_SHELL, "system/etc/init.goldfish.rc" },
{ 00550, AID_ROOT, AID_SHELL, "system/etc/init.goldfish.sh" },
{ 00440, AID_ROOT, AID_SHELL, "system/etc/init.trout.rc" },
{ 00550, AID_ROOT, AID_SHELL, "system/etc/init.ril" },
{ 00550, AID_ROOT, AID_SHELL, "system/etc/init.testmenu" },
{ 00550, AID_DHCP, AID_SHELL, "system/etc/dhcpcd/dhcpcd-run-hooks" },
{ 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/dbus.conf" },
{ 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/main.conf" },
{ 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/input.conf" },
{ 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/audio.conf" },
{ 00444, AID_NET_BT, AID_NET_BT, "system/etc/bluetooth/blacklist.conf" },
{ 00640, AID_SYSTEM, AID_SYSTEM, "system/etc/bluetooth/auto_pairing.conf" },
{ 00444, AID_RADIO, AID_AUDIO, "system/etc/AudioPara4.csv" },
{ 00555, AID_ROOT, AID_ROOT, "system/etc/ppp/*" },
{ 00555, AID_ROOT, AID_ROOT, "system/etc/rc.*" },
{ 00644, AID_SYSTEM, AID_SYSTEM, "data/app/*" },
{ 00644, AID_SYSTEM, AID_SYSTEM, "data/app-private/*" },
{ 00644, AID_APP, AID_APP, "data/data/*" },
/* the following two files are INTENTIONALLY set-gid and not set-uid.
* Do not change. */
{ 02755, AID_ROOT, AID_NET_RAW, "system/bin/ping" },
{ 02750, AID_ROOT, AID_INET, "system/bin/netcfg" },
/* the following five files are INTENTIONALLY set-uid, but they
* are NOT included on user builds. */
{ 06755, AID_ROOT, AID_ROOT, "system/xbin/su" },
{ 06755, AID_ROOT, AID_ROOT, "system/xbin/librank" },
{ 06755, AID_ROOT, AID_ROOT, "system/xbin/procrank" },
{ 06755, AID_ROOT, AID_ROOT, "system/xbin/procmem" },
{ 06755, AID_ROOT, AID_ROOT, "system/xbin/tcpdump" },
{ 04770, AID_ROOT, AID_RADIO, "system/bin/pppd-ril" },
/* the following file is INTENTIONALLY set-uid, and IS included
* in user builds. */
{ 06750, AID_ROOT, AID_SHELL, "system/bin/run-as" },
{ 00755, AID_ROOT, AID_SHELL, "system/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, "system/xbin/*" },
{ 00755, AID_ROOT, AID_SHELL, "system/vendor/bin/*" },
{ 00750, AID_ROOT, AID_SHELL, "sbin/*" },
{ 00755, AID_ROOT, AID_ROOT, "bin/*" },
{ 00750, AID_ROOT, AID_SHELL, "init*" },
{ 00644, AID_ROOT, AID_ROOT, 0 },
};
static inline void fs_config(const char *path, int dir,
unsigned *uid, unsigned *gid, unsigned *mode)
{
struct fs_path_config *pc;
int plen;
pc = dir ? android_dirs : android_files;
plen = strlen(path);
for(; pc->prefix; pc++){
int len = strlen(pc->prefix);
if (dir) {
if(plen < len) continue;
if(!strncmp(pc->prefix, path, len)) break;
continue;
}
/* If name ends in * then allow partial matches. */
if (pc->prefix[len -1] == '*') {
if(!strncmp(pc->prefix, path, len - 1)) break;
} else if (plen == len){
if(!strncmp(pc->prefix, path, len)) break;
}
}
*uid = pc->uid;
*gid = pc->gid;
*mode = (*mode & (~07777)) | pc->mode;
#if 0
fprintf(stderr,"< '%s' '%s' %d %d %o >n",
path, pc->prefix ? pc->prefix : "", *uid, *gid, *mode);
#endif
}
#endif
#endif
Now execute the Patch 'patch -p0 <yaffs2-android-git.diff'
you should get no errors while patching.
change into the 'utils' directory and execute 'make'
this should give you a lot of warnings but no error and when you are finished you should have two new files in the directory
mkyaffs2image and mkyaffsimage. we need only the first mentioned.
Here is the output while the 'make' runs for those wo know more about this:
test@test-VirtualBox:~/Downloads/yaffs2/yaffs2/utils$ make
ln -s ../yaffs_ecc.c yaffs_ecc.c
gcc -c -I/usr/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL -DCONFIG_YAFFS_DOES_ECC -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline yaffs_ecc.c -o yaffs_ecc.o
gcc -c -I/usr/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL -DCONFIG_YAFFS_DOES_ECC -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline mkyaffsimage.c -o mkyaffsimage.o
In file included from ../yaffs_guts.h:23,
from mkyaffsimage.c:34:
../devextras.h:210: warning: "DT_UNKNOWN" redefined
/usr/include/dirent.h:101: note: this is the location of the previous definition
../devextras.h:211: warning: "DT_FIFO" redefined
/usr/include/dirent.h:103: note: this is the location of the previous definition
../devextras.h:212: warning: "DT_CHR" redefined
/usr/include/dirent.h:105: note: this is the location of the previous definition
../devextras.h:213: warning: "DT_DIR" redefined
/usr/include/dirent.h:107: note: this is the location of the previous definition
../devextras.h:214: warning: "DT_BLK" redefined
/usr/include/dirent.h:109: note: this is the location of the previous definition
../devextras.h:215: warning: "DT_REG" redefined
/usr/include/dirent.h:111: note: this is the location of the previous definition
../devextras.h:216: warning: "DT_LNK" redefined
/usr/include/dirent.h:113: note: this is the location of the previous definition
../devextras.h:217: warning: "DT_SOCK" redefined
/usr/include/dirent.h:115: note: this is the location of the previous definition
../devextras.h:218: warning: "DT_WHT" redefined
/usr/include/dirent.h:117: note: this is the location of the previous definition
mkyaffsimage.c: In function process_directory:
mkyaffsimage.c:445: warning: ignoring return value of readlink, declared with attribute warn_unused_result
mkyaffsimage.c: At top level:
mkyaffsimage.c:119: warning: yaffs_CalcNameSum defined but not used
mkyaffsimage.c: In function write_chunk:
mkyaffsimage.c:231: warning: dereferencing pointer tags does break strict-aliasing rules
mkyaffsimage.c:230: warning: dereferencing pointer tags does break strict-aliasing rules
mkyaffsimage.c:229: warning: dereferencing pointer tags does break strict-aliasing rules
mkyaffsimage.c:228: warning: dereferencing pointer tags does break strict-aliasing rules
mkyaffsimage.c:227: warning: dereferencing pointer tags does break strict-aliasing rules
mkyaffsimage.c:226: warning: dereferencing pointer tags does break strict-aliasing rules
mkyaffsimage.c:225: warning: dereferencing pointer tags does break strict-aliasing rules
mkyaffsimage.c:224: warning: dereferencing pointer tags does break strict-aliasing rules
mkyaffsimage.c:209: note: initialized from here
mkyaffsimage.c: In function write_object_header:
mkyaffsimage.c:326: warning: array subscript is above array bounds
mkyaffsimage.c:326: warning: array subscript is above array bounds
mkyaffsimage.c:327: warning: array subscript is above array bounds
mkyaffsimage.c:327: warning: array subscript is above array bounds
gcc -o mkyaffsimage yaffs_ecc.o mkyaffsimage.o
gcc -c -I/usr/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL -DCONFIG_YAFFS_DOES_ECC -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline mkyaffs2image.c -o mkyaffs2image.o
In file included from ../yaffs_guts.h:23,
from mkyaffs2image.c:38:
../devextras.h:210: warning: "DT_UNKNOWN" redefined
/usr/include/dirent.h:101: note: this is the location of the previous definition
../devextras.h:211: warning: "DT_FIFO" redefined
/usr/include/dirent.h:103: note: this is the location of the previous definition
../devextras.h:212: warning: "DT_CHR" redefined
/usr/include/dirent.h:105: note: this is the location of the previous definition
../devextras.h:213: warning: "DT_DIR" redefined
/usr/include/dirent.h:107: note: this is the location of the previous definition
../devextras.h:214: warning: "DT_BLK" redefined
/usr/include/dirent.h:109: note: this is the location of the previous definition
../devextras.h:215: warning: "DT_REG" redefined
/usr/include/dirent.h:111: note: this is the location of the previous definition
../devextras.h:216: warning: "DT_LNK" redefined
/usr/include/dirent.h:113: note: this is the location of the previous definition
../devextras.h:217: warning: "DT_SOCK" redefined
/usr/include/dirent.h:115: note: this is the location of the previous definition
../devextras.h:218: warning: "DT_WHT" redefined
/usr/include/dirent.h:117: note: this is the location of the previous definition
In file included from mkyaffs2image.c:40:
../yaffs_tagsvalidity.h:23: warning: redundant redeclaration of yaffs_InitialiseTags
../yaffs_guts.h:891: note: previous declaration of yaffs_InitialiseTags was here
mkyaffs2image.c: In function process_directory:
mkyaffs2image.c:373: warning: ignoring return value of readlink, declared with attribute warn_unused_result
mkyaffs2image.c: In function write_object_header:
mkyaffs2image.c:195: warning: array subscript is above array bounds
mkyaffs2image.c:195: warning: array subscript is above array bounds
mkyaffs2image.c:196: warning: array subscript is above array bounds
mkyaffs2image.c:196: warning: array subscript is above array bounds
ln -s ../yaffs_packedtags2.c yaffs_packedtags2.c
gcc -c -I/usr/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL -DCONFIG_YAFFS_DOES_ECC -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline yaffs_packedtags2.c -o yaffs_packedtags2.o
In file included from yaffs_packedtags2.c:18:
../yaffs_tagsvalidity.h:23: warning: redundant redeclaration of yaffs_InitialiseTags
../yaffs_guts.h:891: note: previous declaration of yaffs_InitialiseTags was here
ln -s ../yaffs_tagsvalidity.c yaffs_tagsvalidity.c
gcc -c -I/usr/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL -DCONFIG_YAFFS_DOES_ECC -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline yaffs_tagsvalidity.c -o yaffs_tagsvalidity.o
In file included from yaffs_tagsvalidity.c:17:
../yaffs_tagsvalidity.h:23: warning: redundant redeclaration of yaffs_InitialiseTags
../yaffs_guts.h:891: note: previous declaration of yaffs_InitialiseTags was here
gcc -o mkyaffs2image yaffs_ecc.o mkyaffs2image.o yaffs_packedtags2.o yaffs_tagsvalidity.o
well, lets move this to the binarys:
'sudo mv mkyaffs2image /bin'
This will pack an entire directory into one yaffs2 file so remove everything you do not want in there before you pack it!
(for example the system.img itself you just unpacked)
usage: 'mkyaffs2image DIRECTORY_YOU_WANT_TO_PACK NEW_SYSTEM_IMAGE_TO_CREATE.img'
Well, doing this last step gives a file with the same size as the original but even if i do not change anything inside the directory the MD5 sums of the original and the new system.img are different.
4.) fusing the tcc8900_mtd.img back together. (ok)[/b]
Works well as long as you did not change the system.img

Instructions:
Well, if you made the tccpack in step 1.) you are all set.
have all your .img files together and
input: 'tccpack boot.img system.img recovery.img tcc8900_mtd.img'
if there is already a tcc8900_mtd.img it will be overwritten.
move it to a shared directory or USB stick, Mail it to you or upload it to an online hoster,
try it in FWDN... please dont brick your pad!
(use only files intended for your pad! especialy the boot.img!!!)
I hope you did not fall asleep while reading this and can take some limited use from this.
Have some fun! (and thank you fun_ for making all the tcc tools!

)