Advertisement
Guest User

Untitled

a guest
May 22nd, 2013
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.72 KB | None | 0 0
  1. diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
  2. index 3169043..df57de4 100644
  3. --- a/meta/classes/boot-directdisk.bbclass
  4. +++ b/meta/classes/boot-directdisk.bbclass
  5. @@ -58,6 +58,21 @@ build_boot_dd() {
  6.         # done in blocks, thus the mod by 16 instead of 32.
  7.         BLOCKS=$(expr $BLOCKS + $(expr 16 - $(expr $BLOCKS % 16)))
  8.  
  9. +       KERNEL_VERSION=$(grep '^VERSION\s*=' ${STAGING_KERNEL_DIR}/Makefile | grep -o '[0-9]*$')
  10. +       KERNEL_PATCHLEVEL=$(grep '^PATCHLEVEL\s*=' ${STAGING_KERNEL_DIR}/Makefile | grep -o '[0-9]*$')
  11. +
  12. +       rm -rf $IMAGE
  13. +       dd if=/dev/zero of=$IMAGE bs=512 seek=1 count=0
  14. +       parted $IMAGE mklabel msdos
  15. +
  16. +       if [[ $KERNEL_VERSION -eq 3 && $KERNEL_PATCHLEVEL -ge 8 ]] || [ $KERNEL_VERSION -gt 3 ]; then
  17. +               # the disk signature generated by parted isn't really random, so regenerate it
  18. +               dd if=/dev/urandom of=$IMAGE bs=1 seek=440 count=4 conv=notrunc
  19. +
  20. +               DISK_SIGNATURE=$(hexdump -s 440 -n 4 -e '4 1 "%02x\n" "\n"' $IMAGE | tac | paste -sd '')
  21. +               sed -i "s|\broot=[^ ]*|root=PARTUUID=$DISK_SIGNATURE-02|" $HDDDIR/syslinux.cfg
  22. +       fi
  23. +
  24.         mkdosfs -n ${BOOTDD_VOLUME_ID} -S 512 -C $HDDIMG $BLOCKS
  25.         mcopy -i $HDDIMG -s $HDDDIR/* ::/
  26.  
  27. @@ -71,10 +86,8 @@ build_boot_dd() {
  28.         END3=`expr \( $ROOTFSBLOCKS \* 1024 \) + $END1`
  29.  
  30.         echo $ROOTFSBLOCKS $TOTALSIZE $END1 $END2 $END3
  31. -       rm -rf $IMAGE
  32.         dd if=/dev/zero of=$IMAGE bs=1024 seek=$TOTALSIZE count=1
  33.  
  34. -       parted $IMAGE mklabel msdos
  35.         parted $IMAGE mkpart primary fat16 0 ${END1}B
  36.         parted $IMAGE unit B mkpart primary ext2 ${END2}B ${END3}B
  37.         parted $IMAGE set 1 boot on
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement