Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Paste Description for Stuff

Untar the first tar file found, then try to boot from /.rockbox/rockbox.gigabeat

Stuff
Friday, February 15th, 2008 at 12:48:35pm UTC 

  1. Index: bootloader/gigabeat-s.c
  2. ===================================================================
  3. --- bootloader/gigabeat-s.c     (rĂ©vision 16312)
  4. +++ bootloader/gigabeat-s.c     (copie de travail)
  5. @@ -51,6 +51,7 @@
  6.  char buf[MAX_PATH];
  7.  char basedir[] = "/Content/0b00/00/"; /* Where files sent via MTP are stored */
  8.  char model[5];
  9. +char tarstring[6];
  10.  int (*kernel_entry)(void);
  11.  extern void reference_system_c(void);
  12.  
  13. @@ -61,6 +62,63 @@
  14.      reference_system_c();
  15.  }
  16.  
  17. +void untar(int tar_fd)
  18. +{
  19. +    char buffer[157];
  20. +    char path[102];
  21. +    char copybuf[512];
  22. +    int n, size = 0, i, pos = 0;
  23. +    int fd;
  24. +
  25. +    while (1)
  26. +    {
  27. +        n = read(tar_fd, buffer, 157);
  28. +
  29. +        /* Parse the size field */
  30. +        size = 0;
  31. +        for (i = 124 ; i < 124 + 11 ; i++) {
  32. +            size = (8 * size) + buffer[i] - '0';
  33. +        }
  34. +        /* Round length up to next multiple of 512 */
  35. +        //len = (size + 511) & (~511);
  36. +
  37. +        /* Skip rest of header */
  38. +        pos = lseek(tar_fd, 512 - 157, SEEK_CUR);
  39. +
  40. +        if (pos + size > filesize(tar_fd))
  41. +            break;
  42. +
  43. +        strcpy(path, "/");
  44. +        strcat(path, buffer);
  45. +
  46. +        printf("%s (%d)\n", path, size);
  47. +
  48. +        if (buffer[156] == '0')  /* file */
  49. +        {
  50. +            int rc, total = 0;
  51. +            fd = creat(path);
  52. +            while (total < size)
  53. +            {
  54. +                rc = read(tar_fd, copybuf, sizeof(copybuf));
  55. +                pos += rc;
  56. +                n = write(fd, copybuf, MIN(rc, size - total));
  57. +                if (n < 0)
  58. +                {
  59. +                    printf("write returned %d\n", n);
  60. +                    break;
  61. +                }
  62. +                total += n;
  63. +            }
  64. +            close(fd);
  65. +        }
  66. +        else if (buffer[156] == '5')  /* directory */
  67. +        {
  68. +            mkdir(path);
  69. +            pos = lseek(tar_fd, (size + 511) & (~511), SEEK_CUR);
  70. +        }
  71. +    }
  72. +}
  73. +
  74.  void main(void)
  75.  {
  76.      lcd_clear_display();
  77. @@ -103,6 +161,7 @@
  78.              fd = open(buf, O_RDONLY);
  79.              if (fd >= 0)
  80.              {
  81. +#if 0
  82.                  lseek(fd, 4, SEEK_SET);
  83.                  rc = read(fd, model, 4);
  84.                  close(fd);
  85. @@ -112,6 +171,23 @@
  86.                      if (strcmp(model, "gigs") == 0)
  87.                          break;
  88.                  }
  89. +#endif
  90. +
  91. +                lseek(fd, 257, SEEK_SET);
  92. +                rc = read(fd, tarstring, 5);
  93. +                if (rc == 5)
  94. +                {
  95. +                    tarstring[5] = 0;
  96. +                    if (strcmp(tarstring, "ustar") == 0)
  97. +                    {
  98. +                        printf("Found tar file");
  99. +                        lseek(fd, 0, SEEK_SET);
  100. +                        untar(fd);
  101. +                        close(fd);
  102. +                        break;
  103. +                    }
  104. +                }
  105. +                close(fd);
  106.              }
  107.          }
  108.      }
  109. @@ -122,7 +198,7 @@
  110.      unsigned char *loadbuffer = (unsigned char *)0x0;
  111.      int buffer_size = 31*1024*1024;
  112.  
  113. -    rc = load_firmware(loadbuffer, buf, buffer_size);
  114. +    rc = load_firmware(loadbuffer, "/.rockbox/rockbox.gigabeat", buffer_size);
  115.      if(rc < 0)
  116.          error((int)buf, rc);
  117.  

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right
worth-right