Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
bauwks
Old
#1  
Junior Member - OP
Thanks Meter 147
Posts: 16
Join Date: Jan 2012
Post BCB, BootCnt, and the bootdata partition

Maybe some of you guys have figured this out already but it's probably important to note for people developing custom recovery or boot ROMs.

There is a partition on the internal flash named "bootdata" that stores a files named BCB and BootCnt. The secure bootloader updates BootCnt on every non-sdcard boot and if it gets too high it will automatically boot into the recovery partition instead of the boot partition. So, if you're making any custom ROM to be run from the internal flash then you'll want to reset that file in a boot script somewhere. The shell command "dd if=/dev/zero of=/bootdata/BootCnt bs=1 count=4" would do it (Assuming you've mounted the bootdata partition )

The BCB file is similar in that if the secure bootloader boots into the recovery partition for any reason, it will write to that file and will always boot into the recovery partition until that file is cleared. The shell command to clear that file is "dd if=/dev/zero of=/bootdata/BCB bs=1 count=1088"

The bootdata partition just contains a standard vfat filesystem so you just mount it normally.

And for the love of your god do not delete those files! If you do then booting from internal memory will continue to boot into the recovery partition until they are replaced. You would be able to boot from an SD card to replace them though.
The Following 11 Users Say Thank You to bauwks For This Useful Post: [ Click to Expand ]
 
nemith
Old
#2  
Senior Member
Thanks Meter 461
Posts: 218
Join Date: Jun 2010
Quote:
Originally Posted by bauwks View Post
Maybe some of you guys have figured this out already but it's probably important to note for people developing custom recovery or boot ROMs.

There is a partition on the internal flash named "bootdata" that stores a files named BCB and BootCnt. The secure bootloader updates BootCnt on every non-sdcard boot and if it gets too high it will automatically boot into the recovery partition instead of the boot partition. So, if you're making any custom ROM to be run from the internal flash then you'll want to reset that file in a boot script somewhere. The shell command "dd if=/dev/zero of=/bootdata/BootCnt bs=1 count=4" would do it (Assuming you've mounted the bootdata partition )

The BCB file is similar in that if the secure bootloader boots into the recovery partition for any reason, it will write to that file and will always boot into the recovery partition until that file is cleared. The shell command to clear that file is "dd if=/dev/zero of=/bootdata/BCB bs=1 count=1088"

The bootdata partition just contains a standard vfat filesystem so you just mount it normally.

And for the love of your god do not delete those files! If you do then booting from internal memory will continue to boot into the recovery partition until they are replaced. You would be able to boot from an SD card to replace them though.
Yup. On the NookColor these had the same functions. Lived on /rom instead of /bootdata however.

Note: My CWM image doesn't probably handle BCB or bootcnt yet (I do in my CM9 image but that is another thing )
 
AdamOutler
Old
#3  
AdamOutler's Avatar
Elite Recognized Developer
Thanks Meter 8035
Posts: 4,745
Join Date: Feb 2011
Location: Louisiana

 
DONATE TO ME
Quote:
Originally Posted by nemith View Post
Yup. On the NookColor these had the same functions. Lived on /rom instead of /bootdata however.

Note: My CWM image doesn't probably handle BCB or bootcnt yet (I do in my CM9 image but that is another thing )
My Ubuntu image does not mount this partition.
I ignore PMs with questions that could be answered by searching. If you PM me, I probly won't respond.
Check out my developer pages. Add me to your circles on Google Plus.
 
fattire
Old
(Last edited by fattire; 14th January 2012 at 07:18 AM.)
#4  
fattire's Avatar
Recognized Developer
Thanks Meter 3786
Posts: 1,295
Join Date: Oct 2010
Quote:
Originally Posted by bauwks View Post
Maybe some of you guys have figured this out already but it's probably important to note for people developing custom recovery or boot ROMs.

And for the love of your god do not delete those files! If you do then booting from internal memory will continue to boot into the recovery partition until they are replaced. You would be able to boot from an SD card to replace them though.
Yep-- this is all taken care of in cm9

Update: I don't think you mentioned, but for completeness, there's also the serial file in /rom at devconf/DeviceId that will trigger a rom reformat if it goes missing. there are also some edge conditions that will trigger recovery/flashing such as the presence of certain update.zip files on SD. Also SD boots are treated differently by default, don't increase the boot count, etc. In short, this is very similar to how NookColor works with the added disadvantage of having to deal with, rather than simply ignore or remove, these various "go to recovery' conditions.
 
Goncezilla
Old
#5  
Senior Member
Thanks Meter 535
Posts: 158
Join Date: May 2010
Location: Washington DC

 
DONATE TO ME
I can verify that Bauwks script works and allows internal booting without a bootloop.

Nemith, if you find the time can you add something like this to your CWM recovery.img? I think just adding the /bootdata mount and dd calls to the init.rc file should work. I was going to build my own CWM .img but figured you already had the source code handy.

I'de like to dabble in a CM7 port soon, while CM9 and Ubuntu ports are in-work

Thanks for all your hard work guys!
 
tyriekgo
Old
#6  
tyriekgo's Avatar
Junior Member
Thanks Meter 11
Posts: 23
Join Date: Apr 2012
Location: NewJersey
Exclamation CWM recovery bootloop

Quote:
Originally Posted by bauwks View Post

And for the love of your god do not delete those files! If you do then booting from internal memory will continue to boot into the recovery partition until they are replaced. You would be able to boot from an SD card to replace them though.
I flashed cm9 alpha 0.2 on my nook tablet using the nook tablet recovery apk. It booted into cyanoboot, however it had an error message that said disc majic error. I noticed I had put the wrong boot image on my sd card from the alpha 0.1. I rebooted 8 times and booted into cwm. Now in cwm I flashed a backup of my tablet. I then made the common mistake of clicking reboot recovery. Then trying to fix the bootloop into cwm recovery while unaware of the sevarity of what I was doing I went into mounts and storage and formated each bootdata, cache, data, emmc, rom, and system. I just restored my backup again and now I know what I need to do. My stock Nook recovery was overwriten when I clicked reboot recovery. Also I formated my rom folder and that might have contained my serial number and info.
I basicaly deleted my partions. while stuck in the cwm boot loop. Can you please send me or send me the link to a step by step way that I can get my nook tablet 16gb stuck in the cwm boot loop back to normal.
I tried using fastboot but I dont know the commands to open it. Also I dont know how to use adb either. I have a 2gig, and a 256 mb micro sd. I have a windows pc. Can you show me step by step how to restore those partions, how to do it on adb or fastboot, or the update zip method. I need help as soon as possible. Thanks.

Its similar to this http://www.youtube.com/watch?v=0BAZWya-o4M">http://www.youtube.com/watch?v=0BAZWya-o4M" type="application/x-shockwave-flash" width="425" height="350">
 
roustabout
Old
(Last edited by roustabout; 17th May 2012 at 04:27 AM.)
#7  
Senior Member
Thanks Meter 135
Posts: 400
Join Date: Feb 2011
This seems like the only place folks are looking at bcb in much detail, so I thought I'd post an observation: on the simple touch, if you boot from noogie after issuing an "erase and deregister" command from the OS, the bcb file contains command strings.

I don't know what reads the strings, but after erase and deregister, bcb seems to be used to tell the device to run recovery:

recovery --wipe_data

is an ascii string from bcb on a deregistered and not yet rebooted glowworm - I put the noogie disk in, did the erase and deregister, then dumped the partitions once it came back up.

the command flags available in recovery as of cupcake are documented at

http://www.netmite.com/android/mydro...ery/recovery.c

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...

XDA PORTAL POSTS

Auto Test Your Android Apps with Robotium

You’ve just finished coding your very first app, but before you release it to the wild, you … more

Open Source CPU Info App for Windows

So you’re playing with your shiny new Windows 8 tablet PC, when one of your like-minded geeky … more

Guide to Using Adobe Air on Android

When writing an app with performance in mind, you most likely want to write it native code using the … more