To make the HTC Desire boot from a 1gb file on your SD-card:
Instead of having to partition the SD-card to make this work,there is another solution; that is to make a "virtual" EXT2 partition as a file on the FAT32 partition.
You can make this file as big as you want. 1gb is a fitting size though. .. you will probably need a linux box to make this work.... The file has to be called altboot.ext2 and lie at the root of the SD-card
NOTE: The initfiles and the modified kernel in this guide is 2.6.32 ONLY. I understood this may be an inconvenience for some. This kernel also disabled the "Android Paranoid Networking" feature, which is a useless pain-in-the-ass feature.
1. To make a 1GB empty file, issue dd if=/dev/zero of=altboot.ext2 bs=1M count=1000
2. Make a EXT2 filesystem on the file: mkfs.ext2 altboot.ext2
3. Mount the file as a loopdevice: mount -o loop -t ext2 altboot.ext2 <mountpoint>
4. Copy files from the attached initfiles.zip to <mountpoint>
5. Copy all files from a rom of your choice to <mountpoint>
6. Issue a chmod -R 0755 <mountpoint>
7. Issue umount <mountpoint>
8. Copy altboot.ext2 to the root of the SD-card
9. Flash my kernel image
10. Reboot your phone, and press the Home key repeatedly
Good luck
The source code changes for this kernel can be found at http://github.com/gr0gmint/kernel_msm
(Here is the source code for the two "special" init files)
executable in the ramdisk:
executable on the SD-card:
Instead of having to partition the SD-card to make this work,there is another solution; that is to make a "virtual" EXT2 partition as a file on the FAT32 partition.
You can make this file as big as you want. 1gb is a fitting size though. .. you will probably need a linux box to make this work.... The file has to be called altboot.ext2 and lie at the root of the SD-card
NOTE: The initfiles and the modified kernel in this guide is 2.6.32 ONLY. I understood this may be an inconvenience for some. This kernel also disabled the "Android Paranoid Networking" feature, which is a useless pain-in-the-ass feature.
1. To make a 1GB empty file, issue dd if=/dev/zero of=altboot.ext2 bs=1M count=1000
2. Make a EXT2 filesystem on the file: mkfs.ext2 altboot.ext2
3. Mount the file as a loopdevice: mount -o loop -t ext2 altboot.ext2 <mountpoint>
4. Copy files from the attached initfiles.zip to <mountpoint>
5. Copy all files from a rom of your choice to <mountpoint>
6. Issue a chmod -R 0755 <mountpoint>
7. Issue umount <mountpoint>
8. Copy altboot.ext2 to the root of the SD-card
9. Flash my kernel image
10. Reboot your phone, and press the Home key repeatedly
Good luck
The source code changes for this kernel can be found at http://github.com/gr0gmint/kernel_msm
(Here is the source code for the two "special" init files)
executable in the ramdisk:
Code:
#include <unistd.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <linux/loop.h>
#include <fcntl.h>
#define BB_LOOP_SET_STATUS LOOP_SET_STATUS64
#define BB_LOOP_GET_STATUS LOOP_GET_STATUS64
typedef struct loop_info64 loop_info;
int main (int argc, char * argv[]) {
int dfd,ffd;
loop_info loopinfo;
mknod("/sd2" , S_IFBLK|S_IRUSR| S_IWUSR, makedev(179,1) );
mknod("/lo5" , S_IFBLK|S_IRUSR| S_IWUSR, makedev(7,5) );
mkdir("/sd", 0755);
sleep(7);
mount("/sd2","/sd", "vfat",0, NULL) ;
ffd = open("/sd/altboot.ext2", O_RDWR);
dfd = open("/lo5", O_RDWR);
ioctl(dfd, LOOP_SET_FD, ffd);
memset(&loopinfo, 0, sizeof(loopinfo));
strcpy((char *)loopinfo.lo_file_name, "/sd/altboot.ext2");
ioctl(dfd, BB_LOOP_SET_STATUS, &loopinfo);
mkdir("/chrootenv", 0755);
if (mount("/lo5", "/chrootenv","ext2", 0, NULL) != 0 ) {
execv("/init", argv);
}
execv("/chrootenv/altinit", argv);
}
executable on the SD-card:
Code:
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/mount.h>
int main (int argc, char * argv[]) {
if (chroot("/chrootenv/") == 0) {
chdir("/");
execv ("/init", argv);
}
}
Attachments
Last edited: