Skip to content

Instantly share code, notes, and snippets.

@Fohdeesha
Created September 4, 2021 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fohdeesha/97519df0172894a3c92e1a7a367126cf to your computer and use it in GitHub Desktop.
Save Fohdeesha/97519df0172894a3c92e1a7a367126cf to your computer and use it in GitHub Desktop.
ICX7150 u-boot factory default routine
+int do_factory_default(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ int ret = 1;
+ char ch;
+
+ switch (argc) {
+ case 2:
+ if(strcmp(argv[1],"set-default") == 0) {
+ printf("Execution of \"factory set-default\" will remove all user data like config, keys etc.\n\n");
+ printf("Do you want to continue? (Y/N) ");
+
+ ch = getc();
+ printf("%c\n", ch);
+
+ if (ch == 'Y') {
+ ret = do_set_default();
+ } else {
+ printf("\nAborting operation\n");
-------------
+static int do_set_default (void) {
+ fips_status = 0;
+ fips_reset = 1;
+ fips_reset_flag = 0;
+ setenv("fips_reset", "fipsreset");
+ setenv("fips_status", NULL);
+ saveenv();
+ reserve_cmd = normal_mode_cmd;
+ fips_reset_flag = 1;
+
+ printf("\nCommand executed successfully\n");
+
+ return 0;
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment