[lfs-support] A Question about EFI Partition

2018-06-10 Thread Rob
I just want to make sure this partition layout is correct before
doing grub.
fdisk -l /dev/sdb
Disk /dev/sdb: 37.3 GiB, 400 bytes, 78125000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3423800A-F837-4BAA-9B7A-416EE111C386

DeviceStart  End  Sectors  Size Type
/dev/sdb1  2048  1050623  1048576  512M EFI System
/dev/sdb2   1050624 32507903 31457280   15G Linux filesystem
/dev/sdb3  32507904 66062335 33554432   16G Linux swap

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] A Question about EFI Partition

2018-06-10 Thread Xi Ruoyao
On 2018-06-10 07:27 -0500, Rob wrote:
> I just want to make sure this partition layout is correct before
> doing grub.
> fdisk -l /dev/sdb
> Disk /dev/sdb: 37.3 GiB, 400 bytes, 78125000 sectors
> Units: sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disklabel type: gpt
> Disk identifier: 3423800A-F837-4BAA-9B7A-416EE111C386
> 
> DeviceStart  End  Sectors  Size Type
> /dev/sdb1  2048  1050623  1048576  512M EFI System
> /dev/sdb2   1050624 32507903 31457280   15G Linux filesystem
> /dev/sdb3  32507904 66062335 33554432   16G Linux swap

LFS book does *not* support EFI.  If you followed the book, you should
use "legacy boot" instead of EFI.  And, since the partition table is
GPT, you should create a "BIOS boot partition" (in section 2.4.1.3 of
LFS book) for it.

If you want to use EFI, follow the hint
.

BTW, why do you need a 16 GB swap?
-- 
Xi Ruoyao 
School of Aerospace Science and Technology, Xidian University
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] A Question about EFI Partition

2018-06-10 Thread Rob
Xi Ruoyao  wrote:
LFS book does *not* support EFI.  If you followed the book, you should
use "legacy boot" instead of EFI.  And, since the partition table is
GPT, you should create a "BIOS boot partition" (in section 2.4.1.3 of
LFS book) for it.

There is no such thing as legacy boot on this machine.
So I have to follow the UEFI hint and hope it actually works.

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] A Question about EFI Partition

2018-06-10 Thread Bruce Dubbs

On 06/10/2018 08:31 AM, Rob wrote:

Xi Ruoyao  wrote:
LFS book does *not* support EFI.  If you followed the book, you should
use "legacy boot" instead of EFI.  And, since the partition table is
GPT, you should create a "BIOS boot partition" (in section 2.4.1.3 of
LFS book) for it.

There is no such thing as legacy boot on this machine.
So I have to follow the UEFI hint and hope it actually works.


Most systems do have a way to do a legacy boot.  It may be labelled 
differently though.  Look closely at the different bios screens.  If it 
can boot from a CD/DVD or USB drive, it can boot without EFI.


Since there is no need for a gui on this system, I suggest a standard 
(not systemd) build.  This is what I have for my laptop:


Number  Start (sector)End (sector)  Size   Code  Name
   1  341987   977.0 KiB   EF02  grub
   21988  392612   190.7 MiB   8300  boot
   3  39261439455114   18.6 GiB8300  debian
   43945511578517615   18.6 GiB8302  home
   57851761682423871   1.9 GiB 8200  Linux swap
   682423872   124366911   20.0 GiB8300  lfs-8.2

   ...
   23   :)

Of course you can skip the debian partition I have if you are going to 
install from a live CD/DVD.  Since you will only have one OS on the 
system, you do not need a separate partition for home, but I still 
recommend a separate /boot partition for future flexibility.


Notes:

1.  When I set this up, I was using an old version of fdisk.  The 
initial sector for the grub partition should have been 2048 which is now 
the default for both gdisk and fdisk.


2.  Without a gui, the partition size for lfs can be quite a bit 
smaller.  A size of 8 GiB would be plenty and ensure lots of room for 
building glibc and gcc.  My last basic LFS installed size was 3.1 GiB, 
including 525 MiB for the sources (gcc build size was 3702.500 MB).


  -- Bruce


--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] A Question about EFI Partition

