resizing partitions using uboot

Brendon
I am having difficulty creating partitions in u-boot and my linux (angstrom
2009.1) recognizing my changes. 

Below is what I have done:

MINI2440 # mtdparts del rootfs
MINI2440 # setenv mtdparts
mtdparts=mini2440-nand:0x00040000(u-boot),0x00020000(u-boot_env),0x00500000(kern
el),96m(rootfs),96m(restore),-(misc)
MINI2440 # saveenv

Typing mtdparts in the console now prints this:

MINI2440 # mtdparts

device nand0 <mini2440-nand>, # parts = 6
 #: name                        size            offset          mask_flags
 0: u-boot              0x00040000      0x00000000      0
 1: u-boot_env          0x00020000      0x00040000      0
 2: kernel              0x00500000      0x00060000      0
 3: rootfs              0x06000000      0x00560000      0
 4: restore             0x06000000      0x06560000      0
 5: maco_tmp            0x03aa0000      0x0c560000      0

active partition: nand0,0 - (u-boot) 0x00040000 @ 0x00000000

defaults:
mtdids  : nand0=mini2440-nand

Which is exactly what I want. I installed the fs which i compiled using
openembedded and during bootup it prints:

...
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V
8-bit)
Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "u-boot"
0x000000040000-0x000000060000 : "u-boot-env"
0x000000060000-0x000000560000 : "kernel"
0x000000560000-0x000010000000 : "root"
...

My question is where does the info come from and how can i fix it?

When everything boots up i get the following:

root@mini2440:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               250.6M     23.3M    227.3M   9% /
none                     29.7M     40.0K     29.6M   0% /dev
/dev/mmcblk0p1            1.9G    133.8M      1.8G   7% /media/mmcblk0p1
tmpfs                    29.7M     28.0K     29.6M   0% /var/volatile
tmpfs                    29.7M         0     29.7M   0% /dev/shm
tmpfs                    29.7M         0     29.7M   0% /media/ram

Any help would greatly be appreciated.

- brendon

open-nandra
Well best would be to use mtdparts and kernel argument and remove static
definition from kernel code. Or for hacking just update kernel in
arch/arm/mach-s3c2440/mach-mini2440.c file.

marek

Brendon
Thanks marek, i fixed it by modifying
work/mini2440-angstrom-linux-gnuabi/linux-mini2440-2.6.32+git-r2/git/arch/arm/ma
ch-s3c2440/mach-mini2440.c
and changing:

/* NAND Flash on MINI2440 board */

static struct mtd_partition mini2440_default_nand_part[] = {
  [0] = {
    .name  = "u-boot",
    .size  = SZ_256K,
    .offset  = 0,
  },
  [1] = {
    .name  = "u-boot-env",
    .size  = SZ_128K,
    .offset  = SZ_256K,
  },
  [2] = {
    .name  = "kernel",
    /* 5 megabytes, for a kernel with no modules
     * or a uImage with a ramdisk attached */
    .size  = 0x00500000,
    .offset  = SZ_256K + SZ_128K,
  },
  [3] = {
    .name  = "root",
    .offset  = SZ_256K + SZ_128K + 0x00500000,
    .size  = MTDPART_SIZ_FULL,
  },
};

to this:

/* NAND Flash on MINI2440 board */

static struct mtd_partition mini2440_default_nand_part[] = {
  [0] = {
    .name  = "u-boot",
    .size  = SZ_256K,
    .offset  = 0,
  },
  [1] = {
    .name  = "u-boot-env",
    .size  = SZ_128K,
    .offset  = SZ_256K,
  },
  [2] = {
    .name  = "kernel",
    /* 5 megabytes, for a kernel with no modules
     * or a uImage with a ramdisk attached */
    .size  = 0x00500000,
    .offset  = SZ_256K + SZ_128K,
  },
  /*
  [3] = {
    .name  = "root",
    .offset  = SZ_256K + SZ_128K + 0x00500000,
    .size  = MTDPART_SIZ_FULL,
  },
  */
  [3] = {
    .name  = "rootfs",
    .offset  = 0x00560000,
    .size  = 0x06000000,
  },
  [4] = {
    .name  = "restore",
    .offset  = 0x06560000,
    .size  = 0x06000000,
  },
  [5] = {
    .name  = "maco_tmp",
    .offset  = 0x0c560000,
    .size  = 0x03aa0000,
  },
};

then in my openembedded environment i called:

# bitbake -f -c compile linux-mini2440
# bitbake linux-mini2440

and then copying the new uImage to the kernel partition.

There is probably a nicer way to do this (patch). But thats what I did and
it worked.

- brendon

open-nandra
Yes nicer way would be to add mtdparts in kernel command line (uboot
bootargs) and remove static definition from kernel code. Whatever if it
works it's good ;)

marek