Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Trying to build ipodpatcher for openBSD

Trying to build ipodpatcher for openBSD

From: Brian <bwaichu_at_yahoo.com>
Date: Tue, 26 Aug 2008 21:32:48 -0700 (PDT)

I have started down the road of building ipodpatcher for openBSD. I have been successful in building ipodpatcher, but I am still have some questions. And I'm still trying to get it to work.

Some questions:

* if I had previously used ipodpatcher on an ipod nano, should I receive an error saying that the partition does not match an ipod, if I turn off the silence flags? This is where I am stuck.

Some info:

* ipods show up as /dev/sd0j, where 0 can be incremented, so I had to add
  this line to ipodpatcher.c

#elif defined(__OpenBSD__)
         sprintf(ipod->diskname,"/dev/sd%dj",i);

* some functions are redeclared in fat32format.c from byteorder(3) as found in sys/types.h, for now, I just #if 0 #endif'd them out. I need some help here.

* the geometry works differently on openBSD, so here's an example c program that opens up an ipod and gets some basic geometry information,
so geometry needs to be changed in ipodio-posix.c:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/disklabel.h>
#include <sys/ioctl.h>
#include <err.h>

int
main(int argc, char **argv) {

  int fd;
  char *ipod = "/dev/sd0j";
  struct disklabel dl;

 
  fd = open(ipod, O_RDONLY);
  if (fd == -1) {
     printf("fd: %d\n", fd);
     perror("open");
     exit(EXIT_FAILURE);
  }
  /* disk geometry */

  if (ioctl(fd, DIOCGPDINFO, &dl) == -1) {
     warn("DIOCGPDINFO");
     exit(EXIT_FAILURE);
  }

  printf("sectors: %d\nsector size: %d\n", dl.d_nsectors, dl.d_secsize);
  close(fd);

  return 0;
}

Here are some temporary changes I made; need some help with how this file should be patched:

#elif defined(__OpenBSD__)
#include <sys/disklabel.h>

struct disklabel geometry;

    if(ioctl(ipod->dh, DIOCGPDINFO, &geometry) == -1 &&
       ioctl(ipod->dh, DIOCGDINFO, &geometry) == -1 ) {
        ipod->sector_size = 512;
        if (!silent) fprintf(stderr,"[ERR] ioctl() call to get sector size failed, defaulting to %d\n"
                   ,ipod->sector_size);
    }
    else {
        ipod->sector_size = geometry.d_secsize;
    }

note: I go by _emp on the irc chat.

Thanks.

      
-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox
FAQ: http://www.rockbox.org/twiki/bin/view/Main/GeneralFAQ
Etiquette: http://www.rockbox.org/mail/etiquette.html
Received on 2008-08-27


Page was last modified "Jan 10 2012" The Rockbox Crew
aaa