2018-06-10 Thread lei niu
I do not quite agree with Bruce on LFS main partition size. I give / about 
50GB, and due to my laziness during LFS + BLFS installation process, this 
amount of partition is easily consumed after the gnome compilation. So my 
suggestion is: give as much space as you can to home partition, this will save 
you a lot of time to clean disks for space. niuneilneo 邮箱:niuneil...@gmail.com 
签名由 网易邮箱大师 定制 On 06/11/2018 00:28, Bruce Dubbs wrote: On 06/10/2018 08:31 AM, 
Rob wrote: > Xi Ruoyao  wrote: > LFS book does *not* 
support EFI.  If you followed the book, you should > use "legacy boot" instead 
of EFI.  And, since the partition table is > GPT, you should create a "BIOS 
boot partition" (in section 2.4.1.3 of > LFS book) for it. > > There is no such 
thing as legacy boot on this machine. > So I have to follow the UEFI hint and 
hope it actually works. Most systems do have a way to do a legacy boot.  It may 
be labelled differently though.  Look closely at the different bios screens.  
If it can boot from a CD/DVD or USB drive, it can boot without EFI. Since there 
is no need for a gui on this system, I suggest a standard (not systemd) build.  
This is what I have for my laptop: Number  Start (sector)    End (sector)  Size 
      Code  Name    1              34            1987   977.0 KiB   EF02  grub  
  2            1988          392612   190.7 MiB   8300  boot    3          
392614        39455114   18.6 GiB    8300  debian    4        39455115        
78517615   18.6 GiB    8302  home    5        78517616        82423871   1.9 
GiB     8200  Linux swap    6        82423872       124366911   20.0 GiB    
8300  lfs-8.2    ...    23   :) Of course you can skip the debian partition I 
have if you are going to install from a live CD/DVD.  Since you will only have 
one OS on the system, you do not need a separate partition for home, but I 
still recommend a separate /boot partition for future flexibility. Notes: 1.  
When I set this up, I was using an old version of fdisk.  The initial sector 
for the grub partition should have been 2048 which is now the default for both 
gdisk and fdisk. 2.  Without a gui, the partition size for lfs can be quite a 
bit smaller.  A size of 8 GiB would be plenty and ensure lots of room for 
building glibc and gcc.  My last basic LFS installed size was 3.1 GiB, 
including 525 MiB for the sources (gcc build size was 3702.500 MB).   -- Bruce 
-- http://lists.linuxfromscratch.org/listinfo/lfs-support FAQ: 
http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above 
information page Do not top post on this list. A: Because it messes up the 
order in which people normally read text. Q: Why is top-posting such a bad 
thing? A: Top-posting. Q: What is the most annoying thing in e-mail? 
http://en.wikipedia.org/wiki/Posting_style-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] A Question about EFI Partition

2018-06-10 Thread Ken Moffat
On Mon, Jun 11, 2018 at 08:29:50AM +0800, lei niu wrote:
> I do not quite agree with Bruce on LFS main partition size. I give / about 
> 50GB, and due to my laziness during LFS + BLFS installation process, this 
> amount of partition is easily consumed after the gnome compilation. So my 
> suggestion is: give as much space as you can to home partition, this will 
> save you a lot of time to clean disks for space.

You are ignoring one important fact from Rob's original post - the
disk is only 37.3GB.  To be honest, to me that looks barely usable
for storage (even with only one, probably never updated, system).

Also, please do not top-post.  And your mailer is horrible!  The
html part appears to be formatted, but the text/plain part put
everything on one line, which made replying painful.

ĸen
-- 
  Keyboard not found, Press F1 to continue
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] A Question about EFI Partition

2018-06-10 Thread Rob
Ken Moffat  wrote:
You are ignoring one important fact from Rob's original post - the
disk is only 37.3GB.  To be honest, to me that looks barely usable
for storage (even with only one, probably never updated, system).


It works fine to run the system. And the system is CLI only.
The /home is on a different disk so it can be migrated around.
And, all of my important data storage is in esata boxes.
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] A Question about EFI Partition

2018-06-10 Thread lei niu
Quite interesting to store data on mobile esata box. Please remember to backup 
important data periodically, because I have terrible experience for losing 
crucial data on usb medias. niuneilneo 邮箱:niuneil...@gmail.com 签名由 网易邮箱大师 定制 On 
06/11/2018 08:53, Rob wrote: Ken Moffat  wrote: >>You 
are ignoring one important fact from Rob's original post - the disk is only 
37.3GB.  To be honest, to me that looks barely usable for storage (even with 
only one, probably never updated, system). >It works fine to run the system. 
And the system is CLI only. The /home is on a different disk so it can be 
migrated around. And, all of my important data storage is in esata boxes. -- 
http://lists.linuxfromscratch.org/listinfo/lfs-support FAQ: 
http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above 
information page Do not top post on this list. A: Because it messes up the 
order in which people normally read text. Q: Why is top-posting such a bad 
thing? A: Top-posting. Q: What is the most annoying thing in e-mail? 
http://en.wikipedia.org/wiki/Posting_style-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] A Question about EFI Partition

