Patch for Beagle Bone Black eMMC to dump boot partions

From Exploitee.rs
Revision as of 21:45, 21 March 2021 by Zenofex (talk | contribs) (Created page with "Category:Generic == About == The patch below is intended to assist in dumping the boot partitions from a connected eMMC flash by patching the kernel provided with the Bea...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


About

The patch below is intended to assist in dumping the boot partitions from a connected eMMC flash by patching the kernel provided with the Beagle Bone Black.

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index aaed768..732e6e5 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -889,7 +889,9 @@ void mmc_set_chip_select(struct mmc_host *host, int mode)
  */
 static void __mmc_set_clock(struct mmc_host *host, unsigned int hz)
 {
-	WARN_ON(hz < host->f_min);
+	//maximus64 WARN_ON(hz < host->f_min);
+	if (hz < host->f_min)
+		hz = host->f_min;	
 
 	if (hz > host->f_max)
 		hz = host->f_max;
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 2743b7d..e53d19d 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1028,7 +1028,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	/*
 	 * Activate high speed (if supported)
 	 */
-	if (card->ext_csd.hs_max_dtr != 0) {
+	//maximus64 if (card->ext_csd.hs_max_dtr != 0) {
+	if (0) {
 		err = 0;
 		if (card->ext_csd.hs_max_dtr > 52000000 &&
 		    host->caps2 & MMC_CAP2_HS200)
@@ -1077,7 +1078,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	/*
 	 * Indicate DDR mode (if supported).
 	 */
-	if (mmc_card_highspeed(card)) {
+	//maximus64 if (mmc_card_highspeed(card)) {
+	if (0) {
 		if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_8V)
 			&& ((host->caps & (MMC_CAP_1_8V_DDR |
 			     MMC_CAP_UHS_DDR50))
@@ -1093,7 +1095,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	/*
 	 * Indicate HS200 SDR mode (if supported).
 	 */
-	if (mmc_card_hs200(card)) {
+	//maximus64 if (mmc_card_hs200(card)) {
+	if (0) {
 		u32 ext_csd_bits;
 		u32 bus_width = card->host->ios.bus_width;
 
@@ -1133,9 +1136,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	/*
 	 * Activate wide bus and DDR (if supported).
 	 */
-	if (!mmc_card_hs200(card) &&
-	    (card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
-	    (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
+	//maximus64 if (!mmc_card_hs200(card) &&
+	//    (card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
+	//    (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
+	if (0) {
 		static unsigned ext_csd_bits[][2] = {
 			{ EXT_CSD_BUS_WIDTH_8, EXT_CSD_DDR_BUS_WIDTH_8 },
 			{ EXT_CSD_BUS_WIDTH_4, EXT_CSD_DDR_BUS_WIDTH_4 },
@@ -1235,7 +1239,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	/*
 	 * Enable HPI feature (if supported)
 	 */
-	if (card->ext_csd.hpi) {
+	//maximus64 if (card->ext_csd.hpi) {
+	if (0) {
 		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
 				EXT_CSD_HPI_MGMT, 1,
 				card->ext_csd.generic_cmd6_time);
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 74972c2..8a9f5ff 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -617,9 +617,10 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
 	}
 
 	/* Set 4-bit bus width */
-	if ((card->host->caps & MMC_CAP_4_BIT_DATA) &&
-	    (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
-		err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
+	//if ((card->host->caps & MMC_CAP_4_BIT_DATA) &&
+	//    (card->		if (err)
 			goto out;
 
@@ -987,10 +988,11 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
 
 		/*
 		 * Switch to wider bus (if supported).
-		 */
-		if ((host->caps & MMC_CAP_4_BIT_DATA) &&
-			(card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
-			err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
+		 */		
+		//if ((host->caps & MMC_CAP_4_BIT_DATA) &&
+		//	(card->scr.bus_widths &