[ADV] Boot menu for the Nook Color [2011-03-19]

Search This thread

j4mm3r

Senior Member
May 12, 2010
248
74
First a word of thanks to rookie1 for putting this idea in my head and get me cracking on the code. (checkout his thread: [ADV](multi)u-boot v0.1). The idea is to present a boot menu of options to select the boot order for the NC.

I have implemented a set of custom console management functions (see sources below) which can be used to display any text based interface, there is support for Portrait/Landscape orientation and two font sizes are supported (Warning! Large font sizes look extremely ugly so I haven't compiled the binary with large fonts, if anyone needs it PM, me and I can send it to you via email)

Presented here is a compiled version of the u-boot.bin binary which has default font scaling and Portrait mode selected.

Installation
Simply use the u-boot.bin from the zip file attached with the post and follow rookie1's installation instructions from the his post linked above.

Important: Backup the original u-boot.bin in case you need to restore it in the future

Usage
To get to the boot menu, simply press any key within 5 seconds when the prompt appears.

There are two options to select and each one of them has alternatives to chose from:
- Boot Device
Select between: eMMC and SD

- Boot Mode
Select between: normal, recovery and alternative

Boot device enables the selection of the boot device. For the NC, there are just two options i.e eMMC (internal) or SD card.

Boot mode allows the selection of the kernel + ramdisk combo, which is then booted off from the selected Boot device:
- normal mode: kernel image file is "uImage" and ramdisk file is "uRamDisk"
- recovery mode: kernel image file is "uRecImg" and ramdisk file is "uRecRam"
- alternate mode: kernel image file is "uAltImg" and ramdisk file is "uAltRam"

This allows for the creation of dual boot setups where uAltImg + uAltRam files can be created to support a second OS or maybe overclocked kernels. Follow your favorite method for creating these as I'm not going to expand into the topic of dual boot setups here.

Follow the on-screen key usage guide to navigate the boot menu.

Default Behavior
When no key is pressed and the NC is powered up normally, the boot behavior is to boot into the normal (files: uImage + uRamdisk) found on the boot device, hence:
- When u-boot.bin is installed on the eMMC, the uImage + uRamdisk files are from eMMC
- When u-boot.bin is installed on the SD card, the uImage + uRamdisk files are from SD card.

Setting default Boot Device
A file named "u-boot.device" can be created at the same location where u-boot.bin is installed to control the default boot device. The contents of this file determine the boot device selected at boot.

The value of "0" means SD card and "1" means eMMC. So for example if installing u-boot.bin on the SD card, one wants to set the default boot device to be eMMC instead of the SD card, then the following can setup the u-boot.device file:
Code:
# echo -n "1" > /media/SDCARD/u-boot.device
This is similar to the file u-boot.order as mentioned in rookie1's original post, but it only takes 1 byte instead of 2 in that case.

This is useful in case when you want to lend your nook to your girlfriend and have the stock BN Eclair installed on eMMC and HC on the SD card. This way you can setup u-boot.bin on the SD card along with the u-boot.device file pointing to eMMC and have the NC boot into stock even with the SD card inserted. Whenever you want to boot into HC, simply get into the boot menu and select SD + normal!!



Think of these choices as selecting the appropriate kernel + ramdisk images from either the eMMC (internal memory of the NC) or the SD card. Other exotic options like for example selecting uImage from eMMC and uRamdisk from the SD card are currently not supported.


Files
u-boot.bin_v0.4.zip - contains the u-boot.bin

Sources
(updated with v0.4 changes)
https://github.com/j4mm3r/bn_nc_u-boot/tree/boot_menu

Changelog
v0.4:
Now uses Portrait orientation for display
Implemented custom console functions that support:
Font scaling (default or double size)
Portait/Landscape mode
Added support for Portrait/Landscape mode
Changed keys to suit Portrait orientation

v0.3:
Cleaned up sources, misc fixes
Missed the power key (Press any key?)

v0.2:
Improved lcd console display
Supports alternate boot mode
Supports setting up a default boot device

v0.1:
Initial release

I'm lazy...
Make CWR installable zip (SD and eMMC versions)

A few words of caution: Please don't use this if you don't understand what you are doing and remember all the usual disclaimers and warnings apply here as well.

Furthermore, I target this thread towards developers and advanced users so I have deliberately left out user friendly instructions. Feel free to incorporate it into your own custom ROM/CWR release.


Enjoy!
 

Attachments

  • u-boot_v0.4.bin.zip
    93.2 KB · Views: 2,479
  • u-boot.jpg
    u-boot.jpg
    86.5 KB · Views: 3,646
Last edited:

Novarider

Senior Member
Jul 20, 2010
1,243
97
would it be possible to update this so we could choose the emmc or the media position? what I mean is could this work with dual boot.
 

j4mm3r

Senior Member
May 12, 2010
248
74
Not exactly sure what you mean, this is just the second stage boot loader. AFIAK, hardware limitations allow us to boot only from the eMMC or the SD card.

If you by any chance you meant the location of the /media mount after booting into Android, then I'm afraid that it is not under boot-loader control. Thats the job of init.rc loaded from the ram disk or depends upon the configuration for vold.

would it be possible to update this so we could choose the emmc or the media position? what I mean is could this work with dual boot.
 

mrmark93

Senior Member
Sep 1, 2008
67
9
Sorry to waste space, but I had to say THANK YOU! The explanation of what each option boots, made the light bulb come on... I finally understand uRamdisk, uImage, etc.

Thanks! Nice options to have!
 

simon.ponder

Senior Member
May 12, 2010
192
21
Burlington
Recovery

This is a great idea that should be worked into a recovery as current recoveries are wiping eMMC when flashing new rom zip. I see some great things with this.
 

Socrguru

Senior Member
Feb 4, 2007
424
162
Bennington, NE
Would it be possible to alter this to allow boot into the "alternate" ROMs allowed by rookie1's dual-boot code? For example, I could set up dual-boot Eclair/Honeycomb on my eMMC using his code, then put CM7 on my SD card (and maybe even Froyo as well?), and choose between them?

Like this:
eMMC Normal
eMMC Alternate
SD Normal
SD Alternate

And you could include the recovery options you listed as well...
 
Last edited:

Canadoc

Senior Member
Nov 29, 2010
1,823
118
Would it be possible to alter this to allow boot into the "alternate" ROMs allowed by rookie1's dual-boot code? For example, I could set up dual-boot Eclair/Honeycomb on my eMMC using his code, then put CM7 on my SD card (and maybe even Froyo as well?), and choose between them?

Like this:
eMMC Normal
eMMC Alternate
SD Normal
SD Alternate

And you could include the recovery options you listed as well...

what he said!
 

faceman66

Senior Member
Feb 3, 2011
125
82
As I am working on a major document about recovery and restoring procedures, can you please update your OP instructions to include how you would UN-do this feature?

I image just creating backup copy of the uboot.bin, but want to make sure.
 

sugwacee

Senior Member
Dec 23, 2010
80
18
First a word of thanks to rookie1 for putting this idea in my head and get me cracking on the code. (checkout his thread: [ADV](multi)u-boot v0.1).

The idea is to present a boot menu of options to select the boot order for the NC.

Installation
Simply use the u-boot.bin from the zip file attached with the post and follow rookie1's installation instructions from the post linked above.

Instructions
To get to the boot menu, press and hold the "n" key while powering on the NC and keep pressing both the "n" key and power key till the words "Entering boot menu..." appear on the screen. Now release both the keys and, the boot menu will present itself.

There are four options to chose from:
- eMMC boot, normal
This boots from the internal eMMC in the normal mode. Which means the that uImage kernel is loaded from the eMMC boot partition and uRamdisk is the ramdisk.

- eMMC boot, recovery
This boots from the internal eMMC into recovery mode. Which means that the uRecImage kernel is loaded from the eMMC boot partition and uRecRam is the ramdisk

- SD boot, normal
This boots from SD card, in the normal mode. uImage and uRamdisk are loaded from the SD card boot partition.

- SD boot, recovery
This boots from the SD card, into recovery mode. uRecImg and uRecRam are loaded from the SD card boot partition.

Vol+/Vol- keys can be used to select between on-screen options.
Pressing the Home key (or the "n" key) then starts the boot process.

Think of these choices as selecting the appropriate kernel + ramdisk images from either the eMMC (internal memory of the NC) or the SD card. Other exotic options like for example selecting uImage from eMMC and uRamdisk from the SD card are currently not supported. Although it should be simple enough to expand the options to include lets say, an alternate normal boot overclocked kernel etc.

I'll post the sources on github very soon, but please feel to follow the patch details included here and expand the possibilities.

Files
u-boot.bin_v0.1.zip - contains the u-boot.bin
boot-menu.txt - source code patch details

Changelog
Initial release

A few words of caution: Please don't use this if you don't understand what you are doing and remember all the usual disclaimers and warnings apply here as well.

Enjoy!


next version, config file just like GRUB? kidding....

great work! U are real man!
 

j4mm3r

Senior Member
May 12, 2010
248
74
You are correct.

Yea, just back up the u-boot.bin before replacing and it can be restored when needed.

Remember, the boot menu is the only new thing added which hijacks the recovery boot procedure (Power + "n") to get into action. Not pressing anything will result in a normal boot.

As I am working on a major document about recovery and restoring procedures, can you please update your OP instructions to include how you would UN-do this feature?

I image just creating backup copy of the uboot.bin, but want to make sure.
 

faceman66

Senior Member
Feb 3, 2011
125
82
Yea, just back up the u-boot.bin before replacing and it can be restored when needed.

Remember, the boot menu is the only new thing added which hijacks the recovery boot procedure (Power + "n") to get into action. Not pressing anything will result in a normal boot.

...and to be extra clear, "normal boot" would be the same as the OP's:

 

Novarider

Senior Member
Jul 20, 2010
1,243
97
Is it possible to change the way the options are displayed? I'm not complaining it works the way it is but if it could be updated to look better that would be great. Maybe have it look kinda like cwm recovery where you can see all of the choices and select one.
 

sudhirkhanger

Senior Member
Jun 29, 2010
909
48
I already dual boot. Do I need to do everything again or just flash the file in OP.

Sent from my PC36100 using XDA App
 

j4mm3r

Senior Member
May 12, 2010
248
74
This version is quite different than rookie1's dual boot. It does not use the extra file to determine the boot order nor does it have the option to boot alternate kernel + ramdisk.

Consider this as a replacement for the stock u-boot.bin that can show up a menu and let you choose from the provided options.

I already dual boot. Do I need to do everything again or just flash the file in OP.

Sent from my PC36100 using XDA App
 

sudhirkhanger

Senior Member
Jun 29, 2010
909
48
Ok Thanks.
This version is quite different than rookie1's dual boot. It does not use the extra file to determine the boot order nor does it have the option to boot alternate kernel + ramdisk.

Consider this as a replacement for the stock u-boot.bin that can show up a menu and let you choose from the provided options.



Sent from my PC36100 using XDA App
 

Top Liked Posts

  • There are no posts matching your filters.
  • 33
    First a word of thanks to rookie1 for putting this idea in my head and get me cracking on the code. (checkout his thread: [ADV](multi)u-boot v0.1). The idea is to present a boot menu of options to select the boot order for the NC.

    I have implemented a set of custom console management functions (see sources below) which can be used to display any text based interface, there is support for Portrait/Landscape orientation and two font sizes are supported (Warning! Large font sizes look extremely ugly so I haven't compiled the binary with large fonts, if anyone needs it PM, me and I can send it to you via email)

    Presented here is a compiled version of the u-boot.bin binary which has default font scaling and Portrait mode selected.

    Installation
    Simply use the u-boot.bin from the zip file attached with the post and follow rookie1's installation instructions from the his post linked above.

    Important: Backup the original u-boot.bin in case you need to restore it in the future

    Usage
    To get to the boot menu, simply press any key within 5 seconds when the prompt appears.

    There are two options to select and each one of them has alternatives to chose from:
    - Boot Device
    Select between: eMMC and SD

    - Boot Mode
    Select between: normal, recovery and alternative

    Boot device enables the selection of the boot device. For the NC, there are just two options i.e eMMC (internal) or SD card.

    Boot mode allows the selection of the kernel + ramdisk combo, which is then booted off from the selected Boot device:
    - normal mode: kernel image file is "uImage" and ramdisk file is "uRamDisk"
    - recovery mode: kernel image file is "uRecImg" and ramdisk file is "uRecRam"
    - alternate mode: kernel image file is "uAltImg" and ramdisk file is "uAltRam"

    This allows for the creation of dual boot setups where uAltImg + uAltRam files can be created to support a second OS or maybe overclocked kernels. Follow your favorite method for creating these as I'm not going to expand into the topic of dual boot setups here.

    Follow the on-screen key usage guide to navigate the boot menu.

    Default Behavior
    When no key is pressed and the NC is powered up normally, the boot behavior is to boot into the normal (files: uImage + uRamdisk) found on the boot device, hence:
    - When u-boot.bin is installed on the eMMC, the uImage + uRamdisk files are from eMMC
    - When u-boot.bin is installed on the SD card, the uImage + uRamdisk files are from SD card.

    Setting default Boot Device
    A file named "u-boot.device" can be created at the same location where u-boot.bin is installed to control the default boot device. The contents of this file determine the boot device selected at boot.

    The value of "0" means SD card and "1" means eMMC. So for example if installing u-boot.bin on the SD card, one wants to set the default boot device to be eMMC instead of the SD card, then the following can setup the u-boot.device file:
    Code:
    # echo -n "1" > /media/SDCARD/u-boot.device
    This is similar to the file u-boot.order as mentioned in rookie1's original post, but it only takes 1 byte instead of 2 in that case.

    This is useful in case when you want to lend your nook to your girlfriend and have the stock BN Eclair installed on eMMC and HC on the SD card. This way you can setup u-boot.bin on the SD card along with the u-boot.device file pointing to eMMC and have the NC boot into stock even with the SD card inserted. Whenever you want to boot into HC, simply get into the boot menu and select SD + normal!!



    Think of these choices as selecting the appropriate kernel + ramdisk images from either the eMMC (internal memory of the NC) or the SD card. Other exotic options like for example selecting uImage from eMMC and uRamdisk from the SD card are currently not supported.


    Files
    u-boot.bin_v0.4.zip - contains the u-boot.bin

    Sources
    (updated with v0.4 changes)
    https://github.com/j4mm3r/bn_nc_u-boot/tree/boot_menu

    Changelog
    v0.4:
    Now uses Portrait orientation for display
    Implemented custom console functions that support:
    Font scaling (default or double size)
    Portait/Landscape mode
    Added support for Portrait/Landscape mode
    Changed keys to suit Portrait orientation

    v0.3:
    Cleaned up sources, misc fixes
    Missed the power key (Press any key?)

    v0.2:
    Improved lcd console display
    Supports alternate boot mode
    Supports setting up a default boot device

    v0.1:
    Initial release

    I'm lazy...
    Make CWR installable zip (SD and eMMC versions)

    A few words of caution: Please don't use this if you don't understand what you are doing and remember all the usual disclaimers and warnings apply here as well.

    Furthermore, I target this thread towards developers and advanced users so I have deliberately left out user friendly instructions. Feel free to incorporate it into your own custom ROM/CWR release.


    Enjoy!
    4
    Hi Everyone,

    Sorry but I've been without my main computer for a while and looks like it'll be like that for some more weeks. I'll try to set something up on my traveling laptop to see if the 1.2 version can be updated with the boot-menu.

    Thanks
    1
    reserved

    Reserved for future updates
    1
    Brian, the poor boot loader has no idea what so ever what /system and /data are. Its job is very simple, get the kernel from the boot device, get the ramdisk from the boot device and let them go!

    Infact what you want is actually very easy to achieve, the proper way to do it is via init.

    Here is the boot sequence for Android for nook color:
    x-loader: the MLO file which loads the second stage loader u-boot
    u-boot: loads the kernel and initial ramdisk
    kernel: Now the OS actually starts, it uses the ramdisk as a starting root file system and locates the init executable.
    init: reads the file init.rc / init.<board>.rc etc and is hence responsible for bringing up the rest of the android system.

    Hence the proper place for deciding what to put in /system is in init.rc.

    yaffs2 or anyother fs is handled by the kernel so again, the poor u-boot.bin can't do anything about it.

    one of the easiest way that I can think of is to have ext3/ext4 images on the SD and have init.rc mount them as loop devices on /system or /data etc.



    Is there a way to have it mount images (yaffs2 maybe) instead of partitions for system and data? That way we could put the images on /media and would not have to repartition the eMMC and we could have as many OS'es as we fit on /media. Does NF or HC support yaffs2?

    BTW: What you've done so far is very cool!
    1
    How is the "tiwlan_drv.ko" module loaded? I don't see a call for it in init.encore.rc anywhere.

    Thanks,
    Racks

    It's loaded automatically I believe from /system/lib/modules/

    You can manually load it with

    # modprobe tiwlan_drv

    or

    #insmod /system/lib/modules/tiwlan_drv.ko

    I can't remember which of those works but play around :)