Thursday, October 14, 2010

fedora netinstall

1) get your Tftp server workin
2) put installation media on NFS or http server
3)setup PXE
4) at prompt type "linux"

Wednesday, April 7, 2010

Getting Linux2.6 working on Xilinx XUP board

Hardware Setup:

  1. Setup EDK project: Should be able to figure this out...Make sure you enable interrupts for Rs232_uart(for console)
  2. generate bitstreams

Software Setup:

  1. Get sources: linux2.6 from git.xilinx.com/ you can also get a generic kernel from kernel.org but should configure it properly by enabling only a select few drivers. 
  2. Setup the cross compiler: I used scripts from http://www.kegel.com/crosstool. Change the scripts to select minor-version 2. (gcc version 4.1.2)  4.1.0 doesn't compile2.6
  3. generate xilinx.dts (required for 2.6 kernel) file for your hardware setting (EDK project). This file is generated using xilinx device-tree. A harder way to do this is to manually edit one of the virtex***.dts files  in $LinuxTree/arch/powerpc/boot/dts/virtex***.dts matching you EDK system.mhs and.mss files
  4. Copy this file to the linuxtree
  5. Copy initramd before compiling. generate config for virtex2p board using virtexdefconfig files using:                                                                                                                 make ARCH=powerpc 40x/virtex_defconfig CROSS_COMPILE=powerpc-405-linux-gnu-      
  6. Compile the kernel using                                                                                                                              make ARCH=powerpc   simpleImage.xilinx CROSS_COMPILE=powerpc-405-linux-gnu-       
  7. make ARCH=powerpc   simpleImage.initrd.xilinx CROSS_COMPILE=powerpc-405-linux-gnu-   
  8. download the elf files generated in the folder arch/powerpc/boot/simpleImage[.initrd].xilinx.elf         
    Note: If the console do not respond after
                            Finalizing device tree... flat tree at 0x71e300
It could be mostly due to the Uart driver. Change it from uartlite to uart_16650(xps_uart16650) also could be some issue with the interrupt to this core.

If the kernel crashes, disable the cache setup on powerpc and try rebuilding

       

           

    Wednesday, March 10, 2010

    Some issues in C runtime calculation

    use time.h

    The clock() function has limitation in terms of the maximum value returned
    on a 32 bit machine it overflows at around 36 minutes

    use time() function instead.

    Time returns no of seconds since epoch.
    time_t start, end;
    time(&start);
    /*Do Something*/
    time(&end);
    printf("Runtime in seconds %d\n", (int)end-start);


    Setup LINUX GATEWAY

    Need Two interfaces on GATEWAY
    1:for internet (eth0)
    2:For private network(eth1)

    Configure machines in private network with proper GATEWAY and DNS
    :/etc/sysconfig/network-scripts/ifcfg-ethx

    enable ipforwarding on GATEWAY
    :echo 1 > /proc/sys/net/ipv4/ip_forward

    Flush all the iptables on GATEWAY: just be on safeside delete them aswell
    : iptables -F ; iptables -X
    : iptables -t nat -F ; iptables -t nat -F
    : iptables -t mangle -F ; iptables -t mangle -F

    Setup GATEWAY to forward packets from network to internet(IP masquarade)
    : iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    : iptables -A FORWARD -i eth1 -j ACCEPT



    Tuesday, March 9, 2010

    Disable UDP checksum

    UDP checksum is a 16bit checksum calculated over a part of IP header and UDP data.
    Normally a kernel recieving a UDP packet calcuate the checksum of the UDP packet excluding the checksum field. An "OR" with the checksum with the packet should yeild 16'b1111111111111111

    Kernel can however discard the checksum if the field is set to 0x0000..
    This set at the client which sends UDP Packet. When creating a socket at the client side set option SO_NO_CHECK for the socket

    this is done by
     optval=1;  if (setsockopt(sock_info->socket, SOL_SOCKET, SO_NO_CHECK , (void*)&optval,
     sizeof(optval) ==-1)
    printf("ERROR SETTING SO_NO_CHECK");

    SO_NO_CHECK is defined in  A server recieving these packets, ignore udp checksum.



    Sunday, November 30, 2008

    Verilog PLI

    WRITING A FORMATTED STRING

    integer file, r, a, b; reg [80*8:1] string; file = $fopenw("output.log"); r = $sformat(string, "Formatted %d %x", a, b); r = $sprintf(string, "Formatted %d %x", a, b); r = $fprintf(file, "Formatted %d %x", a, b);
    The functions $sformat and $sprintf writes a formatted string into a Verilog register.  The two functions are identical. $fprintf writes a formatted string to a file.  It has most, but not the formatting capabilites of C stdio package.  The first argument is a register to receive the formatted data, and the second is a format string.  Additional arguments may be included.

    The supported formats include b, c, d, e, f, g, h, m, o, r, s, and x. %t for printing formatted time is NOT supported yet.

    Verilog PLI

    WRITING A FORMATTED STRING

    integer file, r, a, b; reg [80*8:1] string; file = $fopenw("output.log"); r = $sformat(string, "Formatted %d %x", a, b); r = $sprintf(string, "Formatted %d %x", a, b); r = $fprintf(file, "Formatted %d %x", a, b);
    The functions $sformat and $sprintf writes a formatted string into a Verilog register.  The two functions are identical. $fprintf writes a formatted string to a file.  It has most, but not the formatting capabilites of C stdio package.  The first argument is a register to receive the formatted data, and the second is a format string.  Additional arguments may be included.

    The supported formats include b, c, d, e, f, g, h, m, o, r, s, and x. %t for printing formatted time is NOT supported yet.