2018-06-10 Thread Michael Shell
On Sun, 10 Jun 2018 07:27:53 -0500
"Rob"  wrote:

> I just want to make sure this partition layout is correct before
> doing grub.
.
.
> DeviceStart  End  Sectors  Size Type
> /dev/sdb1  2048  1050623  1048576  512M EFI System
> /dev/sdb2   1050624 32507903 31457280   15G Linux filesystem
> /dev/sdb3  32507904 66062335 33554432   16G Linux swap


  Rob,

With grub, you should have a grub, aka BIOS boot, partition of about
128.0 MiB, code EF02, after the first, EFI (code EF00) partition. It
is always a good idea to have the BIOS boot partition in case you
ever need grub. IIRC, the grub partition does not need to be
formatted.

The EFI partition, the very first one, is FAT32 and is usually mounted
on /boot/efi when servicing. 

Your kernel will have to be compiled with an EFI stub. Under the kernel
menuconfig setup, in "Processor type and features" enable:

 [*] EFI runtime service support 
 [*] EFI stub support

You should not enable mixed mode support:

 [ ]  EFI mixed-mode support


For the Built-in kernel command line (also under "Processor type and
features", you should specify the PARTUUID of your linux filesystem
that is to become /root when booted,
e.g., 
  root=PARTUUID=1234567a-af67-4c97-8154-438376dc7113 ro log_buf_len=262144 
video=DVI-I-1:1024x768-16@60 fbcon=font:VGA8x16

You can get the PARTUUID of the target partition via blkid, e.g.,

blkid /dev/sdb1

The kernel builtin settings can be overridden at load time by another
specification of these kernel parameters, say, from the boot loader
or loader command prompt. This is helpful in emergencies when the
kernel has to be told to use a different partition for /root.

To allow such an override, do not select the kernel config option
[ ]   Built-in command line overrides boot loader arguments 
under "Processor type and features"


In the kernel config under "Firmware Drivers", enable:
 EFI (Extensible Firmware Interface) Support 
 <*> EFI Variable Support via sysfs  
 <*> Register efivars backend for pstore   

Note, you may also need a kernel with EFI variable support on the
*host* system to be able to run efibootmgr to configure the EFI
setup - there is a potential catch-22 here.

After compilation, copy your new kernel arch/x86/boot/bzImage
to the EFI partition, e.g.,  (I use some additional subdirs here)

cp arch/x86/boot/bzImage /boot/efi/EFI/Linux/linux-x86_64.efi

Now use efibootmgr 

https://github.com/rhboot/efibootmgr

to create an EFI entry to your boot kernel which has an EFI stub loader:

efibootmgr --create --disk /dev/sdb --part 1 --label "UEFI: Linux-x86_64.efi" 
--loader '\EFI\Linux\linux-x86_64.efi'

beware that the --loader option (that points to a kernel with EFI stub
loader) uses the \ as a dir separator as it is on a FAT32 filesystem.
You can use the -u option to add/override kernel command line arguments.
e.g., (here I use the short form of the options, -c = --create,
-d = --disk, -p = --partition,  -L = --label, -l = --loader, etc.)

efibootmgr -c -d /dev/sda -p 1 -L "Mylabel" -l \vmlinuz-linux -u 
"root=PARTUUID=1234567a-af67-4c97-8154-438376dc7113 rw 
initrd=\initramfs-linux.img"

Now call

efibootmgr

to see the list of boot entries. The

BootOrder: 0003,,0001,0002,0005

line shows their order. Careful, the order is as shown on the
BootOrder line, *not* the order the entries appear later below
it. You can use the --bootorder (-o) option to change their order:

efibootmgr -o 2,0,1,5,3

Your EFI stub kernel should be the first one listed if you want
that to be the default. Of course, you will also want an entry
for the current host/alternate system. Your EFI system is supposed
to have a boot menu that can be accessed by pressing a certain
function key (usually its F11) at boot. That will allow you to
select something other than the default as needed.

If you get a kernel panic:

"Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)"

there is a problem with the root= setting. You have to use the
PARTUUID form and any boot loader root= specification that overrides
the specification that is builtin the kernel must also be correct.

For more info, see:
https://wiki.gentoo.org/wiki/EFI_stub_kernel#Configuration
https://wiki.gentoo.org/wiki/Efibootmgr


Using the EFI stub approach, any BIOS compatibility modes can be
disabled in the EFI/BIOS (making the system a pure EFI-only system)
and no other boot loaders whatsoever are required, other than the
EFI boot loader provided by the EFI/BIOS. efibootmgr is used to
manage these EFI/BIOS boot loader settings and pressing F11 on
boot can allow you to make a manual boot selection.



   Cheers,

   Mike Shell





-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most