Skip to content

Commit

Permalink
Verify RAM Disk
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed Nov 10, 2023
1 parent 2f3ab00 commit 5a4826a
Showing 1 changed file with 214 additions and 0 deletions.
214 changes: 214 additions & 0 deletions arch/risc-v/src/jh7110/jh7110_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

////TODO
static void jh7110_copy_ramdisk(void);
static void verify_image(uint8_t *addr);

/****************************************************************************
* Pre-processor Definitions
Expand Down Expand Up @@ -230,6 +231,219 @@ static void jh7110_copy_ramdisk(void)
// Filesystem Size must be less than RAM Disk Memory Region
DEBUGASSERT(size <= (size_t)__ramdisk_size);

_info("Before Copy: ramdisk_addr=%p\n", ramdisk_addr);////
verify_image(ramdisk_addr);////

// Copy the Filesystem Size to RAM Disk Start
memcpy((void *)__ramdisk_start, ramdisk_addr, size);

_info("After Copy: __ramdisk_start=%p\n", __ramdisk_start);////
verify_image(__ramdisk_start);////
}

// grep --binary-files=text -b -o A initrd >/tmp/a
const uint32_t search_addr[] =
{
76654,
78005,
79250,
80482,
81623,
83164,
84603,
86000,
87210,
88767,
90290,
91697,
93104,
94283,
95539,
126251,
323058,
720393,
758145,
804369,
847750,
848662,
896722,
905434,
905602,
905626,
962939,
963865,
1037559,
1101938,
1103289,
1104534,
1105766,
1107113,
1108331,
1109609,
1111165,
1112688,
1114095,
1115502,
1116681,
1117937,
1130669,
1164590,
1164611,
1164969,
1252225,
1253859,
1254881,
1256077,
1257304,
1258419,
1259602,
1260847,
1262135,
1263386,
1265431,
1266349,
1267568,
1269244,
1270683,
1271906,
1273223,
1274528,
1276024,
1277528,
1278726,
1280028,
1281247,
1282439,
1283612,
1284731,
1285841,
1287891,
1288978,
1290155,
1291380,
1292551,
1293728,
1304002,
1352731,
1386711,
1389568,
1839786,
2343665,
2734497,
2877441,
2943574,
2944390,
3093561,
3127365,
3127413,
3179122,
3188625,
3228921,
3241017,
3708922,
3956565,
3956613,
3986241,
4114689,
4242093,
4270137,
4350955,
4351881,
4421534,
4481197,
4482548,
4483793,
4485025,
4486372,
4487873,
4489396,
4490803,
4492210,
4493389,
4494645,
4507422,
4541343,
4541364,
4541722,
4637340,
4638974,
4639996,
4641192,
4642419,
4643534,
4644717,
4645962,
4647250,
4648501,
4650546,
4651464,
4652683,
4654359,
4655798,
4657021,
4658338,
4659643,
4661139,
4662643,
4663841,
4665143,
4666362,
4667581,
4668827,
4670000,
4671119,
4672229,
4674279,
4675366,
4676543,
4677768,
4678939,
4680116,
4726648,
4760628,
4763485,
4787764,
5361457,
5541978,
5550450,
5556841,
6111506,
6113697,
6337390,
6340318,
6442641,
6558417,
6809673,
6809697,
6825118,
6825142,
6826774,
7479285,
7479309,
7533561,
7672915,
7716750,
7718101,
7719346,
7720578,
7721719,
7723231,
7724732,
7726255,
7727662,
7729069,
7730248,
7731504,
7985178,
7988897,
7992714,
};

static void verify_image(uint8_t *addr)
{
for (int i = 0; i < sizeof(search_addr) / sizeof(search_addr[0]); i++)
{
const uint8_t *p = addr + search_addr[i] - 1;
if (*p != 0x0A) { _info("No Match: %p\n", p); }
}
}

0 comments on commit 5a4826a

Please sign in to comment.