Navigation Menu

Skip to content

Commit

Permalink
"cyan plus one" -- button detection fixes, u-boot.altboot support, an…
Browse files Browse the repository at this point in the history
…d more

Changes:

* New Configuration Feature - Always Use Alternate Boot - this makes it more practical to put an overclocked kernel setup in uAltImg/uAltRam and make it the default boot option. The "u-boot.altboot" file works just like the "u-boot.device" file does. Put a "1" in /rom/u-boot.altboot in emmc p2 (/rom) and, unless manually overridden, you'll always load w/ the alternate boot option. (If for whatever reason a(n) uAltImg is not available on your boot device, it should automatically fallback to uImage/uRamdisk.)
Similar to u-boot.altboot, the "u-boot.device" file has been moved from /boot (p1 on either boot device) to /rom (p2 on *eMMC* only). If you were using j4mm3r's version or any version up to now, move the file to /rom.
* Updated menu text to reflect new configurations
* Improvement to button detection. Earlier versions did it 3 times. Last version got it down to two. This version got it down to 1.

see http://forum.xda-developers.com/showpost.php?p=14355206&postcount=2773 for details.
  • Loading branch information
fattire committed Jun 2, 2011
1 parent 13f14df commit c04152b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 35 deletions.
65 changes: 32 additions & 33 deletions common/main.c
Expand Up @@ -574,12 +574,8 @@ static void Encore_boot(void)
lcd_adjust_brightness(80);
bitmap_plot (864,140,0); //1008,133
boot_normal = 1;
// Now that they see a boot screen, give the user a chance to hold down keys
udelay(2000*1000);

