title: Allocating a larger u-boot image
body: <p>I am compiling my own kernel and bootloader (U-boot). I added a bunch of new environmental variables, but U-boot doesn't load anymore (it just doesn't load anything from the memory). I am using pocketbeagle and booting from an SD card. Thus I am editing the file "am335x_evm.h" found in /include/configs/. </p>
  
  <p>I am trying to allocate U-boot in a way that it has more space for the environmental variables and that it can load succesfully from the memory, but I have been unable to do so. As far as I understand, by default it allocates 128kb of memory to U-boot env variables. Since I added a bunch of them, I am trying to increase its size from 128kb to 512kb.</p>
  
  <p>I have changed the following line (from 128kb to 512kb):</p>
  
  <pre><code>#define CONFIG_ENV_SIZE         (512 &lt;&lt; 10)
  </code></pre>
  
  <p><em>(By the way, anyone knows why it is shifted to the left 10 bits?)</em></p>
  
  <p>I have also changed CONFIG_ENV_OFFSET and CONFIG_ENV_OFFSET_REDUND  to:</p>
  
  <pre><code>#define CONFIG_ENV_OFFSET       (1152 &lt;&lt; 10) /* Originally 768 KiB in */
  #define CONFIG_ENV_OFFSET_REDUND    (1664 &lt;&lt; 10) /* Originally 896 KiB in */
  </code></pre>
  
  <p>Then after compiling the new U-boot, I format the SD card and insert the new kernel and U-boot.</p>
  
  <p>I start by erasing partitions:</p>
  
  <pre><code>export DISK=/dev/mmcblk0
  sudo dd if=/dev/zero of=${DISK} bs=1M count=10
  </code></pre>
  
  <p>Then I transfer U-boot by doing:</p>
  
  <pre><code>sudo dd if=./u-boot/MLO of=${DISK} count=1 seek=1 bs=512k
  sudo dd if=./u-boot/u-boot.img of=${DISK} count=2 seek=1 bs=576k
  </code></pre>
  
  <p>I then create the partition layout by doing:</p>
  
  <pre><code>sudo sfdisk ${DISK} &lt;&lt;-__EOF__
  4M,,L,*
  __EOF__
  </code></pre>
  
  <p>Then I add the kernel, binary trees, kernel modules, etc... When trying to boot and reading the serial port, I get nothing at all. U-boot is not able to load anything from the SD card. What am I doing wrong? I'd appreciate if you could point me what my problem is and exactly what I should be doing to increase the size and allocate everything correctly.</p>