thalib.in

Embedded

Building GCC toolchain for PowerPC

- Building GCC toolchain for PowerPC Download the latest sources from ftp://ftp.gnu.org . I tested the build with binutils-2.14, gcc-3.3.2, glibc-2.3.2, glibc-linuxthreads-2.3.2 and (optionally gdb-6.0). Binutils As most of the sites suggest, start by building the toolchain in separate directories from where you downloaded and unzipped the sources. So, I do build-binutils, build-gcc and so on… Also, you can specify the PATH you want the cross-compiled binaries to go with –prefix option. Read More


Creating target images (ramdsik, ext2 image, cramfs, dtb)

- Working with Uncompressed image Mounting via ramdisk: mkdir mnt cat init-ramdisk-2-35 > /dev/ram1 mount /dev/ram1 mnt Or via loopback: mount -o loop init-ramdisk-2-35 mnt Working with ext2 Image Creating a new ext2 filesystem image # dd if=/dev/zero of=init-ramdisk.img bs=1k count=8k # mke2fs -i 1024 -b 1024 -m 3 -F -v init-ramdisk.img # mkdir temp # mount -o loop init-ramdisk.img temp # cd temp # (Do what you need to do. Read More


Enabling IPv4 Forwarding

- Enable IP forwarding, using /proc entry echo 1 > /proc/sys/net/ipv4/ip_forward Set the IP address ifconfig lo 127.0.0.1 netmask 255.0.0.0 ifconfig eth0 10.1.1.1 netmask 255.255.255.0 up ifconfig eth1 10.1.2.1 netmask 255.255.255.0 up Read More


How to Create Live CD

- Below is the steps to create live cd $ mkisofs -o /tmp/bootcd.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 8 -boot-info-table . Test the image with emulator $ qemu -cdrom /tmp/bootcd.iso -serial stdio Read More


How to Creating a GRUB boot floppy

- To create a GRUB boot floppy, you need to take the files stage1 and stage2 from the image directory, and write them to the first and the second block of the floppy disk, respectively. Caution: This procedure will destroy any data currently stored on the floppy. On a UNIX-like operating system, that is done with the following commands: # cd /usr/lib/grub/i386-pc # dd if=stage1 of=/dev/fd0 bs=512 count=1 1+0 records in 1+0 records out # dd if=stage2 of=/dev/fd0 bs=512 seek=1 153+1 records in 153+1 records out Read More


How to backup and restore HDD boot sector

- Here I will explain how we will be backup and restore the boot sector of a running pc. In this example I will consider my hardisk is /dev/sda. Backing up existing boot sector in /dev/sda hardrive dd if=/dev/sda of=bootsec.bin bs=512 count=1 Now to restore the boot sector to the hardisk use the following command. dd if=bootsec.bin of=/dev/sda bs=512 count=1 Read More


How to setup for NFS boot

- Here I would like to explain nfsbooting using diffrent bootloader with linux We will look at how to do nfsboot using Uboot, Redboot, GRUB, Lilo and etherboot. NFS boot in Uboot bootloader nfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off console=$consoledev,$baudrate $othbootargs;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr run nfsboot NFS boot in GRUB bootloader create a entry in the grub menulist file as below. title Ubuntu 9.04, kernel 2. Read More


Simple script create a uboot compatible ramdisk file

- A simple script create a uboot compatible ramdisk file #!/bin/sh ############################################################## # This is a utility used to create ramdisk Image for uboot # # # # Author : Mohamed Thalib .H # # Date : Thursday, June 25 2009 # ############################################################## usage() { cat << EOF usage: $0 options example: $0 -d <rootfs directory> This commmand generates ramdisk.ext2.gz.uboot OPTIONS: -h Show this message -d Source directory EOF } SRC_DIR= OUT_FILE= while getopts “hd:” OPTION do case $OPTION in h) usage exit 1 ;; d) SRC_DIR=$OPTARG ;; ? Read More


How to Extract Android boot.img

- Unlike system.img boot.img is not a filesystem image. It is read by the bootloader, and contains a kernel image and a tiny ramdisk image. boot.img is created using mkbootimg tool, and unpacked using unmkbootimg, these tools are part of Android source, but you can download these tools from this git https://github.com/pbatard/bootimg-tools Download the source and execute the make file to compile the tools Extracting/Unpacking boot.img: unmkbootimg command usage $ . Read More


Programming Linux from Uboot

- Short guide, from my very old notes on how to Configuring U-Boot for various Linux deployments Flashing U-Boot from U-Boot The flash range is from 0xE8000000 to 0xEFFFFFFF: 128MB. already a workable U-Boot programmed in the Flash: =>tftp 1000000 u-boot.bin =>protect off all =>erase eff80000 efffffff =>cp.b 1000000 eff80000 $filesize Then reset the board to boot it up. Configuring U-Boot for RAM boot deployment =>setenv ipaddr <board_ipaddress> =>setenv serverip <tftp_serverip> =>setenv gatewayip <your_gatewayip> =>setenv bootargs root=/dev/ram rw console=ttyS0,115200 =>saveenv =>tftp 1000000 uImage =>tftp 2000000 rootfs. Read More