[Buildroot] About i386 Architecture and Grub2
lee choon gay
choongay at yahoo.com
Sun Aug 24 09:13:17 UTC 2014
Hi, friend.
I took a look at the /boot/grub/grub.cfg from my PC, it also need initrd to boot up.
I also saw some article from internet saying initrd is a must and the kernel init process is the one that responsible to switch from ram file system to real file system.
Anyway, if I can get a USB to RS232 cable next week I can try to capture the log and see.
Currently I have a workaround to change root to real file system during kernel init.
Below is the code I use.
I put the code in /etc/init.d as startup.sh and create S99startup by refering to other scripts in /etc/init.d to call out my startup.sh .
#!/bin/busybox sh
# Wait for sda detected
sleep 5
# Mount the root filesystem.
mkdir /mnt/root
mount -t ext4 /dev/sda1 /mnt/root
mount -o bind /dev /mnt/root/dev
mount -o bind /proc /mnt/root/proc
# Boot the real thing.
chroot /mnt/root /linuxrc
Thanks.
On Thursday, August 21, 2014 9:03 PM, Thomas Petazzoni <thomas.petazzoni at free-electrons.com> wrote:
Dear lee choon gay,
On Wed, 20 Aug 2014 19:31:49 -0700, lee choon gay wrote:
> I build the code with settings below.
> menuconfig -> Filesystem images -> ext4.
> menuconfig -> Filesystem images -> tar the root filesystem.
> menuconfig -> System configuration -> Init system with Busybox (default).
> menuconfig -> Toolchain -> Buildroot toolchain (default).
> menuconfig -> Toolchain -> C library uClibc (default).
>
> Steps to build the partitions.
> 1) I use sudo dd if=/dev/zero bs=1M count=1 of=/dev/sdb to wipe out the original partition in my pendrive.
> 2) sudo fdisk -l will shows /dev/sdb doesn't contain
> a valid partition table.
> 3) To recreate the partition, I use sudo fdisk /dev/sdb.
> 4) I enter n for new partition, p for primary, label partition as 1, default minimum for first sector, 5000000 for last sector.
> 5) Then enter n again to create second partition, p for primary, label partition as 2, 5000001 for first sector, default maximum for last sector.
> 6) Then enter w to write the partition table.
> 7) Power cycle the pendrive.
> 8) I format the partitions using sudo mkfs.ext4 /dev/sdb1 and sudo mkfs.ext4 /dev/sdb2.
> 9) I sudo mount /dev/sdb1 /home/leecgy/temp1 and sudo chmod a+rw /home/leecgy/temp1 to enable writing to partition 1.
> 10) Then sudo mount /dev/sdb2 /home/leecgy/temp2 and sudo chmod a+rw /home/leecgy/temp2 to enable writing to partition 2.
> 11) I right click and create new folder called boot in partition 1, then right click and copy paste the bzImage into boot folder.
> 12) Then right click and create new folder
> called grub in boot folder, then right click and copy paste the grub.cfg into grub folder.
> 13) I sudo grub-install --boot-directory=/home/leecgy/temp1/boot /dev/sdb to install grub.
You may want to follow the instructions available in the help text of
the Grub 2 option, which have been tested.
> 14) I right click and extract the rootfs.tar, then right click and copy paste the contents inside rootfs into partition 2.
Make sure you extract things as root:
sudo tar -C /home/leecgy/temp2 -xf output/images/rootfs.tar
> When trying to boot up, the code dump a lot of error and stuck. I cannot shift+page up to see the top of the error.
Please give the errors that you see. For now, we still have no idea
whether it's a bootloader problem, a kernel problem, or a root
filesystem problem. Without the boot log, there's not much we can do.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140824/751eb3c8/attachment-0002.html>
More information about the buildroot
mailing list