// Now that they see a boot screen, give the user a chance to hold down keys
tps65921_keypad_keys_pressed(&key_pad);
if (gpio_pin_read(14)||key_pad&HOME_KEY||(key_pad&VOLUP_KEY && key_pad&VOLDN_KEY))
user_req = 1;
}
else{
if(charger_type){
Expand Down Expand Up @@ -695,10 +691,9 @@ static void Encore_boot(void)
char *mode_list[3] = {" Normal (uImage/uRamdisk) ", " Recovery (uRecImg/uRecRam) ", " Alternate (uAltImg/uAltRam) "};
int dev_idx = 0; int mode_idx = 0; int *idx;
lcd_is_enabled = 1;
if (user_req) {
tps65921_keypad_keys_pressed(&key_pad);
tps65921_keypad_keys_pressed(&key_pad);
if (key_pad&HOME_KEY && (gpio_pin_read(14)))
{ user_req=0; mode_idx = 1;
{ mode_idx = 1;
lcd_console_setpos(40, 25);
lcd_puts(" Booting into recovery..."); } // recovery boot
else if (key_pad&HOME_KEY && (!gpio_pin_read(14)))
Expand All @@ -707,28 +702,21 @@ static void Encore_boot(void)
lcd_puts(" Entering boot menu...");
udelay(1000*1000);} // use the menu
else if (key_pad&VOLUP_KEY && key_pad&VOLDN_KEY)
{ user_req = 0; mode_idx =2;
{ mode_idx =2;
lcd_console_setpos(40, 25);
lcd_puts("Booting into alternate..."); } // alt boot
else //they pressed buttons, but none of the above
{ user_req = 0; mode_idx=0;
else // none of the above
{
lcd_console_setpos(40, 25);
lcd_puts(" Booting normally...");
lcd_puts(" Loading...");
setenv("forcerecovery", "0");
setenv("customboot", "0");} // normal boot (keypress)
} else { // no keypress at all, no menu...
lcd_console_setpos(40, 25); // normal boot (no keypress)
lcd_puts(" Loading..."); // note this isn't very efficient
setenv("forcerecovery", "0");
setenv("customboot", "0");
}
setenv("customboot", "0"); } // normal boot (keypress)

if (user_req) {
// menu was selected...
if (user_req) { // menu was selected
lcd_clear (NULL, 1, 1, NULL);
lcd_console_setpos(0, 0);
lcd_puts(" Boot Options\n");
lcd_puts(" ------------\n\n");
lcd_puts(" Boot Menu\n");
lcd_puts(" -------------\n\n");
lcd_puts(" Boot Device :\n"); // row 3
lcd_puts(" Boot Mode :\n"); // row 4
lcd_puts("\n Boot Now\n"); //row 6
Expand All @@ -739,26 +727,37 @@ static void Encore_boot(void)
lcd_puts(" VOL+ moves up.\n");
lcd_puts(" HOME toggles your selection.\n");
lcd_puts("\n\n\n\n\n\n WHAT IS ALTERNATE BOOT?\n\n");
lcd_puts(" It's an option to boot using an alternative kernel and ramdisk.\n");
lcd_puts(" It can be used for overclocked kernels or secondary OS boots.\n\n");
lcd_puts(" To enable, add to the first partition of your boot volume:\n\n");
lcd_puts(" Cyanogenmod now includes an overclocked (and slightly overvolted)\n");
lcd_puts(" kernel w/ accompanying ramdisk image. The files for this alternate\n");
lcd_puts(" boot are in the 1st (/boot) partition of your boot device:\n\n");
lcd_console_setcolor(CONSOLE_COLOR_GRAY, CONSOLE_COLOR_BLACK);
lcd_puts(" uAltImg");
lcd_console_setcolor(CONSOLE_COLOR_CYAN, CONSOLE_COLOR_BLACK);
lcd_puts(" -- (the alternate kernel)\n");
lcd_console_setcolor(CONSOLE_COLOR_GRAY, CONSOLE_COLOR_BLACK);
lcd_puts(" uAltRam");
lcd_console_setcolor(CONSOLE_COLOR_CYAN, CONSOLE_COLOR_BLACK);
lcd_puts(" -- (the alternate ramdisk)\n\n");
lcd_puts(" Without these files, the Alt. option will result in a failed boot.");
lcd_puts("\n\n\n CAN I SET A DEFAULT BOOT DEVICE?\n\n");
lcd_puts(" Yes. You may set the default boot device by creating a file:\n\n");
lcd_puts(" -- (the alternate ramdisk)");
lcd_puts("\n\n\n CAN I SET MY DEFAULT BOOT TO ALWAYS USE ALTERNATE BOOT?\n\n");
lcd_puts(" Yes, by creating a file:\n\n");
lcd_console_setcolor(CONSOLE_COLOR_GRAY, CONSOLE_COLOR_BLACK);
lcd_puts(" u-boot.altboot\n\n");
lcd_console_setcolor(CONSOLE_COLOR_CYAN, CONSOLE_COLOR_BLACK);
lcd_puts(" Put it in the 2nd (/rom) partition on your eMMC.\n\n");
lcd_puts(" Set to \"0\" to default to normal uImage/uRamdisk boot.\n");
lcd_puts(" Set to \"1\" to default to alternate uAltImg/uAltRam boot.\n\n");
lcd_console_setcolor(CONSOLE_COLOR_ORANGE, CONSOLE_COLOR_BLACK);
lcd_puts(" NOTE: If set to \"1\" and uAltImg is MISSING on your boot\n");
lcd_puts(" device, the boot will fall back to uImage/uRamdisk.");
lcd_console_setcolor(CONSOLE_COLOR_CYAN, CONSOLE_COLOR_BLACK);
lcd_puts("\n\n\n CAN I SET MY DEFAULT BOOT DEVICE TO ALWAYS USE EMMC?\n\n");
lcd_puts(" Yes, by creating a file:\n\n");
lcd_console_setcolor(CONSOLE_COLOR_GRAY, CONSOLE_COLOR_BLACK);
lcd_puts(" u-boot.device\n\n");
lcd_console_setcolor(CONSOLE_COLOR_CYAN, CONSOLE_COLOR_BLACK);
lcd_puts(" Put it in the first partition of your boot volume.\n\n");
lcd_puts(" Setting this file to \"0\" means default boot device is SD card.\n");
lcd_puts(" Setting this file to \"1\" means default boot device is eMMC.");
lcd_puts(" Put it in the 2nd (/rom) partition on your eMMC.\n\n");
lcd_puts(" Set to \"0\" for normal default boot.\n");
lcd_puts(" Set to \"1\" for default boot from eMMC.");
lcd_console_setpos(60, 0);
lcd_puts(" ------\n Encore U-Boot Menu by j4mm3r.\n 1.2 port + extras by fattire");
opt = 0;
Expand Down
20 changes: 18 additions & 2 deletions include/configs/omap3621_evt1a.h
Expand Up @@ -204,7 +204,7 @@
//This can be used as loading address for gas gauge history data
#define LOAD_ADDRESS 0x81C00000

#define CONFIG_BOOTCOMMAND "run autodetectmmc; run readtokens; run checkbootcount; run checkrom; run checkupdate; run checkbcb; run ${bootvar}"
#define CONFIG_BOOTCOMMAND "run autodetectmmc; run checkforalt; run readtokens; run checkbootcount; run checkrom; run checkupdate; run checkbcb; run ${bootvar}"
//#define CONFIG_BOOTARGS "console=ttyS0,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1 mem=256M init=/init"
#define CONFIG_BOOTARGS ""

Expand Down Expand Up @@ -254,14 +254,30 @@ else\
setenv mmcromdev 1;\
fi;\
mmcinit $mmcbootdev;\
mmcinit ${mmcromdev};\
if itest ${customboot} -eq 0; then\
if fatload mmc $mmcbootdev 0x81c00000 u-boot.device 1; then \
if fatload mmc ${mmcromdev}:2 0x81c00000 u-boot.device 1; then \
setenvmem mmcbootdev 0x81c00000 1;\
setenvmem mmcromdev 0x81c00000 1;\
fi;\
fi"\
"\0" \
\
"checkforalt=\
if itest ${customboot} -eq 0; then\
mmcinit ${mmcromdev};\
if fatload mmc ${mmcromdev}:2 0x81c00000 u-boot.altboot 1; then \
mmcinit ${mmcbootdev};\
fatload mmc ${mmcbootdev} 0x81c00000 uAltImg 1;\
if itest.l $? -ne 0; then\
echo Missing uAltImg so no altboot;\
else\
setenv bootvar altboot;\
fi;\
fi;\
fi"\
"\0" \
\
"readtokens=if fatload mmc ${mmcromdev}:2 0x81c00000 devconf/DeviceID 100; then\
setenvmem serialnum 0x81c00000 0x$filesize;\
fi;\
Expand Down

0 comments on commit c04152b

Please sign in to comment.